-
Notifications
You must be signed in to change notification settings - Fork 87
KernelAbstractions 0.10 support #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/lib/JLArrays/src/JLArrays.jl b/lib/JLArrays/src/JLArrays.jl
index 4b238fa..3a3d1e3 100644
--- a/lib/JLArrays/src/JLArrays.jl
+++ b/lib/JLArrays/src/JLArrays.jl
@@ -57,7 +57,7 @@ Adapt.adapt_structure(to::Adaptor, r::Base.RefValue) = JlRefValue(adapt(to, r[])
Base.sizeof(x::JLDeviceArray) = Base.elsize(x) * length(x)
Base.unsafe_convert(::Type{Ptr{T}}, x::JLDeviceArray{T}) where {T} =
- convert(Ptr{T}, pointer(x.data)) + x.offset*Base.elsize(x)
+ convert(Ptr{T}, pointer(x.data)) + x.offset * Base.elsize(x)
# conversion of untyped data to a typed Array
function typed_data(x::JLDeviceArray{T}) where {T}
@@ -340,10 +340,10 @@ end
## GPUArrays interfaces
@static if !isdefined(JLArrays.KernelAbstractions, :POCL) # KA v0.9
- Adapt.adapt_storage(::Adaptor, x::JLArray{T,N}) where {T,N} =
- JLDeviceArray{T,N}(x.data[], x.offset, x.dims)
+ Adapt.adapt_storage(::Adaptor, x::JLArray{T, N}) where {T, N} =
+ JLDeviceArray{T, N}(x.data[], x.offset, x.dims)
else
- function Adapt.adapt_storage(::Adaptor, x::JLArray{T,N}) where {T,N}
+ function Adapt.adapt_storage(::Adaptor, x::JLArray{T, N}) where {T, N}
arr = typed_data(x)
Adapt.adapt_storage(POCL.KernelAdaptor([pointer(arr)]), arr)
end |
Conceptually fine, but CI doesn't look happy. CUDA.jl failure is unrelated, though. |
This is ready for final review. I added tests to KA main branch to confirm that this works for both KA 0.9 and 0.10. I don't know if that should stay, and it seems like Windows CI fails with KA 0.10. Not sure if that's my fault or not. |
I wasn't able to reproduce the Windows failure locally, so I still don't understand what's happening, but I got JuliaGPU/KernelAbstractions.jl#638 out of it so not a total waste of time. |
JLArrays support done in this way to keep lack of support for scalar indexing.
KA 0.9 support can be easily reverted if not desired
Replaces and closes #595