Conversation
The macOS 27 AGX compiler aborts on bare LLVM fences emitted by Julia's atomic_fence intrinsic (JuliaGPU/Metal.jl#968). Lower them during AIR code generation to the intrinsic used by MSL's atomic_thread_fence. Cover device and threadgroup memory, using thread scope for singlethread and device scope otherwise. Preserve orderings on Metal 4.1 and strengthen them to seq_cst on Metal 3.2-4.0. Older targets retain bare fences because the intrinsic is unavailable, and still require a back-end that accepts them. Read the fence ordering from the instruction's textual form: before LLVM 18, LLVMGetOrdering casts a fence to an RMW instruction and returns garbage, which lowered every ordering as seq_cst on Julia 1.10 and 1.11. Use the textual path on all versions so newer CI also tests the workaround. Test all fence orderings with system, singlethread and custom scopes, including escaped scope names and trailing debug/annotation metadata, both version boundaries, existing declarations, and Julia-to-AIR lowering.
Under coverage, current Julia nightlies keep an inlined-at debug comment naming `GPUCompiler.alloca`, which the bare `@check_not "alloca"` matched. Check for the instruction instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #932 +/- ##
==========================================
+ Coverage 85.78% 85.85% +0.06%
==========================================
Files 29 29
Lines 5613 5654 +41
==========================================
+ Hits 4815 4854 +39
- Misses 798 800 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 macOS 27 AGX compiler aborts on bare LLVM fences emitted by Julia's atomic_fence intrinsic (JuliaGPU/Metal.jl#968). Lower them during AIR code generation to the intrinsic used by MSL's atomic_thread_fence.
Cover device and threadgroup memory, using thread scope for singlethread and device scope otherwise. Preserve orderings on Metal 4.1 and strengthen them to seq_cst on Metal 3.2-4.0. Older targets retain bare fences because the intrinsic is unavailable, and still require a back-end that accepts them.
Test all fence orderings with system, singlethread and custom scopes, both version boundaries, existing declarations, and Julia-to-AIR lowering.