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

Expose WebGPU? #42896

Closed
targos opened this issue Apr 28, 2022 · 16 comments
Closed

Expose WebGPU? #42896

targos opened this issue Apr 28, 2022 · 16 comments
Labels
feature request Issues that request new features to be added to Node.js. stale

Comments

@targos
Copy link
Member

targos commented Apr 28, 2022

What is the problem this feature will solve?

WebGPU is a new web platform feature that allows to use graphics hardware power from JavaScript. With it, you can write algorithms in a shading language and take advantage of the high parallelism of GPUs to make fast computations.
The WebGPU API is being implemented by Chrome, Firefox and Safari.

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

I'm proposing that we work towards making the API available in standard installations under navigator.gpu, like in browsers.

Chrome's implementation is being developed as a standalone C++ library called Dawn.
They also have written Node.js bindings for it.
/cc @Kangz @ben-clayton What do you think about this?

What alternatives have you considered?

Let it be in userland.

@targos targos added the feature request Issues that request new features to be added to Node.js. label Apr 28, 2022
@Kangz
Copy link

Kangz commented Apr 28, 2022

Whoever wants to use WebGPU in node should just use dawn.node and not bother reimplementing things. We use it for internal testing against the WebGPU CTS so it basically feature complete except for some device creation logic and swapchains. I don't know that it should be bundled in standard node installations: it's not going to work everywhere because you need a GPU or Swiftshader to make WebGPU run.

@targos targos changed the title Implement WebGPU? Expose WebGPU? Apr 28, 2022
@targos
Copy link
Member Author

targos commented Apr 28, 2022

I renamed the issue to "Expose WebGPU" because I'm really not suggesting we reimplement everything.
What I'd like to know is whether other people think it's a good idea to try and include dawn/dawn.node in standard Node.js installations (even if it may end up being available on incompatible systems).
BTW, I would be interested in trying dawn.node separately, but I haven't found any public build of it.

@bnoordhuis
Copy link
Member

Deno supports WebGPU and ML people seem to love it.

An alternative to Dawn is wgpu / wgpu-native. In Rust, yes, but with broader community support and used outside Chrome/Chromium.

@mscdex
Copy link
Contributor

mscdex commented Apr 28, 2022

I think we should leave this to userland.

@Kangz
Copy link

Kangz commented Apr 28, 2022

As long as there is a package that's easy to add for developers, it seems that userland would be fine, no?

@targos
Copy link
Member Author

targos commented Apr 29, 2022

As long as there is a package that's easy to add for developers, it seems that userland would be fine, no?

Maybe, at least as a first step. Does such a package exist?

@Kangz
Copy link

Kangz commented Apr 29, 2022

It doesn't exist yet, mostly because the Dawn contributors don't have experience on how to do it (and because it only recently reached good enough quality). I'll volunteer @DeltaEvo to figure out how to setup dawn.node to be published. The difficult is to do it on multi OSes since the binary is OS depend.

@bnoordhuis
Copy link
Member

There's already a Dawn binding but it's pretty buggy and doesn't look actively maintained (last update 2 years ago.)

@Kangz
Copy link

Kangz commented May 2, 2022

@maierfelix would you be interested in transitioning the webgpu package to be based on dawn.node? Let's chat on Matrix.

@github-actions
Copy link
Contributor

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

@github-actions github-actions bot added the stale label Oct 30, 2022
@targos targos added never-stale Mark issue so that it is never considered stale and removed stale labels Oct 30, 2022
@github-actions
Copy link
Contributor

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

@benjamingr
Copy link
Member

@nodejs/github-bot (hope that's the right ping), it looks like the never-stale label is broken ^

@bnoordhuis
Copy link
Member

OTOH, if no one is actively working on it, then we may just as well close it out.

I would summarize the consensus as: no strong resistance against inclusion in core but no strong desire either. Third-party packages exist and are likely Good Enough(TM).

@targos targos moved this from Pending Triage to Stale in Node.js feature requests May 1, 2023
@targos targos added stale and removed never-stale Mark issue so that it is never considered stale labels May 1, 2023
@targos targos closed this as completed May 1, 2023
@benjamingr
Copy link
Member

Closing as not planned (as this is not completed)

@benjamingr benjamingr closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2023
@devsnek
Copy link
Member

devsnek commented Aug 24, 2023

For anyone wandering past in need of webgpu, I updated dawn to include a proper node.js module entrypoint, exposing a gpu object analogous to navigator.gpu: https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/node/index.js

if there is enough interest we may be able to set up an auto-published npm module.

@matthargett
Copy link

Yes, please make a blessed npm package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. stale
Projects
None yet
Development

No branches or pull requests

7 participants