ilyas-mallah opened PR #14897 from ilyas-mallah:riscv64-simd-no-v to bytecodealliance:main:
Follow-up to #13959 and #14524. Compiling a module that uses v128 for riscv64 without the V extension panics in the backend.
wasmtime compile --target riscv64gc-unknown-linux-gnuwith default flags hits it, and so does a native host without V. #14524 fixed the memcpy half of #13959, and this is the other half Alex mentioned in that issue.On such targets SIMD and relaxed SIMD are now off by default, so these modules fail validation with "SIMD support is not enabled". Turning either one on explicitly makes Engine::new fail. The check isn't in compiler_panicking_wasm_features because that runs in Config::validate, before native ISA flags are detected.
ilyas-mallah removed the review request for wasmtime-compiler-reviewers from PR #14897.
ilyas-mallah requested fitzgen for a review on PR #14897.
ilyas-mallah requested wasmtime-compiler-reviewers for a review on PR #14897.
ilyas-mallah requested wasmtime-core-reviewers for a review on PR #14897.
ilyas-mallah requested wasmtime-default-reviewers for a review on PR #14897.
github-actions[bot] added the label wasmtime:api on PR #14897.
github-actions[bot] added the label wasmtime:docs on PR #14897.
github-actions[bot] added the label wasmtime:config on PR #14897.
github-actions[bot] commented on PR #14897:
Label Messager: wasmtime:config
It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:
[ ] If you added a new
Configmethod, you wrote extensive documentation for
it.<details>
Our documentation should be of the following form:
```text
Short, simple summary sentence.More details. These details can be multiple paragraphs. There should be
information about not just the method, but its parameters and results as
well.Is this method fallible? If so, when can it return an error?
Can this method panic? If so, when does it panic?
Example
Optional example here.
```</details>
[ ] If you added a new
Configmethod, or modified an existing one, you
ensured that this configuration is exercised by the fuzz targets.<details>
For example, if you expose a new strategy for allocating the next instance
slot inside the pooling allocator, you should ensure that at least one of our
fuzz targets exercises that new strategy.Often, all that is required of you is to ensure that there is a knob for this
configuration option in [wasmtime_fuzzing::Config][fuzzing-config] (or one
of its nestedstructs).Rarely, this may require authoring a new fuzz target to specifically test this
configuration. See [our docs on fuzzing][fuzzing-docs] for more details.</details>
[ ] If you are enabling a configuration option by default, make sure that it
has been fuzzed for at least two weeks before turning it on by default.[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html
<details>
To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.
To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.</details>
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
I think this might be best to invert a little bit with the way features work:
- In
Config::compiler_panicking_wasm_featuresthecompiler.supports_wasm_simd()line will want to list the simd/relaxed-simd features as panicking if that'sfalse- Later in this function
build_compilerthis wouldn't mutate features but would double-check that if the compiler doesn't support simd that simd/relaxed-simd are both disabled.That way it'll be off-by-default for the relevant targets, and if users explicitly-opt in they'll still get an error.
ilyas-mallah updated PR #14897.
:memo: ilyas-mallah submitted PR review.
ilyas-mallah edited PR #14897:
Follow-up to #13959 and #14524. Compiling a module that uses v128 for riscv64 without the V extension panics in the backend.
wasmtime compile --target riscv64gc-unknown-linux-gnuwith default flags hits it, and so does a native host without V. #14524 fixed the memcpy half of #13959, and this is the other half Alex mentioned in that issue.On such targets SIMD and relaxed SIMD are now off by default, so these modules fail validation with "SIMD support is not enabled". Turning either one on explicitly makes Engine::new fail. Both are listed in compiler_panicking_wasm_features when the compiler can't compile v128. Native ISA flags are only detected once the compiler is built, so build_compiler runs that check again after the build.
:speech_balloon: ilyas-mallah created PR review comment:
Makes sense to route it through the same path as the other unsupported features, so I moved it into the panicking set in https://github.com/bytecodealliance/wasmtime/commit/6cb80301aa1cc5543692b1db2fcb855752189832.
The one difference is that
Config::validatecallscompiler_panicking_wasm_featuresbefore a compiler exists, so it takes acompiler_supports_simdflag instead of the compiler.validatepasses true.build_compilerrepeats the check withcompiler.supports_wasm_simd()once the ISA flags are known, andEngine::newtakes its features from that second pass.If you'd rather it take the compiler directly, an
Option<&dyn Compiler>works too, but it needs cfg gates in config.rs.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Ah I see, in that case I think the best we can do is what you had previously which is to just validate that simd/relaxed-simd aren't enabled when riscv64 without
has_vis targeted. I think the checks added to mesh this with what we currently have are unfortunately a bit too convoluted.
ilyas-mallah edited PR #14897:
Follow-up to #13959 and #14524. Compiling a module that uses v128 for riscv64 without the V extension panics in the backend.
wasmtime compile --target riscv64gc-unknown-linux-gnuwith default flags hits it, and so does a native host without V. #14524 fixed the memcpy half of #13959, and this is the other half Alex mentioned in that issue.On such targets SIMD and relaxed SIMD are now off by default, so these modules fail validation with "SIMD support is not enabled". Turning either one on explicitly makes Engine::new fail. The check isn't in compiler_panicking_wasm_features because that runs in Config::validate, before native ISA flags are detected.
:speech_balloon: alexcrichton created PR review comment:
This documentation will need to be updated -- it's not disabled by default on riscv64 but rather it's enabled-by-default and also requires-
has_v-by-default, meaning if--targetis used it must be combined withhas_vor-Wsimd=n
:speech_balloon: ilyas-mallah created PR review comment:
Agreed, the second pass was more machinery than it's worth. I reverted it in https://github.com/bytecodealliance/wasmtime/commit/c1e0c228107c43cef7cc81d9ea902ef2e7f2594c, so
build_compilererrors on an explicit simd/relaxed-simd and otherwise drops them from the default features.
:memo: ilyas-mallah submitted PR review.
ilyas-mallah updated PR #14897.
:speech_balloon: alexcrichton created PR review comment:
I don't think this
.remove(..)call is necessary? Ideally the signature of this function does not change
:memo: alexcrichton submitted PR review.
Last updated: Oct 31 2026 at 23:03 UTC