-
Notifications
You must be signed in to change notification settings - Fork 357
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
add an implementation using Wasm SIMD #187
Comments
Looks like the current easiest way to run benchmarks is:
(Though that wildcard doesn't do what I want when I build multiple versions of the bench binary. I need something simpler...) At the moment, this requires getting rid of the line where we use diff --git a/Cargo.toml b/Cargo.toml
index a43f000..eadf73c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -89,7 +89,6 @@ crypto-mac = { version = "0.11.0", optional = true }
[dev-dependencies]
hex = "0.4.2"
-page_size = "0.4.1"
rand = "0.8.0"
rand_chacha = "0.3.0"
reference_impl = { path = "./reference_impl" }
diff --git a/benches/bench.rs b/benches/bench.rs
index 5efb9e6..c53278e 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -25,7 +25,7 @@ pub struct RandomInput {
impl RandomInput {
pub fn new(b: &mut Bencher, len: usize) -> Self {
b.bytes += len as u64;
- let page_size: usize = page_size::get();
+ let page_size: usize = 65536;
let mut buf = vec![0u8; len + page_size];
let mut rng = rand::thread_rng();
rng.fill_bytes(&mut buf); But once Elzair/page_size_rs#3 lands upstream this workaround shouldn't be necessary anymore. |
This code is based on rust_sse2.rs of the same distribution, and is subject to further improvements. Some comments are left intact even if their applicability is questioned. Performance measurements with a primitive benchmark with ~16Kb of data: | M1 native | 11,610 ns | | M1 WASM SIMD | 13,355 ns | | M1 WASM | 22,037 ns | | x64 native | 6,713 ns | | x64 WASM SIMD | 11,985 ns | | x64 WASM | 25,978 ns | wasmtime v12.0.1 was used on both platforms. Closes BLAKE3-team#187.
This code is based on rust_sse2.rs of the same distribution, and is subject to further improvements. Some comments are left intact even if their applicability is questioned. SIMD implementation is gated by `wasm32-simd` feature, portable version is used otherwise. Performance measurements with a primitive benchmark with ~16Kb of data: | M1 native | 11,610 ns | | M1 WASM SIMD | 13,355 ns | | M1 WASM | 22,037 ns | | x64 native | 6,713 ns | | x64 WASM SIMD | 11,985 ns | | x64 WASM | 25,978 ns | wasmtime v12.0.1 was used on both platforms. Closes BLAKE3-team#187.
This code is based on rust_sse2.rs of the same distribution, and is subject to further improvements. Some comments are left intact even if their applicability is questioned. SIMD implementation is gated by `wasm32-simd` feature, portable version is used otherwise. Performance measurements with a primitive benchmark with ~16Kb of data: | M1 native | 11,610 ns | | M1 WASM SIMD | 13,355 ns | | M1 WASM | 22,037 ns | | x64 native | 6,713 ns | | x64 WASM SIMD | 11,985 ns | | x64 WASM | 25,978 ns | wasmtime v12.0.1 was used on both platforms. Closes BLAKE3-team#187.
Hi, @oconnor663! Is there anything you would like me to improve in this PR? |
Apologies, I've been distracted by other things. I'll make a calendar note to come back to this PR this weekend. |
Rust just shipped version 1.54, which stabilizes Wasm SIMD intrinsics. We should port the SSE4.1 implementation to use these. First I should add Wasm to CI and make sure benchmarks work there.
The text was updated successfully, but these errors were encountered: