Skip to content

Commit

Permalink
Added support for interstate edges to RefineNestedAccess.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Jul 11, 2023
1 parent 5d66e93 commit ae1270e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions dace/transformation/interstate/sdfg_nesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,21 @@ def _candidates(
continue
in_candidates[e.data.data] = (e.data, nstate, set(range(len(e.data.subset))))

# TODO: Check in_candidates in interstate edges as well
# Check interstate edges for candidates
for e in nsdfg.sdfg.edges():
for m in e.data.get_read_memlets(nsdfg.sdfg.arrays):
# If more than one unique element detected, remove from candidates
if m.data in in_candidates:
memlet, ns, indices = in_candidates[m.data]
# Try to find dimensions in which there is a mismatch and remove them from list
for i, (s1, s2) in enumerate(zip(m.subset, memlet.subset)):
if s1 != s2 and i in indices:
indices.remove(i)
if len(indices) == 0:
ignore.add(m.data)
in_candidates[m.data] = (memlet, ns, indices)
continue
in_candidates[m.data] = (m, None, set(range(len(m.subset))))

# Check in/out candidates
for cand in in_candidates.keys() & out_candidates.keys():
Expand Down Expand Up @@ -986,7 +1000,7 @@ def _check_cand(candidates, outer_edges):
continue

# Check w.r.t. loops
if len(nstate.ranges) > 0:
if nstate is not None and len(nstate.ranges) > 0:
# Re-annotate loop ranges, in case someone changed them
# TODO: Move out of here!
for ns in nsdfg.sdfg.states():
Expand Down

0 comments on commit ae1270e

Please sign in to comment.