3636
3737_ind2sub_recuse (:: Tuple{} , ind) = (ind+ 1 ,)
3838function _ind2sub_recurse (indslast:: NTuple{1} , ind)
39- @inline
39+ Base . @_inline_meta
4040 (_lookup (ind, indslast[1 ]),)
4141end
4242
4343function _ind2sub_recurse (inds, ind)
44- @inline
44+ Base . @_inline_meta
4545 inv = inds[1 ]
4646 indnext, f, l = _div (ind, inv)
4747 (ind- l* indnext+ f, _ind2sub_recurse (Base. tail (inds), indnext)... )
@@ -54,7 +54,7 @@ function _div(ind, inv::SignedMultiplicativeInverse)
5454end
5555
5656function Base. _ind2sub (inv:: FastCartesianIndices , ind)
57- @inline
57+ Base . @_inline_meta
5858 _ind2sub_recurse (inv. inverses, ind- 1 )
5959end
6060
@@ -151,24 +151,7 @@ Base.length(range::NDRange) = length(blocks(range))
151151end
152152
153153Base. @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
155154 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]
172155end
173156
174157Base. @propagate_inbounds function expand (ndrange:: NDRange{N} , groupidx:: CartesianIndex{N} , idx:: Integer ) where {N}
0 commit comments