-
Notifications
You must be signed in to change notification settings - Fork 0
feat(simd): real WASM SIMD128 backend (fill simd_wasm.rs scalar scaffolding) #225
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
Merged
+1,256
−163
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # WebAssembly with SIMD128 — enables the native v128 SIMD backend | ||
| # (`src/simd_wasm.rs::wasm32_simd`) instead of the pure-scalar fallback. | ||
| # | ||
| # Use with: | ||
| # cargo --config .cargo/config-wasm.toml build -p ndarray --lib --target wasm32-unknown-unknown | ||
| # | ||
| # Equivalent env form: | ||
| # RUSTFLAGS='-Ctarget-feature=+simd128' cargo build -p ndarray --lib --target wasm32-unknown-unknown | ||
| # | ||
| # The `simd128` target feature is what gates the `wasm32_simd` module and the | ||
| # `simd.rs` dispatch arm that re-exports its `F32x16` / `F64x8` / `I8x16` | ||
| # types. Without it, `wasm32` falls back to the portable scalar SIMD types | ||
| # (still correct, just not vectorized). Add `+relaxed-simd` as well to light | ||
| # up the fused `f32x4_relaxed_madd` path in `mul_add`: | ||
| # | ||
| # rustflags = ["-Ctarget-feature=+simd128,+relaxed-simd"] | ||
| # | ||
| # Applies to both wasm32-unknown-unknown and wasm32-wasip1. | ||
| [target.wasm32-unknown-unknown] | ||
| rustflags = ["-Ctarget-feature=+simd128"] | ||
|
|
||
| [target.wasm32-wasip1] | ||
| rustflags = ["-Ctarget-feature=+simd128"] |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When building
wasm32with+simd128,crate::simd::I8x16is the native v128 type re-exported just above, but this line re-exportsscalar::batch_packed_i4_16, whose closure receivessimd::scalar::I8x16(src/simd_scalar.rs:1630). That makes portable callers fail only on wasm SIMD if they pass a helper takingcrate::simd::I8x16or write intoout: &mut [I8x16], and it also bypasses the new native byte-lane backend for this W1a primitive. Re-export a wasm implementation ofbatch_packed_i4_16built onwasm32_simd::I8x16, or keepI8x16scalar in this dispatch arm.Useful? React with 👍 / 👎.