GPUArrays.jl icon indicating copy to clipboard operation
GPUArrays.jl copied to clipboard

move `backend` to `GPUArraysCore.jl`

Open N5N3 opened this issue 3 years ago • 3 comments

Second take of https://github.com/JuliaGPU/Adapt.jl/pull/50. This PR wants to move backend to GPUArraysCore.jl, which would help us to implement broadcast for StructArray on gpu. (see https://github.com/JuliaArrays/StructArrays.jl/pull/215) I hope it's also useful for other arraywrappers. (I only bump GPUArraysCore's version as we haven't registered a new GPUArrays.)

N5N3 avatar Jul 26 '22 14:07 N5N3

I'm not sure about this, backend wasn't really intended as a public API. Would something like https://github.com/JuliaGPU/Adapt.jl/pull/52 work as well, using functionality from Adapt.jl (which I assume is lightweight enough)? On the other hand, if you don't need the recursive behavior (to figure out the back-end of a nested GPUArray) maybe GPUArrays.backend is sufficient.

maleadt avatar Aug 11 '22 08:08 maleadt

@maleadt I'm assuming we don't want to export backend from GPUArrays.jl? We have @reexport using GPUArraysCore, so exporting GPUArraysCore.backend would also export backend from GPUArrays. I think we'd better revert [0137d18] as otherwise there seems no advantage to use Reexport. (@reexport dont support something like @reexport using A except backend,)

N5N3 avatar Aug 12 '22 09:08 N5N3

@maleadt I'm assuming we don't want to export backend from GPUArrays.jl? We have @reexport using GPUArraysCore, so exporting GPUArraysCore.backend would also export backend from GPUArrays.

Oh, no, we don't want that indeed, good catch.

maleadt avatar Aug 12 '22 10:08 maleadt

Why did you change the JLArrays compat here? Adding a ~ doesn't relax but tighten the requirements, right?

maleadt avatar Aug 21 '22 20:08 maleadt

Oh yes. I must misread the Pkg document.

N5N3 avatar Aug 22 '22 00:08 N5N3