Demote all LLVM atomic loads and stores on Metal and SPIR-V - #927
Merged
Merged
Conversation
#904 demoted Julia's `unordered` heap-reference accesses, but codegen also stores the type tag of every heap-allocated object with `release` ordering, through the generic pointer the device allocator returns. Apple's back-end cannot legalize that either: on macOS 26 the pipeline compile aborts with XPC_ERROR_CONNECTION_INTERRUPTED, and metal-tt reports "unable to legalize instruction: store release (p0)". It surfaced with Float64 emulation (#926), where DomainError(::Float64, ...) in log1p's throw path is not inlined and its allocation survives to the back-end. The same applies to SPIR-V: OpAtomicLoad/OpAtomicStore only take scalars, so a release-ordered pointer store is just as invalid there as an unordered one. Since device-side atomics go through target intrinsics rather than these instructions, every LLVM atomic load or store that reaches these back-ends is Julia GC bookkeeping, and `demote_atomics!` now strips all of them.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #927 +/- ##
==========================================
- Coverage 85.76% 85.76% -0.01%
==========================================
Files 29 29
Lines 5598 5597 -1
==========================================
- Hits 4801 4800 -1
Misses 797 797 ☔ 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.
#904 demoted Julia's
unorderedheap-reference accesses, but codegen also stores the type tag of every heap-allocated object withreleaseordering, through the generic pointer the device allocator returns. Apple's back-end cannot legalize that either: on macOS 26 the pipeline compile aborts with XPC_ERROR_CONNECTION_INTERRUPTED, and metal-tt reports "unable to legalize instruction: store release (p0)". It surfaced with Float64 emulation (#926), where DomainError(::Float64, ...) in log1p's throw path is not inlined and its allocation survives to the back-end.The same applies to SPIR-V: OpAtomicLoad/OpAtomicStore only take scalars, so a release-ordered pointer store is just as invalid there as an unordered one. Since device-side atomics go through target intrinsics rather than these instructions, every LLVM atomic load or store that reaches these back-ends is Julia GC bookkeeping, and
demote_atomics!now strips all of them.