[Wasm RyuJIT] Set wasm's vector width to 128 bits#126375
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
Sets the WebAssembly (Wasm32) target’s Vector<T> SIMD width to a concrete 128-bit size during toolchain compilation, avoiding LayoutInt.AsInt failures (indeterminate size) when crossgen2 computes Wasm signatures and dependency analysis for Vector<T>.
Changes:
- Update
InstructionSetSupport.GetVectorTSimdVector()to returnSimdVectorLength.Vector128BitforTargetArchitecture.Wasm32(previouslyNone).
|
@dotnet/jit-contrib PTAL |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/coreclr/tools/aot/crossgen2/Program.cs:95
- The rationale here (“no Wasm client-side jit”) seems to apply to WASI targets as well. As-is,
allowOptimisticwill remain enabled by default forTargetOS.Wasi, which can reintroduce the same class of issues this change is trying to avoid. Consider extending the condition to includeTargetOS.Wasi(or basing it ontargetArchitecture == TargetArchitecture.Wasm32rather than OS).
if (targetOS is TargetOS.iOS or TargetOS.tvOS or TargetOS.iOSSimulator or TargetOS.tvOSSimulator or TargetOS.MacCatalyst or TargetOS.Browser)
{
// These platforms do not support jitted code, so we want to ensure that we don't
// need to fall back to the interpreter for any hardware-intrinsic optimizations.
// Disable optimistic instruction sets by default.
allowOptimistic = false;
|
@davidwrighton @tannergooding any thoughts on whether we should try to model Wasm features like we do ISA extensions for native targets? We have #122309 / #122311 for keeping track of a baseline feature set, and currently no plans to opt in to anything beyond that, so a more detailed modelling may be premature. |
|
The main opt-in "feature" flag I can think of is multithreading. JS Promise Integration for async is another possibility, though that seems really hairy. Years from now we might want to use wide arithmetic and half-precision float support, which are making their way slowly through the spec process but don't have implementations. |
I think it depends on how they operate, whether they are static for the lifetime of the program, and how we expect WASM output to operate in the scenario where such features are available/unavailable. |
Yes, we do want to model them as ISAs (we have no other mechanism to represent this).
They are a bit special in that you can't emit 'dynamically' feature-using code, since the whole binary is validated for supported features eagerly. So it's a bit like the VEX encoding. |
This fixes a late compilation failure in crossgen when doing dependency analysis for
Vector<T>in S.P.CoreLib:Also includes a related change Andy suggested to disable being optimistic about instruction sets, since we don't have a Wasm client-side jit.
See also #125756