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 Implementation #7863

Closed
crowlKats opened this issue Oct 7, 2020 · 16 comments · Fixed by #7977
Closed

WebGPU Implementation #7863

crowlKats opened this issue Oct 7, 2020 · 16 comments · Fixed by #7977
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)

Comments

@crowlKats
Copy link
Member

I have been looking at the WebGPU spec and the wgpu crate for a possible WebGPU implementation which arose from a discussion on the discord server.
Problem is, how would we handle the window on which the user would draw to? Adding a window manager to deno would definitively not be a viable solution. wgpu-rs does actually allow to have a windowless setup, but i think most end users would actually want a way to have some sort of window. A window is also required for usage of swap chains; which, once again, many users would want.

@ry
Copy link
Member

ry commented Oct 7, 2020

Glad you're looking into this. I was imagining we would start with a windowless setup. The goal is to run tensorflow.js's WebGPU backend.
https://github.com/tensorflow/tfjs/tree/master/tfjs-backend-webgpu

@0kku
Copy link

0kku commented Oct 7, 2020

i think most end users would actually want a way to have some sort of window

[citation needed]

I think the more useful use-case would be ML (TF with WebGPU backend), server side image processing, and other GPU compute tasks. I'm not sure how much sense it would make to write a UI in raw wgpu when you're writing JS/TS. Seems like a questionable pairing, and people probably should just host a PWA on the localhost and render in their browser if they want a GUI.

@crowlKats
Copy link
Member Author

crowlKats commented Oct 7, 2020

@0kku good point, didnt really think about that

@kitsonk kitsonk added cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) labels Oct 9, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Oct 9, 2020

Ref #5701, #1629

@crowlKats
Copy link
Member Author

gfx-rs/wgpu#869

@crowlKats
Copy link
Member Author

crowlKats commented Oct 12, 2020

I came up with a solution for adding window support for webgpu without adding any other deps.
This would require plugins to have access to the resourcetable tho.
The community (or we in std) would create plugins for rust window handlers. The surface which you pass to wgpu is created with a param that needs to be a raw_window_handle::HasRawWindowHandle (which is a standarized way to get a raw window handle by the different rust window managers). We would have a deno property on the descriptor for GPU.requestAdapter (like on workers) where you could pass a rid for such a HasRawWindowHandle.

@crowlKats crowlKats mentioned this issue Oct 14, 2020
16 tasks
@chances
Copy link

chances commented Nov 3, 2020

@crowlKats Considering the open PR, shall I formally abandon chances/deno-wgpu, i.e. archive the repo and link back here?

@crowlKats
Copy link
Member Author

@chances would make sense

chances added a commit to chances/deno-wgpu that referenced this issue Nov 18, 2020
See denoland/deno#7863 for progress of WebGPU integration into Deno
@bartlomieju bartlomieju mentioned this issue Dec 18, 2020
22 tasks
@cztomsik
Copy link

Hey, not sure where to ask, is this going to be optional somehow? It seems like quite a big feature, including WSGL parser, compiler, there's some runtime memory overhead as well. I'd expect this to be a native plugin. Webview was also possible with plugin so why not this?

@lucacasonato
Copy link
Member

lucacasonato commented Mar 10, 2021

@cztomsik This is a Web API. We implement these out of the box, without the need for external plugins (see fetch, TextEncoder, etc). Deno is modular, so if you want to build a runtime that does not contain WebGPU, that is totally possible. Deno however has shipped this experimental feature feature in 1.8.0. We are hoping to be able to reduce the runtime memory overhead in the coming weeks (the overhead is about 1MB of extra heap). It is and will not be optional in the Deno binary that we ship.

@cztomsik
Copy link

cztomsik commented Mar 10, 2021

Unless something changed recently, WebGPU is still just working name for future standard. There is no initial release yet and support is basic/feature-flagged even in latest browsers:
image
image
image

@lucacasonato
Copy link
Member

lucacasonato commented Mar 10, 2021

@cztomsik That is why it is experimental, and locked behind the --unstable flag. We are very aware that it is not stabilized anywhere yet (that is why it is not stabilized in Deno either) - it is a highly unstable API, and the spec is far from complete. It is implemented in Chrome Canary behind a flag, in Firefox Nightly behind a flag, and in Safari TP and Safari stable behind a flag. This API will land sooner or later, and it opens up some amazing possibilities for out of the box general purpose GPU accelerated processing (for example ML inference and learning).

Editor's draft spec: https://gpuweb.github.io/gpuweb/

@birkskyum
Copy link
Contributor

Times are changing, and WebGPU is enabled by default in Chrome. Can this be reopened for a discussion around this in the present context?

@birkskyum
Copy link
Contributor

@felipetesc
Copy link

I came up with a solution for adding window support for webgpu without adding any other deps.

Perhaps this is out of the scope, but what about ressurrecting the project https://github.com/denosaurs/pane, or to create winit bindings. winit works well with wgpu. rust-windowing also has the repo https://github.com/rust-windowing/softbuffer which would allow creating 2D buffer/image, and would help on #3234 .

@eliassjogreen
Copy link
Contributor

I came up with a solution for adding window support for webgpu without adding any other deps.

Perhaps this is out of the scope, but what about ressurrecting the project denosaurs/pane, or to create winit bindings. winit works well with wgpu. rust-windowing also has the repo rust-windowing/softbuffer which would allow creating 2D buffer/image, and would help on #3234 .

Totally! I think it would not require much to bring back pane now that webgpu support is coming back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants