Skip to content

Is _Float16 supported by Emscripten? #23943

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

Open
vittorioromeo opened this issue Mar 17, 2025 · 2 comments
Open

Is _Float16 supported by Emscripten? #23943

vittorioromeo opened this issue Mar 17, 2025 · 2 comments

Comments

@vittorioromeo
Copy link

I tried to compile code from my simulation that uses _Float16 under the latest version of Emscripten, but I got this compiler error:

Particles.cpp:495:9: error: _Float16 is not supported on this target
  495 |         _Float16 f16test = 100.f16;
      |         ^
Particles.cpp:495:31: error: invalid suffix 'f16' on floating constant
  495 |         _Float16 f16test = 100.f16;
      |                                ^

I can compile the same code under Windows x64 and Linux x64 with both GCC and Clang. Is _Float16 not supported at all by Emscripten, or is there a flag to enable support? (hardware support, ideally)

Thanks!

@hoodmane
Copy link
Collaborator

WebAssembly has no float16 type but there is some discussion about it:

WebAssembly/design#1497
https://github.com/tc39/proposal-float16array

It seems unlikely that Emscripten will do anything to support this before webassembly adds native support for float16.

@brendandahl
Copy link
Collaborator

There's a proposal for simd instructions for fp16 (no scalar support). There's experimental support for this in LLVM/emscripten (flag -mfp16) and V8 (flag --experimental-wasm-fp16). _Float16 is not supported, but __fp16 is.

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

3 participants