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

Rename misleading topological_sort to bfs_nodes #1590

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

BenWeber42
Copy link
Contributor

This is currently work in progress to see how we can best fix this misleading naming.

Fixes #1560

Since #1560 is still in flux, we have to make sure the PR stays in sync with what we are discussing in #1560.

Additionally, at the call-sites of the previous topological_sort (before renaming), there are various comments to use a topoligical sort. After the renaming, they become misleading, so we should probably fix/improve those comments.

@BenWeber42 BenWeber42 force-pushed the fix-erronous-topological-sort branch from 355cabd to fe23f49 Compare June 19, 2024 11:10
@BenWeber42 BenWeber42 marked this pull request as ready for review June 19, 2024 14:36
@tbennun tbennun self-requested a review June 20, 2024 15:52
Copy link
Collaborator

@tbennun tbennun left a comment

Choose a reason for hiding this comment

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

Thank you

@@ -1848,7 +1848,7 @@ def get_next_scope_entries(self, sdfg, dfg, scope_entry):
parent_scope = dfg.scope_subgraph(parent_scope_entry)

# Get all scopes from the same level
all_scopes = [node for node in parent_scope.topological_sort() if isinstance(node, dace.sdfg.nodes.EntryNode)]
all_scopes = [node for node in parent_scope.bfs_nodes() if isinstance(node, dace.sdfg.nodes.EntryNode)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this not .nodes()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, a bit of a guess, but maybe because of the next line:

return all_scopes[all_scopes.index(scope_entry) + 1:]

.nodes() might return a different order.

@@ -2096,7 +2096,7 @@ def get_next_scope_entries(self, dfg, scope_entry):

# Get all non-sequential scopes from the same level
all_scopes = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not exactly sure why this does not use scope_subgraph instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, I'll try to look into this later. But for now I'd like to wrap up this PR. If we should change this, I think it should be in a separate PR.

But thanks for pointing it out. Looks like there's a potential to improve the code there.

@BenWeber42 BenWeber42 added this pull request to the merge queue Jun 27, 2024
Merged via the queue into spcl:master with commit 6fa0212 Jun 27, 2024
10 checks passed
@BenWeber42 BenWeber42 deleted the fix-erronous-topological-sort branch June 27, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

state.topological_sort is incorrect, while sdfg.utils.dfs_topological_sort is correct
2 participants