Skip to content
Open
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
12 changes: 8 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ steps:
version:
- "1.10"
- "1.11"
- "1.12"
plugins:
- JuliaCI/julia#v1:
version: "{{matrix.version}}"
Expand All @@ -16,7 +17,7 @@ steps:
Pkg.develop(PackageSpec(name="Atomix", path="."))

println("+++ :julia: Running tests")
Pkg.test("Atomix", test_args=["--CUDA"])'
Pkg.test("Atomix", test_args=["--CUDA"], julia_args=["--depwarn=error"])'
agents:
queue: "juliagpu"
cuda: "*"
Expand All @@ -29,6 +30,7 @@ steps:
version:
- "1.10"
- "1.11"
- "1.12"
plugins:
- JuliaCI/julia#v1:
version: "{{matrix.version}}"
Expand All @@ -40,7 +42,7 @@ steps:
Pkg.develop(PackageSpec(name="Atomix", path="."))

println("+++ :julia: Running tests")
Pkg.test("Atomix", test_args=["--Metal"])'
Pkg.test("Atomix", test_args=["--Metal"], julia_args=["--depwarn=error"])'
agents:
queue: "juliaecosystem"
os: "macos"
Expand All @@ -54,6 +56,7 @@ steps:
version:
- "1.10"
- "1.11"
- "1.12"
plugins:
- JuliaCI/julia#v1:
version: "{{matrix.version}}"
Expand All @@ -65,7 +68,7 @@ steps:
Pkg.develop(PackageSpec(name="Atomix", path="."))

println("+++ :julia: Running tests")
Pkg.test("Atomix", test_args=["--oneAPI"])'
Pkg.test("Atomix", test_args=["--oneAPI"], julia_args=["--depwarn=error"])'
agents:
queue: "juliagpu"
intel: "*"
Expand All @@ -78,6 +81,7 @@ steps:
version:
- "1.10"
- "1.11"
- "1.12"
plugins:
- JuliaCI/julia#v1:
version: "{{matrix.version}}"
Expand All @@ -89,7 +93,7 @@ steps:
Pkg.develop(PackageSpec(name="Atomix", path="."))

println("+++ :julia: Running tests")
Pkg.test("Atomix", test_args=["--OpenCL"])'
Pkg.test("Atomix", test_args=["--OpenCL"], julia_args=["--depwarn=error"])'
agents:
queue: "juliagpu"
intel: "*"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- uses: julia-actions/cache@v2

- uses: julia-actions/julia-runtest@v1
with:
depwarn: error
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
Expand Down
6 changes: 5 additions & 1 deletion src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ end
ptr = Atomix.pointer(ref)
root = Atomix.gcroot(ref)
GC.@preserve root begin
UnsafeAtomics.modify!(ptr, op, x, ord)
if isdefined(Core.Intrinsics, :atomic_pointermodify)
Core.Intrinsics.atomic_pointermodify(ptr, op, x, base_ordering(ord))
else
UnsafeAtomics.modify!(ptr, op, x, ord)
end
Comment on lines +33 to +37

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong and likely doesn't work on non-CPU backends. We do need to fix this in UnsafeAtomics.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the fact UnsafeAtomics has not been updated for 9 years i guess the dependency should be removed.

end
end

Expand Down
6 changes: 6 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ const _JULIA_ORDERINGS =
julia_ordering in _JULIA_ORDERINGS || error("unknown ordering: ", julia_ordering)
return getfield(UnsafeAtomics, julia_ordering)
end

@inline function base_ordering(order::Ordering)
order === seq_cst && return :sequentially_consistent
order === acq_rel && return :acquire_release
return Symbol(string(order))
end
12 changes: 11 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ using Atomix: @atomic, @atomicreplace, @atomicswap
using Test


@testset "test_issue65" begin

lengths = zeros(Int, 4)
for i in eachindex(lengths)
Atomix.@atomic lengths[i] += 1
end
@test lengths == fill(1, 4)
end


@testset "Aqua.jl" begin
using Aqua
Aqua.test_all(Atomix)
Expand Down Expand Up @@ -45,7 +55,7 @@ end
mutable struct Atomic{T}
@atomic x::T
end

a = Atomic(123)
@test (@atomic a.x) == 123
@test (@atomic :monotonic a.x) == 123
Expand Down