Require UnsafeAtomics 0.4 and remove the Metal extension - #85
Merged
Merged
Conversation
Atomix only uses the parts of UnsafeAtomics' API that 0.4 keeps: the orderings, load, store!, cas! and modify!. The LLVM-based implementation is no longer a package extension (UnsafeAtomicsLLVM), so stop referring to it.
UnsafeAtomics 0.4 emits plain LLVM atomics, which GPUCompiler 2.12 lowers for Metal, so Atomix's generic implementation works on Metal and honors the requested ordering, unlike the extension, which always used relaxed atomics. UnsafeAtomics 0.4 requires LLVM.jl 10 and GPUCompiler 2.12, so requiring it rules out the Metal.jl releases the extension was needed for. No released Metal.jl, oneAPI.jl or OpenCL.jl supports LLVM.jl 10 yet, so test against their development branches for now.
maleadt
force-pushed
the
tb/unsafeatomics-0.4
branch
from
October 5, 2026 18:36
05d828f to
caade3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UnsafeAtomics 0.4 keeps the parts of the API that Atomix uses (the orderings,
right,load,store!,cas!andmodify!), and emits plain LLVM atomics, which GPUCompiler 2.12 lowers for Metal. This PR requires it, and removesAtomixMetalExt: on Metal, Atomix now uses its generic implementation through UnsafeAtomics, like it already did forget/set!on CUDA and oneAPI. Requiring 0.4 is what makes that safe: UnsafeAtomics 0.4 requires LLVM.jl 10 and (as a weak dependency) GPUCompiler 2.12, which rules out every Metal.jl release that can't compile the generic path. This also unblocks JuliaGPU/Metal.jl#977.Behavior change on Metal: the extension ignored the requested ordering and always used relaxed atomics, while the generic path honors it.
@atomictherefore defaults to sequentially consistent at system scope, which GPUCompiler implements with fences before MSL 4.1.Compatibility: no released Metal.jl, oneAPI.jl or OpenCL.jl supports LLVM.jl 10 yet, so their users stay on Atomix 1.2 until those packages release; released CUDA.jl (6.4.2) works. Until then, the Buildkite jobs and
test/runtests.jlinstall those three back-ends from theirmainbranches, which should be reverted once they're released. As dropping UnsafeAtomics 0.1–0.3 narrows compatibility, this bumps the version to 1.3.0.Tested on an M1, with Metal.jl
main(1.12.0-DEV), GPUCompiler 2.12.0 and UnsafeAtomics 0.4.0, without the extension: Atomix's Metal tests on Julia 1.10 and 1.12 (running the Buildkite job's commands), and the CPU test suite including Aqua on 1.12.