Skip to content

Commit

Permalink
Filter symbol-mapping by used-symbols when generating nested SDFG cal…
Browse files Browse the repository at this point in the history
…ls and signatures.
  • Loading branch information
alexnick83 committed Sep 27, 2023
1 parent 3056d49 commit 1b0c074
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dace/codegen/targets/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1519,9 +1519,10 @@ def make_restrict(expr: str) -> str:
arguments += [
f'{atype} {restrict} {aname}' for (atype, aname, _), restrict in zip(memlet_references, restrict_args)
]
used_symbols = node.sdfg.used_symbols(all_symbols=False)
arguments += [
f'{node.sdfg.symbols[aname].as_arg(aname)}' for aname in sorted(node.symbol_mapping.keys())
if aname not in sdfg.constants
if aname in used_symbols and aname not in sdfg.constants
]
arguments = ', '.join(arguments)
return f'void {sdfg_label}({arguments}) {{'
Expand All @@ -1530,9 +1531,11 @@ def generate_nsdfg_call(self, sdfg, state, node, memlet_references, sdfg_label,
prepend = []
if state_struct:
prepend = ['__state']
used_symbols = node.sdfg.used_symbols(all_symbols=False)
args = ', '.join(prepend + [argval for _, _, argval in memlet_references] + [
cpp.sym2cpp(symval)
for symname, symval in sorted(node.symbol_mapping.items()) if symname not in sdfg.constants
for symname, symval in sorted(node.symbol_mapping.items())
if symname in used_symbols and symname not in sdfg.constants
])
return f'{sdfg_label}({args});'

Expand Down

0 comments on commit 1b0c074

Please sign in to comment.