Skip to content

Commit

Permalink
Support passing LLVMPtrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Oct 8, 2024
1 parent 85af3af commit 190853d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/cl/kernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ function set_arg!(k::Kernel, idx::Integer, arg::SVMBuffer)
return k
end
## when passing with `clcall`, which has pre-converted the buffer
function set_arg!(k::Kernel, idx::Integer, arg::Ptr)
function set_arg!(k::Kernel, idx::Integer, arg::Union{Ptr,Core.LLVMPtr})
arg = reinterpret(Ptr{Cvoid}, arg)
if arg != C_NULL
# XXX: this assumes that the receiving argument is pointer-typed, which is not the
# case with Julia's `Ptr` ABI. Instead, one should reinterpret the pointer as a
# `Core.LLVMPtr`, which _is_ pointer-valued. We retain this handling for `Ptr`
# for users passing pointers to OpenCL C, and because `Ptr` is pointer-valued
# starting with Julia 1.12.
clSetKernelArgSVMPointer(k, cl_uint(idx-1), arg)
end
return k
Expand Down

0 comments on commit 190853d

Please sign in to comment.