Skip to content

Commit

Permalink
Ignore symbol mappings to unused symbols in used_symbols and nested S…
Browse files Browse the repository at this point in the history
…DFGs
  • Loading branch information
tbennun committed Sep 25, 2023
1 parent 07b06f3 commit 7816999
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dace/sdfg/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ def from_json(json_obj, context=None):
return ret

def used_symbols(self, all_symbols: bool) -> Set[str]:
free_syms = set().union(*(map(str, pystr_to_symbolic(v).free_symbols) for v in self.location.values()))

keys_to_use = set(self.symbol_mapping.keys())

free_syms = set().union(*(map(str,
pystr_to_symbolic(v).free_symbols) for v in self.symbol_mapping.values()),
*(map(str,
Expand All @@ -589,8 +593,12 @@ def used_symbols(self, all_symbols: bool) -> Set[str]:
# Filter out unused internal symbols from symbol mapping
if not all_symbols:
internally_used_symbols = self.sdfg.used_symbols(all_symbols=False)
free_syms &= internally_used_symbols

keys_to_use &= internally_used_symbols

free_syms |= set().union(*(map(str,
pystr_to_symbolic(v).free_symbols) for k, v in self.symbol_mapping.items()
if k in keys_to_use))

return free_syms

@property
Expand Down Expand Up @@ -640,7 +648,7 @@ def validate(self, sdfg, state, references: Optional[Set[int]] = None, **context
raise NameError('Data descriptor "%s" not found in nested SDFG connectors' % dname)
if dname in connectors and desc.transient:
raise NameError('"%s" is a connector but its corresponding array is transient' % dname)

# Validate inout connectors
from dace.sdfg import utils # Avoids circular import
inout_connectors = self.in_connectors.keys() & self.out_connectors.keys()
Expand Down

0 comments on commit 7816999

Please sign in to comment.