-
-
Notifications
You must be signed in to change notification settings - Fork 966
Description
Related: #3646
Context
Emscripten supports basic SIMD operations, which vectorize C/C++ code to optimize performance. Since people often complain about Pyodide's performance, enabling SIMD can help improve the performance of scientific Python packages.
Implementing WASM-compatible SIMD is a task that each downstream package maintainer must do, not Pyodide. However, if we can test that SIMD operations run properly in Pyodide, it could encourage package maintainers to implement WASM SIMD.
Task Description
Write a test package (e.g., test-simd), similar to test-cpp-exceptions, or test-buffer. This package should contain a simple C or C++ code that uses WASM SIMD functions.
Emscripten provides two ways to write SIMD operations:
-
Using
wasm_simd128.h
header and use wasm simd function directly (doc) -
Replacing existing SSE/AVX SIMD intrinsics implicitly with WASM intrinsics (doc)
I think we need to test both.
Next steps?
After we validate that simple SIMD operations work in Pyodide properly, I think we can try building either OpenBLAS or OpenCV with SIMD enabled.
OpenCV actually ran a GSoC project in 2020 that optimizes OpenCV.js with WASM simd operations, so theoretically it should be available in Pyodide as well.
OpenBlas has SIMD kernels for SSE and AVX, so it would be worth to explore if they can be complied in Pyodide