-
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
Extend dead-assign-removal
to work with static group
s
#1655
Comments
@calebmkim @paili0628 @sampsyo This seems like a good example of places where A different argument that can be made here is that the only reason this optimization is "simple" in the dynamic case is because it relies on dynamic Regardless, we should probably discuss this in the paper so that our arguments about the abstractions come off as a bit more nuanced. |
Indeed; this is a good observation about the (compiler optimization) reason that the dynamic version of Calyx exists: by giving the programmer fewer guarantees, it lets the compiler make stronger assumptions that can potentially turn into better optimizations. That is the power of UB and why it is "actually a good thing" when used carefully. One general principle this makes me think of is that, when doing optimizations, there is a fundamental question that needs to be answered differently in dynamic vs. static contexts: what is the ordering among group executions?
I think this difference is what underpins the way @calebmkim's sharing pass works for static stuff. It could also drive the way that this DCE pass works too. The algorithm could look like:
Maybe that's the same as the current |
Ah right! I forgot we have access to |
dead-assign-removal
gets rid of assignments to combinational cells that are never read from. The current pass only works for normalgroup
s. Let's extend it to work on static groups. #1653 documents one particular effort that didn't work out.The specific program is that
static par
, unlikepar
, allow groups to synchronize using timing information, making the following program valid:The dynamic version of this program is not valid.
Implementation Approach
Instead of focusing only on the groups, we need to traverse the control program and track all the combinational cells that are read from any group in a particular
par
context. Once that is done, we can go and remove assignments that are not read from anystatic group
in any thread context. The challenging part is doing this in one pass: threads can create complex cascades or combinational chains where they assign to combinational cells. For example:The text was updated successfully, but these errors were encountered: