[Metal] demote unordered atomic loads and stores - #904
Open
simeonschaub wants to merge 1 commit into
Open
Conversation
This was referenced Aug 21, 2026
Member
|
This seems to have fixed things locally |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #904 +/- ##
==========================================
+ Coverage 84.00% 84.25% +0.25%
==========================================
Files 28 28
Lines 5382 5393 +11
==========================================
+ Hits 4521 4544 +23
+ Misses 861 849 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Julia marks heap-reference accesses unordered so raced pointer reads cannot invent values. With compilesig_invokes=false, Bool(::Real) now compiles its noinline InexactError constructor, whose argument tuple contains such a store on Julia 1.12+. AIR rejects LLVM atomic load/store instructions. GPUCompiler has no device GC, and Metal atomics already use air.atomic.* intrinsics, so demote unordered accesses after optimization while preserving stronger orderings.
maleadt
force-pushed
the
sds/metal_unordered_atomics
branch
from
August 22, 2026 06:16
e096836 to
e364a82
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.
The AGX back-end crashes on these with
XPC_ERROR_CONNECTION_INTERRUPTED, because AIR has no LLVM-level atomic load/store instructions.The
compilesig_invokes=falsechange in #899 only surfaced this issue, sinceBool(::Real)throws anInexactError(:Bool, Bool, x)through its vararg@nospecializeconstructor, which previously was a dead dynamic call thatlower_throw!just deleted. It's now a realnoinlinecall whose body allocates theTuple{DataType,Int64}with an unordered pointer store, breakingMtlArray{Bool}(undef, 2) .= 1on 1.12+.Since there is no GC on GPUs, this should be legal, but please correct me otherwise
@christiangnrd Can you confirm whether this fixes the Metal issues?