File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,19 +148,33 @@ def linear_indices(iet, **kwargs):
148148 dtype = np .int64
149149
150150 tracker = Tracker ('basic' , dtype , kwargs ['sregistry' ])
151- candidates = {
152- i .name for i in FindSymbols ('indexeds' ).visit (iet )
151+
152+ indexeds = [
153+ i for i in FindSymbols ('indexeds' ).visit (iet )
153154 if not isinstance (i .function , LocalType )
154- }
155+ ]
156+ candidates = {i .function .name for i in indexeds }
155157 key = lambda f : f .name in candidates
158+
156159 iet = linearize_accesses (iet , key0 = key , tracker = tracker )
157160
158- findexeds = [i for i in FindSymbols ('indexeds' ).visit (iet ) if isinstance (i , FIndexed )]
159- mapper_findexeds = {i : i .linear_index for i in findexeds }
161+ indexeds = [
162+ i for i in FindSymbols ('indexeds' ).visit (iet )
163+ if i .function .name in candidates
164+ ]
165+ mapper_findexeds = {i : linear_index (i ) for i in indexeds }
160166
161167 return Uxreplace (mapper_findexeds ).visit (iet ), {}
162168
163169
170+ def linear_index (i ):
171+ if isinstance (i , FIndexed ):
172+ return i .linear_index
173+ # 1D case
174+ assert len (i .indices ) == 1
175+ return i .indices [0 ]
176+
177+
164178@iet_pass
165179def rebuild_child_user_struct (iet , mapper , ** kwargs ):
166180 """
You can’t perform that action at this time.
0 commit comments