JuliaGPU / GPUArrays.jl

Reusable array functionality for Julia's various GPU backends.
MIT License
321 stars 79 forks source link

Allow broadcast errors to surface later. #491

Closed maleadt closed 1 year ago

maleadt commented 1 year ago

We are currently checking for isconcretetype, which is too limiting, as e.g. CUDA.jl supports isbits-union arrays. Checking for allocatedinline would be better, but let's just do away with the check entirely and have the array constructor fail in the presence of unsupported element types. This is better anyway, as some back-ends may not support isbits-unions.

We do however still check for Union{}, as that isn't allocated inline so would fail array construction. By using Nothing there instead, we give the GPU kernel (which is expected to throw an error) the chance to execute and report an exeception dynamically. This also makes it possible to trace a broadcast invocation under, e.g., Cthulhu.

RainerHeintzmann commented 1 year ago

Strange. This was merged into master, but I still get the same error: ERROR: GPU broadcast resulted in non-concrete element type Union{Missing, Float64}. This probably means that the function you are broadcasting contains an error or type instability.

maleadt commented 1 year ago

Then you're not using GPUArrays#master. Check st -m in the Pkg REPL.

RainerHeintzmann commented 1 year ago

... I see. The dependence of CUDA.jl has not yet changed. If I download and install GPUArrays.jl it works.

maleadt commented 1 year ago

Yeah, that's normal. You don't automatically get commits from master branches until a version has been released, or unless you specifically request those changes. Would you expect otherwise?

RainerHeintzmann commented 1 year ago

;-) No. But then I did not really notice that this change was not a change to the master of CUDA.jl repo when I posted my first comment.