Skip to content

Commit

Permalink
compiler: prevent Eq dims to be lost if only implicit
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jul 24, 2023
1 parent 0adb92e commit 321c6dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions devito/ir/equations/equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def ispace(self):
def dimensions(self):
return set(self.ispace.dimensions)

@cached_property
def free_symbols(self):
return super().free_symbols | set(self.implicit_dims)

@property
def implicit_dims(self):
return self._implicit_dims
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

0 comments on commit 321c6dd

Please sign in to comment.