Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: fix non arithmetic distances #2165

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, why can we now end up here with SymPy?

Copy link
Contributor

@FabioLuporini FabioLuporini Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean SymPy 1.12 and not SymPy 1.11 for example

Copy link
Contributor Author

@mloubout mloubout Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow previous versions end up with {0, expr} asv and therefore 0 as value but with sympy 1.12 you only get {expr} which breaks mon/max. Didn't look too deep into why though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there might be a deeper issue then; are we now generating the same exact code for the MFE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are we test all sympy version 1.9-1.12 that pass the same test

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
Loading