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

Fix scalar to symbol promotion exception when trying to promote same scalar again #1757

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dace/transformation/passes/scalar_to_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ def apply_pass(self, sdfg: SDFG, _: Dict[Any, Any]) -> Set[str]:
integers_only = self.integers_only

to_promote = find_promotable_scalars(sdfg, transients_only=transients_only, integers_only=integers_only)
promoted = set()
if ignore:
to_promote -= ignore
if len(to_promote) == 0:
Expand All @@ -640,7 +641,7 @@ def apply_pass(self, sdfg: SDFG, _: Dict[Any, Any]) -> Set[str]:
scalar_nodes = [n for n in state.nodes() if isinstance(n, nodes.AccessNode) and n.data in to_promote]
# Step 2: Assignment tasklets
for node in scalar_nodes:
if state.in_degree(node) == 0:
if node.data in promoted or state.in_degree(node) == 0:
continue
in_edge = state.in_edges(node)[0]
input = in_edge.src
Expand Down Expand Up @@ -681,6 +682,7 @@ def apply_pass(self, sdfg: SDFG, _: Dict[Any, Any]) -> Set[str]:

# Clean up all nodes after assignment was transferred
new_state.remove_nodes_from(new_state.nodes())
promoted.add(node.data)

# Step 3: Scalar reads
remove_scalar_reads(sdfg, {k: k for k in to_promote})
Expand Down
Loading