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: prevent Eq dims to be lost if only implicit #2169

Merged
merged 1 commit into from
Jul 24, 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
3 changes: 2 additions & 1 deletion devito/ir/clusters/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def used_dimensions(self):
example, reduction or redundant (i.e., invariant) Dimensions won't
appear in an expression.
"""
return {i for i in self.free_symbols if i.is_Dimension}
idims = set.union(*[set(e.implicit_dims) for e in self.exprs])
return {i for i in self.free_symbols if i.is_Dimension} | idims

@cached_property
def scope(self):
Expand Down
13 changes: 13 additions & 0 deletions tests/test_dse.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ def test_contracted(self, exprs, expected, visit):
for j in trees] == expected
assert "".join(mapper.get(i.dim.name, i.dim.name) for i in iters) == visit

def test_implicit_only(self):
grid = Grid(shape=(5, 5))
time = grid.time_dim
u = TimeFunction(name="u", grid=grid, time_order=1)
idimeq = Eq(Symbol('s'), 1, implicit_dims=time)

op = Operator([Eq(u.forward, u + 1.), idimeq])
trees = retrieve_iteration_tree(op)

assert len(trees) == 2
assert_structure(op, ['t,x,y', 't'], 'txy')
assert trees[1].dimensions == [time]


class TestAliases(object):

Expand Down
Loading