google / google/highway

`hwy::DispatchedTarget` always returns HWY_EMU128 on WASM/Emscripten

Open
#2,831 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.8k
Forks
471
Avg merge
1d 6h
Merged PRs (30d)
81

Description

The reason is the highway library isn't compiled with `-msimd128`.

My project is compiled with Emscripten with `-msimd128` flag.
I'm using CMake and `FetchContent` to download source of highway, and `FetchContent` used `add_subdirectory` to integrate highway in to my build.
And the `HWY_DYNAMIC_DISPATCH` macro is doing great by selecting `HWY_WASM` target.

Current viable solution is using `include` instead of `add_subdirectory` in cmake, and add `-msimd128` flag to highway manually.

Or, I'd like to discuss:
1. Is it possible for WASM to auto detect and enable WASM SIMD by pragma like avx targets? (without manually adding compiler flags).
2. Maybe landing https://github.com/google/highway/issues/2114 is also a great idea. (I'd like to try that, but it may produce a big change list)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.