Skip to content

Commit

Permalink
Fix missing replacement of loop variable (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad authored Jan 22, 2025
1 parent 45b00ee commit 1c2d7b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dace/sdfg/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,7 @@ def get_meta_read_memlets(self) -> List[mm.Memlet]:
"""
return []

def replace_meta_accesses(self, replacements: dict) -> None:
def replace_meta_accesses(self, replacements: Dict[str, str]) -> None:
"""
Replace accesses to specific data containers in reads or writes performed by the control flow region itself in
meta accesses, such as in condition checks for conditional blocks or in loop conditions for loops, etc.
Expand Down Expand Up @@ -3331,6 +3331,8 @@ def get_meta_read_memlets(self) -> List[mm.Memlet]:
return read_memlets

def replace_meta_accesses(self, replacements):
if self.loop_variable in replacements:
self.loop_variable = replacements[self.loop_variable]
replace_in_codeblock(self.loop_condition, replacements)
if self.init_statement:
replace_in_codeblock(self.init_statement, replacements)
Expand Down
2 changes: 2 additions & 0 deletions dace/transformation/passes/prune_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def used_symbols(self, sdfg: SDFG) -> Set[str]:
if node.code_exit.language != dtypes.Language.Python:
result |= symbolic.symbols_in_code(node.code_exit.as_string, sdfg.symbols.keys(),
node.ignored_symbols)
else:
result |= block.used_symbols(all_symbols=True, with_contents=False)

for e in sdfg.all_interstate_edges():
result |= e.data.free_symbols
Expand Down

0 comments on commit 1c2d7b5

Please sign in to comment.