JIT/wasm: bail R2R for calls passing 16-byte SIMD by value#129816
Merged
Conversation
Passing a Vector128 (v128) argument by value through a call is not yet correctly implemented on wasm: the argument is materialized as an i32 (by-ref) while the call signature requires v128, producing an invalid module. Mark such methods R2R-unsupported via NYI_WASM_SIMD until the SIMD call ABI is implemented. Lets System.Private.CoreLib.wasm validate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
@adamperlin PTAL Hopefully this is surgical enough and won't mess with your work. fyi @dotnet/wasm-contrib |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the WASM JIT code generator to proactively bail out of ReadyToRun (R2R) compilation when generating a call signature that includes a v128 (SIMD16) argument passed by value, using NYI_WASM_SIMD to mark the method as R2R-unsupported instead of emitting an invalid WebAssembly module.
Changes:
- Detect
WasmValueType::V128call arguments when building the wasm-level call signature inCodeGen::genCallInstruction. - Invoke
NYI_WASM_SIMD("SIMD16 call argument")to fail R2R compilation for these cases, avoiding invalid wasm validation scenarios.
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
adamperlin
approved these changes
Jun 24, 2026
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.
On wasm, building a
call_indirectsignature emitsv128for a 16-byte SIMD(
Vector128/Vector<T>) argument passed by value, but codegen materializes thatargument as an
i32(a by-ref pointer) — so the pushed value (local.getof ani32) doesn't match thev128the signature requires, and the whole module failsWebAssembly.Module()validation (call_indirect[N] expected type v128, found local.get of type i32).This blocks R2R compilation of
System.Private.CoreLib(59 SIMD methods —Vector128.Shuffle/Round,Vector<T>.Equals, theISimdVectorWhereAllBitsSethelpers, etc. — all fail identically).
Until the SIMD-by-value call ABI is implemented, mark such methods
R2R-unsupported via
NYI_WASM_SIMD(consistent with the existingSIMD16 local loadbail), so they fall back to the interpreter and the modulevalidates. With this change
System.Private.CoreLib.wasmvalidates cleanly(0 invalid functions, was 59).