Skip to content

hwy::DispatchedTarget always returns HWY_EMU128 on WASM/Emscripten #2831

@LanderlYoung

Description

@LanderlYoung

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 Question: header only version ? #2114 is also a great idea. (I'd like to try that, but it may produce a big change list)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions