Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
9 changes: 3 additions & 6 deletions src/AMDGPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import AcceleratedKernels as AK
import UnsafeAtomics
import UnsafeAtomicsLLVM
import Atomix
import Atomix: @atomic, @atomicswap, @atomicreplace
import Core: LLVMPtr
Expand Down Expand Up @@ -130,14 +129,12 @@

# 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(-)}

Check warning on line 133 in src/AMDGPU.jl

View check run for this annotation

Codecov / codecov/patch

src/AMDGPU.jl#L133

Added line #L133 was not covered by tests
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)

Check warning on line 137 in src/AMDGPU.jl

View check run for this annotation

Codecov / codecov/patch

src/AMDGPU.jl#L137

Added line #L137 was not covered by tests
end

include("ROCKernels.jl")
Expand Down
1 change: 0 additions & 1 deletion src/ROCKernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import AMDGPU.Device: @device_override
import Adapt
import KernelAbstractions as KA
import LLVM
import UnsafeAtomicsLLVM

using StaticArraysCore: MArray

Expand Down
1 change: 0 additions & 1 deletion src/device/Device.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ using ..LLVM.Interop
import ..Adapt
import Core: LLVMPtr
import ..LinearAlgebra
import UnsafeAtomicsLLVM

import ..HSA
import ..HIP
Expand Down
8 changes: 4 additions & 4 deletions src/device/runtime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down