Skip to content

Commit

Permalink
Disable SIMD when compiling smoldot (#903)
Browse files Browse the repository at this point in the history
* Disable SIMD when compiling smoldot

* PR link

* Comment tweak
  • Loading branch information
tomaka authored Jul 13, 2023
1 parent e515bf1 commit f191335
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit f191335

Please sign in to comment.