-
Notifications
You must be signed in to change notification settings - Fork 29
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 wasm32 #11
Add wasm32 #11
Conversation
FYI Glassbench does not work in webassembly for a multitude of reasons. I'm playing around with benchmark-simple, which works with WASM, but I don't know if that would be be something that should be merged. |
Thank you for your work. I will check it when I have more free time. |
cdf389b
to
1a5c1a2
Compare
Slight increase in performance by avoiding checks that values are within bounds.
a4095f0
to
3737133
Compare
I removed the simple benchmark stuff. Looks good! |
How run benchmarks? I've got many errors:
I use command: CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --wasm-features all" cargo wasi bench --bench bench_resize |
|
Thank you so much! |
Methodology:
a. Declare shuffle arrays as constants to avoid extra bounds checking instructions.
b. Use f32x4_pmin instead of f32x4_min
Issues encountered:
_mm_cvtps_epi32
convertsinf
toi32::MIN
or2_147_483_648u32
, while its wasm32 equivalent (on AVX),u32x4_trunc_sat_f32x4
, convertsinf
to u32::MAX.i32x4_trunc_sat_f32x4
convertsinf
toi32::MAX
and cannot be used. This is corrected by capping the result ofu32x4_trunc_sat_f32x4
at 2_147_483_648, but introduces an additional instruction.Test command:
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=." cargo wasi test -- --nocapture