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

Add JS binding for wgpu's start_capture and stop_capture #26766

Open
jowens opened this issue Nov 6, 2024 · 2 comments
Open

Add JS binding for wgpu's start_capture and stop_capture #26766

jowens opened this issue Nov 6, 2024 · 2 comments
Labels
suggestion suggestions for new features (yet to be agreed) webgpu WebGPU API

Comments

@jowens
Copy link

jowens commented Nov 6, 2024

I would like to use Deno to profile WebGPU compute workloads within Xcode without any need for graphics. Currently, to capture a Metal trace within Xcode for a Deno workload, I'm having to create a window and canvas, invoke my compute workload, and then present the canvas, and then I can (manually) capture the Metal layer and see my compute-workload profile. This is not ideal; I don't want or need graphics at all. I'd like to do this at the command line and/or completely headless.

I believe I can do this if I have JS bindings to the wgpu calls start_capture and stop_capture. With JS bindings to those calls, I can then start and stop capture around my compute workload, then run within Xcode and see profile information.

What would make this even better is if I could write that trace to a file (and this was exposed in JS). Metal has a MTLCaptureManager and gfx-rs/wgpu#3504 appears relevant here.

Also please note gfx-rs/wgpu#6255, which notes Metal backend device capture issues in wgpu.

cc: @raphlinus

@bartlomieju bartlomieju added suggestion suggestions for new features (yet to be agreed) webgpu WebGPU API labels Nov 6, 2024
@crowlKats
Copy link
Member

@jowens this is definitively interesting, however am not sure yet how we can exponse this to users as we cnanot add to the web-standard APIs. maybe some form of namespace in the deno namespace (ie Deno.webgpu.*) could work, but not sure if this is desireable. this will need some further discussion; I will bring this up in next week's wgpu meeting, as this is not a singleton for extending the standard APIs.

@jowens
Copy link
Author

jowens commented Nov 7, 2024

Thank you (in advance) for discussing it! It is definitely a pain point to use the (very fine) Xcode tools with WebGPU and Deno could be a very fine platform for WebGPU development with this, but of course I appreciate the namespace challenges here. I look forward to hearing the outcomes of what you discuss next week!

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

No branches or pull requests

3 participants