Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: DNER multiregs with SIMD12s #91674

Merged
merged 2 commits into from
Sep 11, 2023
Merged

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Sep 6, 2023

Locals with SIMD12 fields will span multiple registers when they end up as multireg returns, so these should always be DNER'd.

Fix #91214

Locals with SIMD12 fields will never match the ABI when they end up
as multireg returns, so these should always be DNER'd.

Fix dotnet#91214
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 6, 2023
@ghost ghost assigned jakobbotsch Sep 6, 2023
@ghost
Copy link

ghost commented Sep 6, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Locals with SIMD12 fields will never match the ABI when they end up as multireg returns, so these should always be DNER'd.

Fix #91214

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @EgorBo

No diffs (except large TP diffs, see #91563 (comment))

@jakobbotsch jakobbotsch requested a review from EgorBo September 7, 2023 13:24
@EgorBo
Copy link
Member

EgorBo commented Sep 7, 2023

hm... I thought that the fix is more complicated per our discussion in discord with you and @SingleAccretion :
image

that's why I closed mine that touches the same path

@jakobbotsch
Copy link
Member Author

jakobbotsch commented Sep 7, 2023

hm... I thought that the fix is more complicated per our discussion in discord with you and @SingleAccretion : image

that's why I closed mine that touches the same path

After thinking about it some more (and checking diffs) I don't think we need anything more complicated here. I believe that all cases where we call CheckMultiRegLclVar that involves SIMD12 in the source or destination is going to end up with some kind of mismatch that the backend cannot handle; this includes the call and return cases (where the return/call has it spread out over two GPR registers, and the LCL always has it in a SIMD register) and the HWI case (where it will be split or condensed in multiple SIMD registers). I do not think that CheckMultiRegLclVar is used for LCL_VAR <-> LCL_VAR compatibility checks (these should already have been DNER'd earlier, or block morphing should have rewritten them). Maybe @SingleAccretion disagrees?

It might still be nice to do the ReturnTypeDesc thing, which is more general and obviously correct logic, but it's also a much larger refactoring so probably not something we'd want to do for 8.0.

@SingleAccretion
Copy link
Contributor

SingleAccretion commented Sep 7, 2023

Maybe @SingleAccretion disagrees?

The change looks good to me. Though I it would be nice to "formally prove" mismatches can only arise from SIMD12 on local side, I agree it is convincing that it is indeed the case.

LCL_VAR <-> LCL_VAR

One will never see this for multi-reg locals, due to (as you said) block morphing.

@jakobbotsch
Copy link
Member Author

Failures are #91705 and #91723

@jakobbotsch jakobbotsch merged commit da4e544 into dotnet:main Sep 11, 2023
@jakobbotsch
Copy link
Member Author

/backport to release/8.0

@github-actions
Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6145265483

@github-actions
Copy link
Contributor

@jakobbotsch backporting to release/8.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: JIT: DNER multiregs with SIMD12s
Using index info to reconstruct a base tree...
M	src/coreclr/jit/lower.cpp
A	src/tests/JIT/Regression/JitBlue/Runtime_91174/Runtime_91174.cs
A	src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.cs
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.cs deleted in HEAD and modified in JIT: DNER multiregs with SIMD12s. Version JIT: DNER multiregs with SIMD12s of src/tests/JIT/Regression/JitBlue/Runtime_91335/Runtime_91335.cs left in tree.
CONFLICT (modify/delete): src/tests/JIT/Regression/JitBlue/Runtime_91174/Runtime_91174.cs deleted in HEAD and modified in JIT: DNER multiregs with SIMD12s. Version JIT: DNER multiregs with SIMD12s of src/tests/JIT/Regression/JitBlue/Runtime_91174/Runtime_91174.cs left in tree.
Auto-merging src/coreclr/jit/lower.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 JIT: DNER multiregs with SIMD12s
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

@jakobbotsch an error occurred while backporting to release/8.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@jakobbotsch jakobbotsch deleted the fix-91214 branch September 11, 2023 11:47
@ghost ghost locked as resolved and limited conversation to collaborators Oct 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failed 'isValidVectorElemsizeFloat(size)' during 'Generate code'
3 participants