LLVM21 bug workaround: getFixedValue() - #9374
Open
mcourteaux wants to merge 2 commits into
Open
Conversation
LLVM 21's LoopAccessAnalysis::getStrideFromAddRec() queries a scalable-vector access type's fixed element count without guarding against ScalableVectorType, hitting a fatal assertion (TypeSize::getFixedValue on a scalable TypeSize) inside LoopLoadEliminationPass, which the default O3 pipeline always runs regardless of Halide's own loop-opt settings. Fixed upstream in LLVM 22. Loop load elimination looks for opportunities to forward a store to a later load across loop iterations, which Halide-generated code essentially never benefits from, so skip it entirely on affected SVE targets under the buggy LLVM versions via PassInstrumentationCallbacks::registerShouldRunOptionalPassCallback rather than crash (or, in a no-asserts LLVM build, silently compute a bogus stride). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
These tests were skipped under LLVM 21 + SVE2 because they tripped a TypeSize::getFixedValue() assertion in LoopAccessAnalysis, reached via LLVM's LoopLoadEliminationPass. The previous commit skips that pass on SVE targets under LLVM < 22, which should make the underlying crash unreachable; drop the test-level skips so CI on real ARM hardware can confirm. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9374 +/- ##
==========================================
- Coverage 70.08% 69.97% -0.12%
==========================================
Files 260 260
Lines 79287 79295 +8
Branches 19327 19328 +1
==========================================
- Hits 55569 55486 -83
- Misses 17923 17927 +4
- Partials 5795 5882 +87 ☔ 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.
Test to see if Claude's analysis on a recent issue I ran into is indeed the fix for more than just my particular use case, but so many other tests which are just skipped now, due to LLVM 21 bug: llvm/llvm-project@d1500d12be60 (PR #169764)
Fixes [no tracking issue it seems]
Checklist