Skip to content

Commit

Permalink
Merge pull request #2165 from devitocodes/fix-2163
Browse files Browse the repository at this point in the history
compiler: fix non arithmetic distances
  • Loading branch information
FabioLuporini authored Jul 21, 2023
2 parents ef7a3be + 9d80e64 commit a1da72e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions devito/passes/clusters/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,12 @@ def _pivot_min_intervals(self):

for d, v in distance:
value = v.pop()
ret[d][0] = min(ret[d][0], value)
ret[d][1] = max(ret[d][1], value)
try:
ret[d][0] = min(ret[d][0], value)
ret[d][1] = max(ret[d][1], value)
except TypeError:
ret[d][0] = min(ret[d][0], 0)
ret[d][1] = max(ret[d][1], 0)

ret = {d: Interval(d, m, M) for d, (m, M) in ret.items()}

Expand Down
10 changes: 10 additions & 0 deletions tests/test_dse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2604,6 +2604,16 @@ def test_premature_evalderiv_lowering(self):
assert len([i for i in FindSymbols().visit(op) if i.is_Array]) == 1
assert op._profiler._sections['section0'].sops == 16

def test_issue_2163(self):
grid = Grid((3, 3))
z = grid.dimensions[-1]
mapper = {z: INT(abs(z-1))}

u = TimeFunction(name="u", grid=grid)
op = Operator(Eq(u.forward, u.dy.dy.subs(mapper),
subdomain=grid.interior))
assert_structure(op, ['t,i0x,i0y'], 'ti0xi0y')


class TestIsoAcoustic(object):

Expand Down

0 comments on commit a1da72e

Please sign in to comment.