Repository navigation
Description
On CoreCLR wasm, the JIT always treats PackedSimd (Wasm simd128) and Vector128 as part of the required baseline (src/coreclr/jit/compiler.cpp: "Ensure required baseline ISAs are supported in JIT code, even if not passed in by the VM"), and the VM sets InstructionSet_PackedSimd unconditionally in EEJitManager::SetCpuInfo. In practice simd128 cannot be turned off.
crossgen2 and ILC still accept it as a configurable instruction set: --instruction-set:-simd128 is accepted, yet the output still contains v128 code and PackedSimd.IsSupported stays true. That suggests a configuration that doesn't exist.
As suggested in #137112 (comment), make simd128 non-optional on wasm, the way SSE2 is part of base on x86:
- Fold
PackedSimd/simd128into the wasmbaseinstruction set in the instruction-set definitions and the generated tables. - Stop accepting
simd128/packedsimdas a configurable instruction set in crossgen2 and ILC, and remove it from--help. - Update the JIT and the R2R instruction-set encoding to match. This likely needs a JIT-EE version bump.
relaxed-simd stays optional.
Trimming
Once simd128 is part of base, PackedSimd.IsSupported, Vector128.IsHardwareAccelerated and Vector.IsHardwareAccelerated are constant true on wasm, so the trimmer should fold them, as the x86/Arm substitutions embedded in CoreLib already do.
Without folding, everything reachable only from the non-SIMD fallback branches ships as both IL and R2R code. In the BCL that's small: a SIMD-heavy trimmed WASI app saved about 1.8 KB brotli. But user code can put anything behind those checks, so the cost is unbounded.
Precondition: the CoreCLR interpreter reports these as false and throws PlatformNotSupportedException for the PackedSimd intrinsics. Folding is only safe once it reports true and executes them, as Mono's interpreter does. Otherwise interpreted methods, such as generic Vector128<T> instantiations missing from the composite, would throw. That also delivers consistent IsSupported whether or not code is interpreted, and removes the roughly 100x interpreter slowdown for TensorPrimitives. Relaxed SIMD stays optional and is out of scope.
Note
This issue was generated with GitHub Copilot.
Activity
dotnet-policy-service commentedon Nov 14, 2026
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Nov 14, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
[wasm] Take wasm SIMD instruction sets from the compiler; default rel…