-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove branching and nested Ref
s
#64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I need to go back in and change the pprint
stuff to support select tho so don't review the PR yet!
Thanks for reviewing @ravenrothkopf! Let's hold off on merging this for now, though; from our discussion earlier today it seems that we may not want to support nested |
Ref
sRef
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice nice nice! thank you so much for this
Over the past couple weeks @ravenrothkopf and I worked through automatic differentiation on a bunch of examples, and we realized a couple things:
Read
kind ofRef
to serve as the transpose forAccum
.Vector
space; instead, when we accumulate, we can just take an existing value of any type to choose the topology, and then work inside the dynamically-defined topology of that value. This will become more important when we Support sum types #65 but for now it just means thatBool
/Fin
/etc stay as-is instead of being transformed intoUnit
.If
with aSelect
expression just like Wasm's.Ref
s, and we can't either; to deal with this, we need to allow functions to take multiple parameters.This PR makes the necessary changes to our codebase to accommodate those IR changes, and also simplifes the IR in a couple other ways:
Vec<T>
is replaced withBox<[T]>
to save space, because the former stores three pointers while the latter only uses two; the exception isTy
which we're leaving asVec<T>
for now because ts-rs does not supportBox<[T]>
orRc<[T]>
.Func
andBlock
. EachCall
now directly encodes the generic types at that callsite, and eachFor
,Read
, andAccum
now directly owns its body.Scope
type now explicitly says whatConstraint
it satisfies, because otherwise typechecking the IR would be more annoying.