Closed mtfishman closed 1 month ago
oneAPI.jl does not seem to have resize!
defined.
This seems like a good idea, but will need some work, e.g., making sure all back-ends actually do implement resize!
(oneAPI and JLArrays seem to be missing), making sure there's test coverage by re-enabling the vector tests, etc.
For now it doesn't support appending with a
Tuple
of items (likeBase
allows forVector
) because it appears thatcopyto!
doesn't generally support that forAbstractGPUVector
s:
Why not convert the Tuple to an Array in the append!
implementation for the time being (and add a comment on why it's needed)?
I've addressed most comments in the latest commit:
"testsuite/vector.jl"
and deleted tests that looked outdated.append!(::AbstractGPUVector, ::Tuple)
.resize!
for JLArray
.In append!(a::AbstractGPUVector, items::Tuple)
, should the tuple items
get allocated onto the GPU that a
lives on?
I can work on oneAPI.jl
support for resize!
as best as I can but I don't have an Intel GPU available to use. Would that block this from being merged? It seems like the situation for oneAPI.jl
before and after this PR is the same, i.e. either way right now resize!
and append!
don't work for oneArray
and it seems like those could be fixed in the future (by implementing resize!(a::oneVector, length::Integer)
).
I started implementing resize!
for oneArray
in https://github.com/JuliaGPU/oneAPI.jl/pull/436.
This defines a generic version of
append!
forAbstractGPUVector
.It is similar to the definition for
Vector
inBase
: https://github.com/JuliaLang/julia/blob/6f6bb950b3e7b0a6e77bb11ffd7cc001cb87439d/base/array.jl#L1314-L1320It relies on
resize!
andcopyto!
being defined for theAbstractGPUVector
being appended to, whileBase
relies onBase._growend!
andcopyto!
. Relying onresize!
seems reasonable, most of the GPU backends, for exampleCUDA.jl
,Metal.jl
, andAMDGPU.jl
, haveresize!
implemented. (EDIT: Support forresize!
inoneAPI.jl
was added in https://github.com/JuliaGPU/oneAPI.jl/pull/436 but it still needs to be registered).For now it doesn't support appending with a
Tuple
of items (likeBase
allows forVector
) because it appears thatcopyto!
doesn't generally support that forAbstractGPUVector
s:EDIT: The current PR now supports for appending with a Tuple by collecting it into a Vector, though perhaps it should be collected onto the GPU where the vector that is being appended lives.