Skip to content

Commit

Permalink
Work around SVM issue on Intel. (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored Oct 8, 2024
1 parent 85af3af commit 9c98ecb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/cl/svm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ mutable struct SVMBuffer{T}
clSVMFree(context(), x)
end

# JuliaGPU/OpenCL.jl#252: uninitialized SVM memory doesn't work on Intel
if platform().name == "Intel(R) OpenCL Graphics"
len > 0 && enqueue_svm_fill(ptr, zero(T), len)
end

return obj
end
end
Expand All @@ -50,7 +55,7 @@ Base.sizeof(b::SVMBuffer{T}) where {T} = b.len * sizeof(T)

# copy from and to SVM buffers
function enqueue_svm_memcpy(dst::Ptr, src::Ptr, nbytes::Integer; blocking::Bool=false,
wait_for::Vector{Event}=Event[])
wait_for::Vector{Event}=Event[])
n_evts = length(wait_for)
evt_ids = isempty(wait_for) ? C_NULL : [pointer(evt) for evt in wait_for]
GC.@preserve wait_for begin
Expand Down Expand Up @@ -96,7 +101,7 @@ end

# fill a buffer with a pattern, returning an event
function enqueue_svm_fill(ptr::Ptr, pattern::T, N::Integer;
wait_for::Vector{Event}=Event[]) where {T}
wait_for::Vector{Event}=Event[]) where {T}
nbytes = N * sizeof(T)
nbytes_pattern = sizeof(T)
@assert nbytes_pattern > 0
Expand Down

0 comments on commit 9c98ecb

Please sign in to comment.