Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable SIMD when compiling smoldot #903

Merged
merged 3 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Changed

- The smoldot binary now longer has SIMD enabled, in order to make it work on a greater range of hardware. It was previously assumed that SIMD instructions were emulated on hardware that doesn't natively support them, but this doesn't seem to be the case for some browser engines. ([#903](https://github.com/smol-dot/smoldot/pull/903))

## 1.0.12 - 2023-07-10

### Changed
Expand Down
6 changes: 5 additions & 1 deletion wasm-node/javascript/prepare.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ child_process.execSync(
// code. This generates a `wasm` file in `target/wasm32-wasi`.
// Some optional Wasm features are enabled during the compilation in order to speed up the
// execution of smoldot.
// SIMD is intentionally not enabled, because WASM engines seem to allow only SIMD instructions
// on specific hardware. See for example <https://bugzilla.mozilla.org/show_bug.cgi?id=1625130#c11>
// and <https://bugzilla.mozilla.org/show_bug.cgi?id=1840710>.
//
// Note that this doesn't enable these features in the Rust standard library (which comes
// precompiled), but the missing optimizations shouldn't be too much of a problem. The Rust
// standard library could be compiled with these features using the `-Z build-std` flag, but at
Expand All @@ -75,7 +79,7 @@ child_process.execSync(
child_process.execSync(
"cargo +" + rustVersion + " build --package smoldot-light-wasm --target wasm32-wasi --no-default-features " +
(buildProfile == 'debug' ? '' : ("--profile " + buildProfile)),
{ 'stdio': 'inherit', 'env': { 'RUSTFLAGS': '-C target-feature=+bulk-memory,+sign-ext,+simd128', ...process.env } }
{ 'stdio': 'inherit', 'env': { 'RUSTFLAGS': '-C target-feature=+bulk-memory,+sign-ext', ...process.env } }
);
const rustOutput = "../../target/wasm32-wasi/" + buildProfile + "/smoldot_light_wasm.wasm";

Expand Down