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 missing replacement of loop variable #1890

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
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/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
Loading