Skip to content

Commit

Permalink
Merge pull request #2230 from devitocodes/msd-pass-fix
Browse files Browse the repository at this point in the history
compiler: prevent multisubdimension expressions duplicates
  • Loading branch information
mloubout authored Oct 12, 2023
2 parents 617ce82 + b3b85e5 commit 074df11
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions devito/passes/clusters/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from devito.ir import (Cluster, Interval, IntervalGroup, IterationSpace, Queue,
FetchUpdate, PrefetchUpdate, SEQUENTIAL)
from devito.symbolics import retrieve_dimensions
from devito.tools import as_tuple, timed_pass
from devito.types import Eq
from devito.types.grid import MultiSubDimension, SubDomainSet
Expand Down Expand Up @@ -106,6 +107,13 @@ def callback(self, clusters, prefix):
# The "implicit expressions" created for the MultiSubDomain
exprs, dims, sub_iterators = make_implicit_exprs(d.msd, c)

# Make sure the "implicit expressions" aren't scheduled in
# an inner loop. E.g schedule both for `t, xi, yi` and `t, d, xi, yi`
edims = set(retrieve_dimensions(exprs, deep=True))
if dim not in edims and any(d.dim in edims for d in prefix):
processed.append(c)
continue

# The IterationSpace induced by the MultiSubDomain
if dims:
intervals = [Interval(i) for i in dims]
Expand Down

0 comments on commit 074df11

Please sign in to comment.