Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around SVM issue on Intel. #253

Merged
merged 1 commit into from
Oct 8, 2024
Merged
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
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