Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -61,7 +61,7 @@ EnzymeCore = "0.8.2"
ExprTools = "0.1"
GPUArrays = "11.2.1"
GPUCompiler = "0.24, 0.25, 0.26, 0.27, 1"
KernelAbstractions = "0.9.2"
KernelAbstractions = "0.9.32"
LLVM = "9.1"
LLVMLoopInfo = "1"
LazyArtifacts = "1"
Expand Down
22 changes: 19 additions & 3 deletions src/CUDAKernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ Adapt.adapt_storage(::KA.CPU, a::CuArray) = convert(Array, a)
## memory operations

function KA.copyto!(::CUDABackend, A, B)
A isa Array && CUDA.pin(A)
B isa Array && CUDA.pin(B)

GC.@preserve A B begin
destptr = pointer(A)
srcptr = pointer(B)
Expand All @@ -47,6 +44,25 @@ function KA.copyto!(::CUDABackend, A, B)
return A
end

function KA.pagelock!(::CUDABackend, A::Array)
CUDA.pin(A)
return nothing
end

## device operations

function KA.ndevices(::CUDABackend)
return ndevices()
end

function KA.device(::CUDABackend)
deviceid(active_state().device)+1
end

function KA.device!(::CUDABackend, id)
device!(id-1)
end

## kernel launch

function KA.mkcontext(kernel::KA.Kernel{CUDABackend}, _ndrange, iterspace)
Expand Down