[release/9.0] Add Non-Faulting behaviour for Sve.LoadVector*NonFaulting*() #106768
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.
Backport of #106648 to release/9.0
/cc @amanasifkhalid @SwapnilGaikwad
Customer Impact
The ARM SVE instruction set has a special SIMD register called the first-faulting register (FFR), where if a vectorized load operation causes a page fault, the lanes in the FFR corresponding to the offending loads are zeroed. For SVE intrinsics with first-faulting semantics, if a load faults, the remaining load operations are skipped, and the corresponding FFR lanes are zeroed. For SVE intrinsics with non-faulting semantics, execution continues in spite of any faults, but the FFR is updated accordingly.
Because these intrinsics implicitly modify the FFR, the JIT has to be judicious in modelling the state of this register. When we initially implemented the first-faulting APIs shipping in .NET 9, we added special cases in lowering and LSRA to track the FFR effects of these intrinsics. However, we did not initially replicate this handling when we added the non-faulting variants of these APIs. This PR fixes that, and also updates our existing non-faulting test suite to verify the FFR is being tracked correctly.
Regression
This PR fixes scenarios specific to SVE, which is newly supported in .NET 9.
Testing
Our existing
Sve.LoadVectorNonFaulting*test suite has been updated to check the FFR's state for correctness.Risk
Low. This fix pertains to SVE support, which is experimental in .NET 9.