Open
Description
I'm not sure how to explain this behavior, it's like @localmem
cancels the effects of the kernel:
julia> using Metal, KernelAbstractions
julia> backend = Metal.MetalBackend()
MetalBackend()
julia> @kernel function settoone_localmem!(x::AbstractVector)
i = @index(Global)
n = length(x)
y = @localmem Bool (n,)
x[i] = one(eltype(x))
end
settoone_localmem! (generic function with 4 methods)
julia> @kernel function settoone_nolocalmem!(x::AbstractVector)
i = @index(Global)
x[i] = one(eltype(x))
end
settoone_nolocalmem! (generic function with 4 methods)
julia> x = KernelAbstractions.zeros(backend, Float32, 3);
julia> settoone_localmem!(backend)(x; ndrange=length(x)) # fails
julia> x
3-element MtlVector{Float32, Metal.PrivateStorage}:
0.0
0.0
0.0
julia> settoone_nolocalmem!(backend)(x; ndrange=length(x)) # works
julia> x
3-element MtlVector{Float32, Metal.PrivateStorage}:
1.0
1.0
1.0
Metadata
Metadata
Assignees
Labels
No labels