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

WebGPU support #7380

Open
birkskyum opened this issue Nov 30, 2023 · 7 comments
Open

WebGPU support #7380

birkskyum opened this issue Nov 30, 2023 · 7 comments
Labels
enhancement New feature or request web-api Something that relates to a standard Web API

Comments

@birkskyum
Copy link
Collaborator

birkskyum commented Nov 30, 2023

What is the problem this feature would solve?

Unit testing / server rendering of webgpu canvas

What is the feature you are proposing to solve the problem?

I propose for bun to use an off-the-shelf webgpu implementation (like wgpu or dawn), to provide access to a DOM / canvas Web API.

What alternatives have you considered?

The alternative would be from bun to spawn playwright/puppeteer browser, inject the code there to run it in chromium, and then try to exact it into bun and use it in the bun test.

@birkskyum birkskyum added the enhancement New feature or request label Nov 30, 2023
@Electroid Electroid added the web-api Something that relates to a standard Web API label Nov 30, 2023
@birkskyum
Copy link
Collaborator Author

WebGPU was recently added to Deno, opening up i.e. usage of GPU accelerated ML frameworks like tensorflow.js server-side. Would be cool to be able to do such things with bun as well.

@sroussey
Copy link
Contributor

There is an implementation of webgpu in webkit now.

Ref: https://webkit.org/blog/14879/webgpu-now-available-for-testing-in-safari-technology-preview/

@Jarred-Sumner
Copy link
Collaborator

We are unlikely to add WebGPU support to Bun in any official capacity until WebGPU is far more widely used. This is a great usecase for napi.

@sroussey
Copy link
Contributor

sroussey commented Dec 31, 2023

WebLLM uses wasm combined with webgpu. I’m not sure a node napi would suffice, but it might… I’ll have to see how they connect them.

Generally speaking, I think if bun had great ai primitives (or direct support for those that do) it would be a force multiplier.

@Jarred-Sumner
Copy link
Collaborator

WebGPU is not a great AI primitive, imo. It happens to work for that usecase, but it is not designed for that usecase. It would be better to support something designed for AI/LLMs, but it's unclear what that is right now

@birkskyum
Copy link
Collaborator Author

birkskyum commented Jan 4, 2024

AI aside, it would be very relevant for server side rendering of webgpu still, such as unit testing for maplibre-gl, which currently has jest tests with webgl rendering (through headless-gl)

@mourner
Copy link

mourner commented Feb 17, 2024

I'd love to see this in Bun too, at least once WebGPU ships unflagged in Webkit like it did in Chrome last year. This would be perfect for headless automated testing of 3D applications, e.g. ones that use Three.js or Babylon.js with WebGPU backend.

Examples of how this is used in Deno for reference: https://github.com/denoland/webgpu-examples/
And this is how a similar thing is set up with Puppeteer (but it's a bit involved and limited): https://developer.chrome.com/blog/supercharge-web-ai-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web-api Something that relates to a standard Web API
Projects
None yet
Development

No branches or pull requests

5 participants