Run ExpandAtomicModify when lowering for the JIT#3178
Draft
vchuravy wants to merge 3 commits into
Draft
Conversation
Contributor
Benchmark Results
Benchmark PlotsA plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/28082299634/artifacts/7842962472. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #3178 +/- ##
===========================================
- Coverage 70.61% 51.18% -19.44%
===========================================
Files 66 13 -53
Lines 21334 1264 -20070
===========================================
- Hits 15066 647 -14419
+ Misses 6268 617 -5651 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Julia 1.13 (JuliaLang/julia#57010) emits `@atomic` modify operations as calls to the `julia.atomicmodify.*` pseudo-intrinsic family, which must be expanded to atomicrmw/cmpxchg by the ExpandAtomicModify pass before machine code emission; there is no runtime fallback symbol. Since our legalization pipeline never ran this pass, the unexpanded calls reached the ORC JIT as unresolvable symbols and aborted the process. Mirror Julia's pipeline placement (after FinalLowerGC, before LowerPTLS) in addJuliaLegalizationPasses!. LLVM.jl does not wrap this pass yet, so define the pass-name wrapper locally. Differentiating *through* julia.atomicmodify in reverse mode still requires support for the pseudo-intrinsic in Enzyme proper, which is handled separately. Fixes #3086 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the active float atomic-modify test: Julia only emits julia.atomicmodify for integer-typed pointer-free fields; float fields still lower to an inline cmpxchg loop, whose reverse-mode differentiation is a pre-existing, unrelated limitation. Instead test an atomic counter inside a Duplicated struct, which exercises Enzyme replicating the modification on the shadow object. Requires julia.atomicmodify support in Enzyme proper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e40014a to
55809ef
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.
Julia 1.13 (JuliaLang/julia#57010) emits
@atomicmodify operations ascalls to the
julia.atomicmodify.*pseudo-intrinsic family, which mustbe expanded to atomicrmw/cmpxchg by the ExpandAtomicModify pass before
machine code emission; there is no runtime fallback symbol. Since our
legalization pipeline never ran this pass, the unexpanded calls reached
the ORC JIT as unresolvable symbols and aborted the process.
Mirror Julia's pipeline placement (after FinalLowerGC, before
LowerPTLS) in addJuliaLegalizationPasses!. LLVM.jl does not wrap this
pass yet, so define the pass-name wrapper locally.
Differentiating through julia.atomicmodify in reverse mode still
requires support for the pseudo-intrinsic in Enzyme proper, which is
handled separately.
Fixes #3086
Co-Authored-By: Claude Fable 5 noreply@anthropic.com