diff --git a/Project.toml b/Project.toml index 53b42a582..3d6c2266b 100644 --- a/Project.toml +++ b/Project.toml @@ -31,7 +31,6 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" UnsafeAtomics = "013be700-e6cd-48c3-b4a1-df204f14c38f" -UnsafeAtomicsLLVM = "d80eeb9a-aca5-4d75-85e5-170c8b632249" [weakdeps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -60,6 +59,5 @@ Random123 = "1.6" RandomNumbers = "1.5" SpecialFunctions = "2" StaticArraysCore = "1" -UnsafeAtomics = "0.2" -UnsafeAtomicsLLVM = "0.2" +UnsafeAtomics = "0.3" julia = "1.10" diff --git a/src/AMDGPU.jl b/src/AMDGPU.jl index a82922368..d9befbfa0 100644 --- a/src/AMDGPU.jl +++ b/src/AMDGPU.jl @@ -11,7 +11,6 @@ using Printf import AcceleratedKernels as AK import UnsafeAtomics -import UnsafeAtomicsLLVM import Atomix import Atomix: @atomic, @atomicswap, @atomicreplace import Core: LLVMPtr @@ -130,14 +129,12 @@ include("random.jl") # Enable hardware FP atomics for +/- ops. const ROCIndexableRef{Indexable <: ROCDeviceArray} = Atomix.IndexableRef{Indexable} - -function Atomix.modify!(ref::ROCIndexableRef, op::OP, x, ord) where { - OP <: Union{typeof(+), typeof(-)} -} +const agent = UnsafeAtomics.Internal.LLVMSyncScope{:agent}() +function Atomix.modify!(ref::ROCIndexableRef, op::OP, x, ord) where OP <: Union{typeof(+), typeof(-)} x = Atomix.asstorable(ref, x) ptr = Atomix.pointer(ref) root = Atomix.gcroot(ref) - GC.@preserve root UnsafeAtomics.modify!(ptr, op, x, ord, Val(:agent)) + GC.@preserve root UnsafeAtomics.modify!(ptr, op, x, ord, agent) end include("ROCKernels.jl") diff --git a/src/ROCKernels.jl b/src/ROCKernels.jl index 9858ce7b9..67eb0b2ea 100644 --- a/src/ROCKernels.jl +++ b/src/ROCKernels.jl @@ -8,7 +8,6 @@ import AMDGPU.Device: @device_override import Adapt import KernelAbstractions as KA import LLVM -import UnsafeAtomicsLLVM using StaticArraysCore: MArray diff --git a/src/device/Device.jl b/src/device/Device.jl index 3f16cee23..463c9177b 100644 --- a/src/device/Device.jl +++ b/src/device/Device.jl @@ -7,7 +7,6 @@ using ..LLVM.Interop import ..Adapt import Core: LLVMPtr import ..LinearAlgebra -import UnsafeAtomicsLLVM import ..HSA import ..HIP diff --git a/src/device/runtime.jl b/src/device/runtime.jl index 4c39b8663..7f582f458 100644 --- a/src/device/runtime.jl +++ b/src/device/runtime.jl @@ -13,8 +13,8 @@ exception_flag() = kernel_state().exception_flag function err_buffer!() st = kernel_state() counter_ptr = reinterpret(LLVMPtr{Int32, AS.Global}, st.buffers_counter) - idx, _ = UnsafeAtomicsLLVM.Internal.atomic_pointermodify( - counter_ptr, +, Int32(1), Val{:acquire_release}()) + idx, _ = UnsafeAtomics.atomic_pointermodify( + counter_ptr, +, Int32(1), UnsafeAtomics.acquire_release) idx += Int32(1) idx > st.n_buffers && return reinterpret(LLVMPtr{UInt64, AS.Global}, 0) @@ -25,8 +25,8 @@ end function err_str_buffer!() st = kernel_state() counter_ptr = reinterpret(LLVMPtr{Int32, AS.Global}, st.str_buffers_counter) - idx, _ = UnsafeAtomicsLLVM.Internal.atomic_pointermodify( - counter_ptr, +, Int32(1), Val{:acquire_release}()) + idx, _ = UnsafeAtomics.atomic_pointermodify( + counter_ptr, +, Int32(1), UnsafeAtomics.acquire_release) idx += Int32(1) idx > st.n_str_buffers && return reinterpret(LLVMPtr{UInt8, AS.Global}, 0)