Hello! This is probably a bit of a dumb/weird question, but hoping that maybe someone knows the answer to this.
I'm trying to precompile wasm modules to be run on other machines with slightly old(er) x86_64 CPUs (without AVX512). If I understand correctly, I _should_ be able to somehow select the one of these ISA micro-architecture versions in Cranelift with the CPU features I want:
https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/meta/src/isa/x86.rs#L384-L399
I've tried setting the target triple on the wasmtime::Config to x86_64_v3-unknown-linux-gnu
, but I just get an "Unrecognized Architecture: x86_64_v3" error from the target-lexicon
crate.
Is there another way that I can specify this directly, or is this a matter of updating the target-lexicon
create to support this?
You should be able to do this by:
.target("x86_64-unknown-linux-gnu")
- this will set the desired feature set to a baseline of sse2cranelift_flag_enable(...)
to enable various features you do want enabled (e.g. everything up sse4.2 or avx or something like that)By default wasmtime infers features from the host, but once a target is set that inference is disabled and you have to re-enable anything over the bare-minimum baseline
although packaging that all up as a target string through support in target-lexicon would still be nice to have regardless
Oh shoot. Thanks!
It wasn't working when I set the target triple to that - but I just realized that I'm 2 minor versions behind this fix was merged:
https://github.com/bytecodealliance/wasmtime/pull/7991
So I suspect that will solve my issue :)
Thanks for the help!
Last updated: Dec 23 2024 at 13:07 UTC