-
Notifications
You must be signed in to change notification settings - Fork 8
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
Explicit combine registers #291
Comments
Seems like a reasonable proposal—I have two questions, though:
|
Here’s what the current implementation does:
Answer to second point:
|
Aha, yes, it seems like a good idea to allow let-bound arrays (which are still kind of a weird thing!) even in unrolled loops when they aren't used in
So either one is cool! Unrelatedly, regarding the other things in the above comment:
|
The code for this would be somewhat ugly--while traversing a
Similar implementation problem where you'd have to capture all free variables in the combine body and then reverse engineer which ones are allowed to be combine registers. Again, it's unclear what the error message should look like. When the variable is defined in the loop body but not allowed to be a combine register, the error should say so. When the variable is free in the for loop body and the lexical context, the error should say so. I'm not sure if we want to implement this, but I want to propose the following desugaring for combine registers.
would turn into:
The semantics of reducers like |
Indeed! But to clarify, this was my attempt to summarize your proposal. 😃 So I suppose the error would be a "variable undefined" error when referencing it in the Yes! That is the desugaring I was imagining. This would be an extension to the general desugaring we have discussed at some points where we turn every unrolled |
TLDR: Instead of magically transforming
let
bound variables into combine registers forcombine
blocks, explicitly mark variables that should be made available in the combine block.We'd have to write:
to make
x
available in thecombine
scope. If a variable is not markedcombine
, it will not be available in the context of the combine.This also solves another problem where the loop body can define a
let
bound array which cannot be magically turned into a combine register.The text was updated successfully, but these errors were encountered: