Broadcast question

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

The broadcast support for texture objects is a bit of a gimmick, better to put it in a kernel: CUDA.jl 1.1 ⋅ JuliaGPU

Thanks Tim.
guess I have to bite the bullet and learn Kernel programming :slight_smile: