-
Notifications
You must be signed in to change notification settings - Fork 131
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
Interstate assignment to map #1790
base: main
Are you sure you want to change the base?
Conversation
I should move this to a transformation. If the assigned symbol's value is used in more than one state, we need to wrap the whole subgraph where this value is necessary in a map and not just one state. |
def _is_simple_assignment(expression_str): | ||
expr = SymExpr(expression_str) | ||
simplified_expr = expr.simplify() | ||
is_constant = simplified_expr.is_number | ||
return is_constant, simplified_expr |
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.
why not use symbolic.issymbolic()?
assignments = in_edge.data._assignments | ||
condition = in_edge.data._cond_sympy |
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.
don't use the internal cached versions, use the methods that we provide.
|
||
# Create cutout of the state as an SDFG (should have only one state) | ||
# Create NestedSDFG, add it to the current state | ||
cutout = SDFGCutout.singlestate_cutout(state, *state.nodes()) |
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.
We have utility functions called dace.sdfg.utils.nest_state_subgraph
and nest_sdfg_subgraph
that are much easier to use and more stable.
@@ -0,0 +1,51 @@ | |||
from typing import Dict |
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.
Missing copyright
sdfg() | ||
|
||
if __name__ == "__main__": | ||
test_interstate_assignment() |
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.
Please run yapf :)
Maps simple interstate assignments to map encompassing the whole state.
Will complete after the bug fix on re-declaration of symbols is merge.
The pass only transforms if the assignment is a constant. (and the loops such as i = i + 1 should not be affected)