Skip to content

Commit

Permalink
compiler: Switch to alternative solution
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Sep 4, 2023
1 parent 368c792 commit d36ba9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 2 additions & 8 deletions devito/ir/clusters/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,8 @@ def guard(clusters):
if cd._factor is not None:
k = d
else:
dims = pull_dims(cd.condition)
# If `cd` uses more dimensions than the ispace,
# stay under parent
if (not dims.issubset(set(c.ispace.dimensions)) and
cd.parent in dims):
k = cd.parent
else:
k = max(dims, default=d, key=lambda i: c.ispace.index(i))
dims = pull_dims(cd.condition, flag=False)
k = max(dims, default=d, key=lambda i: c.ispace.index(i))

# Pull `cd` from any expr
condition = guards.setdefault(k, [])
Expand Down
6 changes: 3 additions & 3 deletions tests/test_subdomains.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ class Dummy(SubDomainSet):

class TestSubDomain_w_condition(object):

def test_condition_w_subdomain(self):
def test_condition_w_subdomain_v0(self):

shape = (10, )
grid = Grid(shape=shape)
Expand Down Expand Up @@ -663,7 +663,7 @@ def define(self, dimensions):

assert_structure(op, ['i1x'], 'i1x')

def test_condition_w_subdomain_II(self):
def test_condition_w_subdomain_v1(self):

shape = (10, 10)
grid = Grid(shape=shape)
Expand Down Expand Up @@ -695,7 +695,7 @@ def define(self, dimensions):

assert_structure(op, ['xi1y'], 'xi1y')

def test_condition_w_subdomain_III(self):
def test_condition_w_subdomain_v2(self):

shape = (10, 10)
grid = Grid(shape=shape)
Expand Down

0 comments on commit d36ba9b

Please sign in to comment.