Skip to content

Commit

Permalink
Fix scalar2symbol not being correctly adapted to CFRs (spcl#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad authored Jan 22, 2025
1 parent 017d58f commit f566e9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dace/transformation/passes/scalar_to_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,14 +587,20 @@ def remove_scalar_reads(sdfg: sd.SDFG, array_names: Dict[str, str]):

# Descend recursively to remove scalar
remove_scalar_reads(dst.sdfg, {e.dst_conn: tmp_symname})
for ise in dst.sdfg.edges():
for ise in dst.sdfg.all_interstate_edges():
ise.data.replace(e.dst_conn, tmp_symname)
# Remove subscript occurrences as well
for aname, aval in ise.data.assignments.items():
vast = ast.parse(aval)
vast = astutils.RemoveSubscripts({tmp_symname}).visit(vast)
ise.data.assignments[aname] = astutils.unparse(vast)
ise.data.replace(tmp_symname + '[0]', tmp_symname)
promo = TaskletPromoterDict({e.dst_conn: tmp_symname})
for reg in dst.sdfg.all_control_flow_regions():
meta_codes = reg.get_meta_codeblocks()
for cd in meta_codes:
for stmt in cd.code:
promo.visit(stmt)

# Set symbol mapping
dst.sdfg.remove_data(e.dst_conn, validate=False)
Expand Down

0 comments on commit f566e9a

Please sign in to comment.