Skip to content

Remove the demotion of atomic loads and stores - #950

Open
maleadt wants to merge 1 commit into
tb/reject-reference-allocationsfrom
tb/remove-atomics-demotion
Open

maleadt wants to merge 1 commit into
tb/reject-reference-allocationsfrom
tb/remove-atomics-demotion

Conversation

@maleadt

@maleadt maleadt commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

demote_atomics! (#904, #924, #927) turned every LLVM atomic load and store into a plain one on Metal and SPIR-V because Julia's GC orderings (unordered reference loads and stores, release type-tag stores) reached back-ends that cannot express them. This also silently weakened user atomics, such as UnsafeAtomics' load/store! and Atomix' get/set! on OpenCL, oneAPI, and POCL: the vendor compiler could hoist a spin-wait's atomic load.

#940 removes dead exception objects, and #949 rejects remaining allocations of objects that contain references. The GC orderings that required this workaround therefore no longer reach the back-ends, so this PR removes the demotion.

With the whole stack, test results are unchanged (see #949). The KernelAbstractions POCL test suite has 11 UnsafeAtomics/Atomix atomics that are no longer demoted.

Reflection (code_llvm, code_native) does not validate IR, so an object with references can still reach the back-end with its GC orderings, as can other invalid IR.

@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.38%. Comparing base (89ef241) to head (78d617d).

Additional details and impacted files
@@                         Coverage Diff                         @@
##           tb/reject-reference-allocations     #950      +/-   ##
===================================================================
- Coverage                            86.39%   86.38%   -0.01%     
===================================================================
  Files                                   29       29              
  Lines                                 5805     5794      -11     
===================================================================
- Hits                                  5015     5005      -10     
+ Misses                                 790      789       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`demote_atomics!` turned every LLVM atomic load and store into a plain one on Metal and
SPIR-V to accommodate Julia's GC orderings. Dead exception objects are now removed, and
remaining allocations of objects that contain references are rejected, so those orderings
no longer reach the back-ends. The demotion therefore only weakened user atomics
(UnsafeAtomics' `load`/`store!` and Atomix' `get`/`set!`).
@maleadt
maleadt force-pushed the tb/remove-atomics-demotion branch from 78d617d to 971e6ae Compare September 28, 2026 16:52
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