wasm: do not enable relaxed SIMD by default - #6020
Open
jjerphan wants to merge 3 commits into
Open
Conversation
A module compiled with -mrelaxed-simd fails to instantiate on engines that lack the relaxed-simd feature, including shipping Safari. Keep SIMD128 as the portable default and opt in with WASM_RELAXED_SIMD=1. Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Contributor
Author
|
Verified locally with Emscripten 4.0.9 ( Default Kernels compiled both ways (SGEMM/DGEMM, CGEMM/ZGEMM, SDOT/DDOT/DSDOT, SROT, DTRMM_LN), linked with those symbols exported, then
Default SGEMM WAT is |
Encode the portable-default vs WASM_RELAXED_SIMD=1 checks (compile flags, relaxed_madd opcode counts, and SIMD128 instantiate) so they can be re-run after a WASM configure. Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
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.
Summary
Makefile.wasmcurrently passes-mrelaxed-simdon every WASM object, so GEMM/DOT/ROT emitrelaxed_maddinto the final module. WebAssembly validates the whole module: engines that do not implement relaxed SIMD reject instantiate, even if those kernels are never called. Shipping Safari / JavaScriptCore is in that set (feature status).-msimd128) as the default.WASM_RELAXED_SIMD=1(Make) or-DWASM_RELAXED_SIMD=ON(CMake). Kernels already switch on__wasm_relaxed_simd__.docs/install.md.Test plan
After a WASM configure (
ARCH=wasminMakefile.conf), withemccandwasm-disonPATH:That script checks:
-msimd128and not-mrelaxed-simd.relaxed_madd, and Node can instantiate that SIMD128-only module.WASM_RELAXED_SIMD=1passes-mrelaxed-simdand those kernels emitrelaxed_madd.