Skip to content

Commit e4d5e1b

Browse files
committed
compiler: Enhance ClusterGroup instantiation
1 parent 3e28d6a commit e4d5e1b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

devito/ir/clusters/cluster.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,16 @@ class ClusterGroup(tuple):
470470

471471
def __new__(cls, clusters, ispace=None):
472472
obj = super().__new__(cls, flatten(as_tuple(clusters)))
473-
obj._ispace = ispace
473+
474+
if ispace is not None:
475+
obj._ispace = ispace
476+
else:
477+
# Best effort attempt to infer a common IterationSpace
478+
try:
479+
obj._ispace, = {c.ispace for c in obj}
480+
except ValueError:
481+
obj._ispace = None
482+
474483
return obj
475484

476485
@classmethod

0 commit comments

Comments
 (0)