36
36
37
37
_ind2sub_recuse (:: Tuple{} , ind) = (ind+ 1 ,)
38
38
function _ind2sub_recurse (indslast:: NTuple{1} , ind)
39
- @inline
39
+ Base . @_inline_meta
40
40
(_lookup (ind, indslast[1 ]),)
41
41
end
42
42
43
43
function _ind2sub_recurse (inds, ind)
44
- @inline
44
+ Base . @_inline_meta
45
45
inv = inds[1 ]
46
46
indnext, f, l = _div (ind, inv)
47
47
(ind- l* indnext+ f, _ind2sub_recurse (Base. tail (inds), indnext)... )
@@ -54,7 +54,7 @@ function _div(ind, inv::SignedMultiplicativeInverse)
54
54
end
55
55
56
56
function Base. _ind2sub (inv:: FastCartesianIndices , ind)
57
- @inline
57
+ Base . @_inline_meta
58
58
_ind2sub_recurse (inv. inverses, ind- 1 )
59
59
end
60
60
@@ -151,24 +151,7 @@ Base.length(range::NDRange) = length(blocks(range))
151
151
end
152
152
153
153
Base. @propagate_inbounds function expand (ndrange:: NDRange{N} , groupidx:: Integer , idx:: Integer ) where {N}
154
- # This causes two sdiv operations, one for each Linear to CartesianIndex
155
154
return expand (ndrange, blocks (ndrange)[groupidx], workitems (ndrange)[idx])
156
-
157
- # The formulation below saves one sdiv
158
- # but leads to a different index order...
159
- # previous: julia> expand(ndrange, 1, 32*32)
160
- # CartesianIndex(32, 32)
161
- # now: julia> expand(ndrange, 1, 32*32)
162
- # CartesianIndex(1024, 1)
163
- # B = blocks(ndrange)::CartesianIndices
164
- # W = workitems(ndrange)::CartesianIndices
165
- # Ind = ntuple(Val(N)) do I
166
- # Base.@_inline_meta
167
- # b = B.indices[I]
168
- # w = W.indices[I]
169
- # length(b) * length(w)
170
- # end
171
- # CartesianIndices(Ind)[(groupidx-1)* prod(size(W)) + idx]
172
155
end
173
156
174
157
Base. @propagate_inbounds function expand (ndrange:: NDRange{N} , groupidx:: CartesianIndex{N} , idx:: Integer ) where {N}
0 commit comments