Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Adapt = "4"
GPUArrays = "11.2.1"
GPUCompiler = "1.6"
KernelAbstractions = "0.9.2"
KernelAbstractions = "0.9.38"
LLVM = "9.1"
LinearAlgebra = "1"
OpenCL_jll = "=2024.10.24"
Expand Down
12 changes: 9 additions & 3 deletions src/OpenCLKernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ export OpenCLBackend
struct OpenCLBackend <: KA.GPU
end

KA.allocate(::OpenCLBackend, ::Type{T}, dims::Tuple) where T = CLArray{T}(undef, dims)
KA.zeros(::OpenCLBackend, ::Type{T}, dims::Tuple) where T = OpenCL.zeros(T, dims)
KA.ones(::OpenCLBackend, ::Type{T}, dims::Tuple) where T = OpenCL.ones(T, dims)
function KA.allocate(::OpenCLBackend, ::Type{T}, dims::Tuple; unified::Bool = false) where T
if unified
return CLArray{T, length(dims), cl.UnifiedSharedMemory}(undef, dims)
else
return CLArray{T}(undef, dims)
end
end

KA.supports_unified(::OpenCLBackend) = cl.usm_supported(cl.device())

KA.get_backend(::CLArray) = OpenCLBackend()
# TODO should be non-blocking
Expand Down
Loading