From 2c827e941f792f86690569379b06e348dd39e0c0 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Tue, 8 Oct 2024 13:06:38 +0200 Subject: [PATCH] Work around SVM issue on Intel. --- lib/cl/svm.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/cl/svm.jl b/lib/cl/svm.jl index 1634a108..853cf07e 100644 --- a/lib/cl/svm.jl +++ b/lib/cl/svm.jl @@ -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 @@ -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 @@ -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