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

Remove unneeded lock. #905

Merged
merged 2 commits into from
May 13, 2021
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
7 changes: 2 additions & 5 deletions lib/cudadrv/occupancy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@ function launch_configuration(fun::CuFunction; shmem::Union{Integer,Base.Callabl
cuOccupancyMaxPotentialBlockSize(blocks_ref, threads_ref, fun, C_NULL, shmem, max_threads)
elseif Sys.ARCH == :x86 || Sys.ARCH == :x86_64
shmem_cint = threads -> Cint(shmem(threads))
# `@cfunction` needs a lock currently, https://github.com/JuliaLang/julia/issues/38709
cb = lock(_shmem_cb_lock) do
@cfunction($shmem_cint, Cint, (Cint,))
end
cb = @cfunction($shmem_cint, Cint, (Cint,))
cuOccupancyMaxPotentialBlockSize(blocks_ref, threads_ref, fun, cb, 0, max_threads)
else
lock(_shmem_cb_lock) do
lock(_shmem_cb_lock) do
global _shmem_cb
_shmem_cb = shmem
cb = @cfunction(_shmem_cint_cb, Cint, (Cint,))
Expand Down