Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails for wasm32-wasi target: _Float16 is not supported on this target #1187

Open
UnitedMarsupials opened this issue May 30, 2024 · 3 comments

Comments

@UnitedMarsupials
Copy link

Hello. As you may know, Mozilla bundles an older version of simde with their sources, and it works. I'm trying to use the latest version (0.8.2) installed by the FreeBSD port on my machine.

Unfortunately, compiling for the wasm32-wasi fails:

clang++18 --target=wasm32-wasi --sysroot=/opt/share/wasi-sysroot -o sse_optimized.wasm -c -I/n/home/ports/www/firefox/work/firefox-126.0.2/media/libsoundtouch/src -I/n/home/ports/www/firefox/work/.build/media/libsoundtouch/src -I/n/home/ports/www/firefox/work/.build/security/rlbox -I/n/home/ports/www/firefox/work/.build/dist/include -I/opt/include/nspr -I/opt/include -I/opt/include/nss -I/opt/include/nspr -I/n/home/ports/www/firefox/work/.build/dist/include/nss -I/opt/include -I/opt/include/libpng16 -I/opt/include/pixman-1 -Os -fno-exceptions -fno-strict-aliasing -DNDEBUG=1 -DTRIMMED=1 -DMOZ_IN_WASM_SANDBOX -DMOZ_SAMPLE_TYPE_FLOAT32=1 -DSOUNDTOUCH_ALLOW_SSE=1 -DSOUNDTOUCH_WASM_SIMD=1 -DSIMDE_ENABLE_NATIVE_ALIASES=1 -DBUILDING_SOUNDTOUCH=1 -DST_NO_EXCEPTION_HANDLING=1 -msimd128 -I/n/home/ports/www/firefox/work/.build/dist/stl_wrappers -MD -MP -MF .deps/sse_optimized.wasm.pp   /n/home/ports/www/firefox/work/firefox-126.0.2/media/libsoundtouch/src/sse_optimized.cpp
In file included from /n/home/ports/www/firefox/work/firefox-126.0.2/media/libsoundtouch/src/sse_optimized.cpp:65:
In file included from /opt/include/simde/x86/avx2.h:33:
In file included from /opt/include/simde/x86/avx.h:28:
In file included from /opt/include/simde/x86/sse.h:34:
/opt/include/simde/x86/../simde-f16.h:98:11: error: _Float16 is not supported on this target
   98 |   typedef _Float16 simde_float16;
      |           ^
1 error generated.

Is this a bug? Perhaps, I can set the SIMDE_FLOAT16_API to something as a work-around?

@mr-c
Copy link
Collaborator

mr-c commented May 30, 2024

Hello @UnitedMarsupials and thank you for opening this issue.

Yes, you can #define SIMDE_FLOAT16_API 1 before importing any SIMDe header to work around this. Or as a compiler command line option -DSIMDE_FLOAT16_API=1.

What flags are set by the wasm32-wasi target? It would be good to add a fix near

#elif !defined(__EMSCRIPTEN__) && !(defined(__clang__) && defined(SIMDE_ARCH_POWER)) && \

@UnitedMarsupials
Copy link
Author

Yes, you can #define SIMDE_FLOAT16_API 1

Thanks! Let me try that.

What flags are set by the wasm32-wasi target?

Using the trick from here, I conclude, that, in case of clang, at least, these are:

#define __wasi__ 1
#define __wasm 1
#define __wasm32 1
#define __wasm32__ 1
#define __wasm__ 1
#define __wasm_mutable_globals__ 1
#define __wasm_sign_ext__ 1

@mr-c
Copy link
Collaborator

mr-c commented Jun 24, 2024

Yes, you can #define SIMDE_FLOAT16_API 1

Thanks! Let me try that.

Did that work?

How can we test SIMDE with WASI in our CI? We can make a PR to not use the _Float16 if __wasi__ is defined, but I'll want a CI build & run of the tests under WASI to confirm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants