Skip to content

Commit e67f33f

Browse files
committed
compiler: Simplify fission
1 parent 85e7304 commit e67f33f

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

‎devito/passes/clusters/misc.py‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from itertools import groupby, product
22

33
from devito.ir.clusters import Queue, cluster_pass
4-
from devito.ir.support import SEPARABLE, SEQUENTIAL, Scope
4+
from devito.ir.support import SEPARABLE, Scope
55
from devito.passes.clusters.utils import in_critical_region
66
from devito.symbolics import pow_to_mul
7-
from devito.tools import Stamp, flatten, frozendict, timed_pass
7+
from devito.tools import Stamp, flatten, timed_pass
88
from devito.types import Hyperplane
99

1010
__all__ = ['Lift', 'fission', 'optimize_hyperplanes', 'optimize_pows']
@@ -123,7 +123,7 @@ def callback(self, clusters, prefix):
123123
d = prefix[-1].dim
124124

125125
# Do not waste time if definitely illegal
126-
if any(SEQUENTIAL in c.properties[d] for c in clusters):
126+
if any(c.properties.is_sequential(d) for c in clusters):
127127
return clusters
128128

129129
# Do not waste time if definitely nothing to do
@@ -136,17 +136,16 @@ def callback(self, clusters, prefix):
136136
return clusters
137137

138138
processed = []
139-
for (it, guards), g in groupby(clusters, key=lambda c: self._key(c, prefix)):
139+
for it, g in groupby(clusters, key=lambda c: self._key(c, prefix)):
140140
group = list(g)
141141

142142
try:
143-
test0 = any(SEQUENTIAL in c.properties[it.dim] for c in group)
143+
test0 = any(c.properties.is_sequential(it.dim) for c in group)
144144
except AttributeError:
145-
# `it` is None because `c`'s IterationSpace has no `d` Dimension,
146-
# hence `key = (it, guards) = (None, guards)`
145+
# `it` is None because `c`'s IterationSpace has no `d` Dimension
147146
test0 = True
148147

149-
if test0 or guards:
148+
if test0:
150149
# Heuristic: no gain from fissioning if unable to ultimately
151150
# increase the number of collapsible iteration spaces, hence give up
152151
processed.extend(group)
@@ -161,14 +160,10 @@ def callback(self, clusters, prefix):
161160
def _key(self, c, prefix):
162161
try:
163162
index = len(prefix)
164-
dims = tuple(i.dim for i in prefix)
165-
166163
it = c.ispace[index]
167-
guards = frozendict({d: v for d, v in c.guards.items() if d in dims})
168-
169-
return (it, guards)
164+
return it
170165
except IndexError:
171-
return (None, c.guards)
166+
return None
172167

173168

174169
@timed_pass()

0 commit comments

Comments
 (0)