-
Notifications
You must be signed in to change notification settings - Fork 129
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
Refactor SDFG List to CFG List #1511
Conversation
@@ -113,7 +113,7 @@ namespace perf { | |||
* @param cat: Comma separated categories the event belongs to. | |||
* @param tstart: Start timestamp of the event. | |||
* @param tend: End timestamp of the event. | |||
* @param sdfg_id: SDFG ID of the element associated with this event. | |||
* @param cfg_id: SDFG ID of the element associated with this event. |
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.
Docs need changing (control flow graph id…)
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.
Added
dace/sdfg/sdfg.py
Outdated
@@ -564,32 +563,31 @@ def sdfg_id(self): | |||
""" | |||
Returns the unique index of the current SDFG within the current | |||
tree of SDFGs (top-level SDFG is 0, nested SDFGs are greater). | |||
:note: `sdfg_id` is deprecated, please use `cfg_id` instead. |
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.
rst uses two backticks
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.
Changed
dace/sdfg/sdfg.py
Outdated
@@ -564,32 +563,31 @@ def sdfg_id(self): | |||
""" | |||
Returns the unique index of the current SDFG within the current |
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.
Update docs
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.
Updated
self.state_id = state_id | ||
self.node_ids = node_ids | ||
|
||
def printer(self): | ||
print("SDFG {}:{}:{}".format(self.sdfg_id, self.state_id, self.node_ids)) | ||
print("SDFG {}:{}:{}".format(self.cfg_id, self.state_id, self.node_ids)) |
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.
This is fine to keep as is
@@ -183,7 +183,7 @@ def expand(self, sdfg: SDFG, graph: SDFGState, reduce_node): | |||
LocalStorage.node_a: nsdfg.sdfg.nodes()[0].nodes().index(inner_exit), | |||
LocalStorage.node_b: nsdfg.sdfg.nodes()[0].nodes().index(outer_exit) | |||
} | |||
nsdfg_id = nsdfg.sdfg.sdfg_list.index(nsdfg.sdfg) |
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.
I think this behavior was done on purpose (since the cfg list wasn’t updated yet or something), but it passes the tests so far..
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.
Reverted for safety
@@ -215,7 +215,7 @@ def expand(self, sdfg: SDFG, graph: SDFGState, reduce_node): | |||
LocalStorage.node_b: nsdfg.sdfg.nodes()[0].nodes().index(inner_entry) | |||
} | |||
|
|||
nsdfg_id = nsdfg.sdfg.sdfg_list.index(nsdfg.sdfg) | |||
nsdfg_id = nsdfg.sdfg.cfg_id |
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.
Same
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.
Same
@@ -224,7 +224,7 @@ def apply_pattern(self, append: bool = True, annotate: bool = True) -> Union[Any | |||
""" | |||
if append: | |||
self._sdfg.append_transformation(self) | |||
tsdfg: SDFG = self._sdfg.sdfg_list[self.sdfg_id] | |||
tsdfg: SDFG = self._sdfg.cfg_list[self.cfg_id] |
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.
How do we know it’s an SDFG? seems like it’s the parent cf block
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.
My bad, we do not. That is by design, too, but I am mixing PRs here a bit. In a different PR the interface for the transformation does not expect an SDFG anymore but a CFG (same for propagation etc.). However, I have now inserted a compatibility fix in this PR.
@@ -680,22 +680,22 @@ class SubgraphTransformation(TransformationBase): | |||
class docstring for more information. | |||
""" | |||
|
|||
sdfg_id = Property(dtype=int, desc='ID of SDFG to transform') | |||
cfg_id = Property(dtype=int, desc='ID of SDFG to transform') |
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.
Doc update
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.
Updated
@phschaad mostly needs a doc update |
Refactors the SDFG list and SDFG ids to a more general CFG list and CFG id.
This change provides a further step towards compatibility with the hierarchical, multi-level SDFGs.
The change is accompanied by a deprecation warning on the old interfaces (
sdfg_list
,sdfg_id
,reset_sdfg_list
, andupdate_sdfg_list
). Until removal, the legacy methods continue to work as expected for single level SDFGs.