11from itertools import groupby , product
22
33from devito .ir .clusters import Queue , cluster_pass
4- from devito .ir .support import SEPARABLE , SEQUENTIAL , Scope
4+ from devito .ir .support import SEPARABLE , Scope
55from devito .passes .clusters .utils import in_critical_region
66from 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
88from 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
@@ -132,21 +132,21 @@ def callback(self, clusters, prefix):
132132
133133 # Analyze and abort if fissioning would break a dependence
134134 scope = Scope (flatten (c .exprs for c in clusters ))
135- if any (d ._defines & dep .cause or dep .is_reduce (d ) for dep in scope .d_all_gen ()):
135+ if any (d ._defines & dep .cause or dep .is_reduce (d ) or dep .is_local
136+ for dep in scope .d_all_gen ()):
136137 return clusters
137138
138139 processed = []
139- for ( it , guards ) , g in groupby (clusters , key = lambda c : self ._key (c , prefix )):
140+ for it , g in groupby (clusters , key = lambda c : self ._key (c , prefix )):
140141 group = list (g )
141142
142143 try :
143- test0 = any (SEQUENTIAL in c .properties [ it .dim ] for c in group )
144+ test0 = any (c .properties . is_sequential ( it .dim ) for c in group )
144145 except AttributeError :
145- # `it` is None because `c`'s IterationSpace has no `d` Dimension,
146- # hence `key = (it, guards) = (None, guards)`
146+ # `it` is None because `c`'s IterationSpace has no `d` Dimension
147147 test0 = True
148148
149- if test0 or guards :
149+ if test0 :
150150 # Heuristic: no gain from fissioning if unable to ultimately
151151 # increase the number of collapsible iteration spaces, hence give up
152152 processed .extend (group )
@@ -161,14 +161,10 @@ def callback(self, clusters, prefix):
161161 def _key (self , c , prefix ):
162162 try :
163163 index = len (prefix )
164- dims = tuple (i .dim for i in prefix )
165-
166164 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 )
165+ return it
170166 except IndexError :
171- return ( None , c . guards )
167+ return None
172168
173169
174170@timed_pass ()
0 commit comments