Preserve element types when folding SIMD Dot broadcasts - #134521
Merged
tannergooding merged 1 commit intoSep 23, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
JIT and architecture-sensitive changes warrant final human review.
Review effort: Lite
Findings: None
What changed in this PR
Fixes SIMD Dot broadcast folding to preserve element-type compatibility and prevent incorrect lane reinterpretation.
Changes:
- Validates vector width and compatible SIMD element types before folding.
- Adds signed/unsigned widening, truncation, and control regressions.
| File | Summary |
|---|---|
src/tests/JIT/Regression_ro_2/Runtime_134479.cs |
Adds data-driven regression coverage. |
src/coreclr/jit/morph.cpp |
Validates SIMD element compatibility before folding. |
EgorBo
approved these changes
Sep 23, 2026
Member
Author
|
/ba-g unrelated failures |
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
Vector.Create(ToScalar(Dot(...)))fold checked the vector size but not the element type. Reusing a short-lane Dot result as an int broadcast therefore produced0x00080008(524296) instead of 8 for the reported all-one inputs.Require compatible SIMD base types as well as matching vector sizes before folding. Normalize signedness so same-width signed/unsigned broadcasts remain eligible; incompatible types retain the scalar extraction and broadcast. The check runs before rewriting the operands.
Add data-driven regressions for signed and unsigned widening at 128-bit and 64-bit widths, including truncation cases, plus same-type and signedness-only controls.
Validation on Windows x64: Checked JIT and test builds, JIT formatting, and all eight regression cases passed. The same cases passed with AVX2 disabled, hardware intrinsics disabled, and JIT stress 2. Three cases fail against the unfixed JIT. ARM64 execution was not available locally.
Resolves #134479
Note
This PR description was drafted with GitHub Copilot.