diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 1c8a141..3d1eb75 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,6 +5,7 @@ steps: version: - "1.10" - "1.11" + - "1.12" plugins: - JuliaCI/julia#v1: version: "{{matrix.version}}" @@ -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: "*" @@ -29,6 +30,7 @@ steps: version: - "1.10" - "1.11" + - "1.12" plugins: - JuliaCI/julia#v1: version: "{{matrix.version}}" @@ -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" @@ -54,6 +56,7 @@ steps: version: - "1.10" - "1.11" + - "1.12" plugins: - JuliaCI/julia#v1: version: "{{matrix.version}}" @@ -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: "*" @@ -78,6 +81,7 @@ steps: version: - "1.10" - "1.11" + - "1.12" plugins: - JuliaCI/julia#v1: version: "{{matrix.version}}" @@ -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: "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0806cff..b485754 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/src/core.jl b/src/core.jl index 3e1c809..d99f76c 100644 --- a/src/core.jl +++ b/src/core.jl @@ -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 end end diff --git a/src/utils.jl b/src/utils.jl index 98a5d81..d7e7173 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 80f8d1f..3aeef42 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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) @@ -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