Skip to content

Remove the Metal extension - #83

Draft
maleadt wants to merge 1 commit into
mainfrom
tb/remove-metal-ext
Draft

maleadt wants to merge 1 commit into
mainfrom
tb/remove-metal-ext

Conversation

@maleadt

@maleadt maleadt commented Sep 25, 2026

Copy link
Copy Markdown
Member

Depends on JuliaGPU/Metal.jl#977, and a Metal.jl release with it (1.12).

With that PR, Metal.jl emits its atomics as plain LLVM atomics, which GPUCompiler lowers to AIR (JuliaGPU/GPUCompiler.jl#942), so Atomix's generic path through UnsafeAtomics works on Metal as-is. It honours the requested ordering on every macOS version Metal.jl supports: natively from Metal 4.1, with fences before that. The extension, which ignores orderings, is therefore removed rather than extended (superseding #79). The generic path also supports more than the extension did: 8- and 16-bit and Float16 atomics, and arbitrary operators in modify! (through a compare-exchange loop).

Versioning: Metal stays in [weakdeps], without an extension, so that its compat (bumped to 1.12) keeps older versions of Metal.jl out of an environment with this version of Atomix; Pkg keeps Atomix 1.2 for those. Metal.jl 1.12's own compat takes care of GPUCompiler and UnsafeAtomics. Conversely, Atomix 1.2 still works with Metal.jl 1.12, as the functions its extension calls remain, but orderings stay ignored there.

The Metal tests now cover orderings (adapted from #79) and check that ordered atomics reach the generated code. They pass locally (M1, macOS 27, Julia 1.12) with Metal.jl and GPUCompiler from the PRs' branches, as does Aqua. Metal CI will fail until Metal.jl 1.12 is registered, because the compat can't be satisfied yet.

From Metal.jl 1.12, Metal.jl lowers LLVM atomics to AIR
(JuliaGPU/Metal.jl#977), so Atomix's generic path through UnsafeAtomics
works on Metal as-is. Unlike the extension, which called Metal.jl's
relaxed atomic functions, it honours the requested ordering, and
supports more types and operators. Metal stays a weak dependency,
without an extension, so that its compat keeps older versions of
Metal.jl out of the environment.

The tests now cover orderings, adapted from #79.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant