Skip to content
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

Merged
merged 10 commits into from
Feb 23, 2024
Merged

Conversation

phschaad
Copy link
Collaborator

@phschaad phschaad commented Jan 29, 2024

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, and update_sdfg_list). Until removal, the legacy methods continue to work as expected for single level SDFGs.

@phschaad phschaad marked this pull request as ready for review January 29, 2024 13:40
@@ -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.
Copy link
Collaborator

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…)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rst uses two backticks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@@ -564,32 +563,31 @@ def sdfg_id(self):
"""
Returns the unique index of the current SDFG within the current
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

dace/sdfg/state.py Show resolved Hide resolved
dace/sdfg/state.py Show resolved Hide resolved
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))
Copy link
Collaborator

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)
Copy link
Collaborator

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..

Copy link
Collaborator Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Collaborator Author

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]
Copy link
Collaborator

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

Copy link
Collaborator Author

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')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc update

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@tbennun
Copy link
Collaborator

tbennun commented Jan 29, 2024

@phschaad mostly needs a doc update

@phschaad phschaad requested a review from tbennun January 29, 2024 15:28
@phschaad phschaad added the in the merge queue waiting for CI to work again label Jan 29, 2024
@alexnick83 alexnick83 enabled auto-merge February 20, 2024 16:47
@alexnick83 alexnick83 added this pull request to the merge queue Feb 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 22, 2024
@phschaad phschaad added this pull request to the merge queue Feb 22, 2024
@phschaad phschaad removed this pull request from the merge queue due to the queue being cleared Feb 22, 2024
@phschaad phschaad added this pull request to the merge queue Feb 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 23, 2024
@phschaad phschaad enabled auto-merge February 23, 2024 10:11
@phschaad phschaad added this pull request to the merge queue Feb 23, 2024
Merged via the queue into master with commit b5ec059 Feb 23, 2024
11 checks passed
@phschaad phschaad deleted the refactor_sdfg_list_to_cfg_list branch February 23, 2024 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in the merge queue waiting for CI to work again
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants