refactor: use wasm-runner#397
Open
sinui0 wants to merge 1 commit into
Open
Conversation
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.
Switch wasm test/bench runner to wasm-harness
Summary
Replaces the
wasmtime --wasi threadsrunner withwasm-harness, which executeswasm32-wasip1[-threads]binaries inside a JS shell (V8 / SpiderMonkey) via a bundled WASI polyfill. Enables runningcargo test/cargo benchagainst the same JS engines used in browser-targeted benches, without source changes.Changes
.cargo/config.toml[target.wasm32-wasip1]entry mirroring the threaded target'srustflags(atomics, bulk-memory, simd128, 4 GiB max memory).wasm32-wasip1andwasm32-wasip1-threadsnow userunner = "scripts/wasm-runner.sh".scripts/wasm-runner.sh(new, executable)nprocon Linux,sysctl hw.ncpuon macOS, fallback1) and exportsWASM_HARNESS_ENV_RAYON_NUM_THREADS=<cores>.wasm-harnessrewritesWASM_HARNESS_ENV_XtoXinside the guest, so rayon seesRAYON_NUM_THREADSwithout polluting the host shell.WASM_HARNESS_ENV_RAYON_NUM_THREADSis respected (user override).execswasm-harnesswith cargo-supplied args.Usage
Prerequisites:
cargo install wasm-harness, thennpm i -g jsvu && jsvuto installv8and/orsmshells (defaults to whatever's first on$PATH/~/.jsvu/bin).Notes
wasm-harnessauto-forwardsRAYON_*,CRITERION_*,RUST_*,NO_COLORfrom the host into the guest; theWASM_HARNESS_ENV_prefix is the explicit escape hatch used here.num_threads()will ignoreRAYON_NUM_THREADS— that's a per-bench concern, not a runner one.