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

Support SIMD #56

Closed
dtruffaut opened this issue Sep 29, 2022 · 4 comments
Closed

Support SIMD #56

dtruffaut opened this issue Sep 29, 2022 · 4 comments
Labels
feature request Request for Workers team to add a feature

Comments

@dtruffaut
Copy link

dtruffaut commented Sep 29, 2022

SIMD instructions (https://v8.dev/features/simd) are interesting for parallel processing tasks like

  • Machine Learning (Tensorflow)
  • Image manipulation
  • ...etc.

For example, WASM VIPS (https://github.com/kleisauke/wasm-vips), used for image manipulation, requires a platform that supports SIMD.

For V8-based engines, at least version 9.1.54 is required to match the final SIMD opcodes, this corresponds to Chrome 91, Node.js 16.4.0 and Deno 1.9.0.

For Spidermonkey-based engines, the JavaScript engine used in Mozilla Firefox and whose version numbers are aligned, at least version 89 is required.

JavaScriptCore-based (e.g. Safari, Bun) engines are currently not supported.

WASM VIPS cannot currently run on Cloudflare Workers for other reasons (SharedBufferAPI)
See kleisauke/wasm-vips#2

That being said, supporting SIMD would make Cloudflare Workers a step closer to the browser's web workers.

@jasnell jasnell added the feature request Request for Workers team to add a feature label Sep 29, 2022
@anarchodin
Copy link

The V8 documentation page you referred to suggests using wasm-feature-detect to check if the WASM engine supports SIMD instructions. According to that, workerd already supports SIMD instructions, so that shouldn't be an obstacle to getting wasm-vips to work. The fact that it assumes that thread spawning (new Worker()) is available seems to be the real stumbling block.

@kentonv
Copy link
Member

kentonv commented Sep 30, 2022

AFAIK, Cloudflare Workers has supported SIMD ever since V8 turned it on by default, which was years ago.

That said, I haven't tested it personally. Do you have some reason to believe that SIMD doesn't work on Workers?

@dtruffaut
Copy link
Author

Good to know !

I did not test the support of SIMD.

I simply needed to know if it was supported or not.

As a developer, it is sometimes hard to track what feature is available or not on the platform, as Workers is not exactly Chrome nor V8.

I understand that documenting every supported feature can be complex and time consuming.

Maybe a matrix with known supported or at least known unsupported features could help to enlight developers in their design choices, before the development phase (before they engage development costs).

I close this issue.

Thanks for your reactivity !

@irvinebroque
Copy link
Collaborator

We've tested and verified that SIMD is supported and works on Workers:

https://developers.cloudflare.com/workers/platform/web-assembly/#simd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for Workers team to add a feature
Projects
None yet
Development

No branches or pull requests

5 participants