From d36ba9b823d557ba9ae9bbccf71e7ce0ded1b9cb Mon Sep 17 00:00:00 2001 From: George Bisbas Date: Wed, 17 May 2023 16:28:09 +0100 Subject: [PATCH] compiler: Switch to alternative solution --- devito/ir/clusters/algorithms.py | 10 ++-------- tests/test_subdomains.py | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/devito/ir/clusters/algorithms.py b/devito/ir/clusters/algorithms.py index aed957265b7..f505b760412 100644 --- a/devito/ir/clusters/algorithms.py +++ b/devito/ir/clusters/algorithms.py @@ -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, []) diff --git a/tests/test_subdomains.py b/tests/test_subdomains.py index eed64123530..3b9df3ae252 100644 --- a/tests/test_subdomains.py +++ b/tests/test_subdomains.py @@ -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) @@ -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) @@ -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)