ndarray icon indicating copy to clipboard operation
ndarray copied to clipboard

SIMD enhanced Wasm compilation

Open antimora opened this issue 2 years ago • 1 comments
trafficstars

Requesting to add SIMD support for Wasm build targets.

Burn project uses NDArray for one its backends. It is possible to build this backend for WASM target.

According to this blog post

Chrome, Firefox, and Node LTS have all stabilized the SIMD extension to Wasm in the last few months (Safari is lagging at the time of writing. See the updated roadmap for changes). Additionally, Rust has stabilized Wasm SIMD intrinsics recently too. All the pieces are set and now is the time to start authoring libraries that take advantage of the promised performance that SIMD can bring.

So it seems the browsers and compiler support SIMD and it would be great if NDArray could also be enhanced with the support.

antimora avatar Mar 19 '23 18:03 antimora

Just to add some information: ndarray does not use explicit simd anywhere. Wasm would not be the first target we would add, but if explicit simd started to being used, it should of course be in a way that's generic enough to easily add it - if it's in stable Rust it is "straight forward".

A pointer towards what a plan would look like is this: https://github.com/rust-ndarray/ndarray/issues/46#issuecomment-438458138 abstract out numerical loops into a separate module or crate

bluss avatar May 03 '23 20:05 bluss