From 6cc3a5a2d40bbf93eeafc95087e95ebd85bdaa85 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 f895daced1..56bc8771c8 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 31dcdcf069..e11807755c 100644
--- a/tests/test_subdomains.py
+++ b/tests/test_subdomains.py
@@ -633,7 +633,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)
@@ -664,7 +664,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)
@@ -696,7 +696,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)