-
Notifications
You must be signed in to change notification settings - Fork 53
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
Unstable if/whiles are errored #1467
Conversation
The backend tests aren’t great but they just check to see if we can generate backend code |
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!
Ok, merging! (@paili0628 I think this can help unblock #1431). |
Looks good overall! I do also want to point out that this doesn't entirely address the semantics question from #1438 and there is still room to hammer out a rigorous definition there. Namely, as @calebmkim notes, the policy is:
This leads to two weird cases:
So the "unfinished business" from #1438 remains: clearly defining what |
Yeah, I see what your'e saying. As for the two cases:
Interesting point. Maybe we should make the condition for a valid while loop even more restrictive. We could change criterion b) to be something like "has a comb group, and that comb group writes to the component that
I think I'd have to think about a specific case of how this would happen. I'll def keep it in mind tho. Edit: this is also just my quick thoughts. I think it may require careful thinking to lay out exactly what we want to require from while ports. |
I do think this is on the right track! I honestly don't think a sound static check is the most urgent thing here, but it's something to think about eventually. It seems like there is room to generalize the concept of
Basically, it seems like the desired policy involves some kind of "propagation" of stability, but exactly the rules for that propagation remain unclear. |
Ah, that's a good point @sampsyo @calebmkim! It better be the case that the |
@calebmkim can we open an issue about this? |
We decided on the following requirement for
while
loops/if
statements:Either: a) the condition port for if/while loops is stable or b) they have a comb group (in which case the Calyx compiler will compile it such that the loop will be stable).
One test case that I wasn't quite sure how to change:
tests/backends/mlir/with-guards.futil
, found here. I see why there's an error, but wasn't quite sure how to change it, since I'm not completely sure what the test is doing ?Some of the test cases were relying on
ThisComponent
's input ports. I changed these by making a 1 bit register that holds the value ofThisComponent
's input port and writing to that register at the very beginning. It adds an extra cycle.However, for our method of compiling static while loops with static bodies in #1431, I think it's important that the condition is not
ThisComponent
's port.