I got this off CUDA.jl…/test/texture.jl (altered a bit)
Tex = @pipe rand(Float32,10) |> CuTextureArray |> CuTexture(_, interpolation=CUDA.LinearInterpolation())
Idx = rand(Float32,10) .+1 |> CuArray
out = CuArray{Float32}(undef, 10)
broadcast!(out, Idx, Ref(Tex)) do idx, tex
tex[idx...]
end
Is it possible to simplify the broadcast
block ?
In non-gpu Julia I’d just write Tex.(Ind)
Or does the kernel construction require everything to be passed through the broadcast. ?
I notice even the below small simplifications give errors.
broadcast( Idx, Ref(Tex)) do idx, tex #without specifying output variable
tex[idx...]
end
broadcast!(out, Idx, ) do idx #without passing Texture through broadcast
Tex[idx...]
end