Skip to content

Experiment with basic SIMD operations #5855

@ryanking13

Description

@ryanking13

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:

  1. Using wasm_simd128.h header and use wasm simd function directly (doc)

  2. 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

Metadata

Metadata

Assignees

Labels

OSSCA2025Good first issue for OSSCA2025 participantshelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions