Skip to content

[webgpu] Enable graph capture #24900

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[webgpu] Enable graph capture #24900

wants to merge 2 commits into from

Conversation

qjia7
Copy link
Contributor

@qjia7 qjia7 commented May 29, 2025

This PR enables graph capture capabilities in the WebGPU provider, which is similar with jsep one #18989.

All limitations are similar with JS/CUDA EP:

  1. Models with control-flow ops (i.e. If, Loop and Scan ops) are not supported.
  2. Usage of graph capture is limited to models where-in all ops in the model can be partitioned to the WebGPU EP or CPU EP and no memory copy between them.
  3. Shapes of inputs/outputs cannot change across inference calls.
  4. IOBinding is required. And all inputs/outputs are pre-allocated gpu buffers.

} else {
wgpuBufferRelease(buffer);
// TODO: Reuse the captured buffers for storage buffer to reduce peak memory.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reuse the captured buffers, we need to change BufferManager::Create/TryAcquireCachedBuffer to add one additional parameter session_id so that we can check whether this session has been captured. If yes, we can get buffer from captured_buffers_ to reuse the buffer in TryAcquireCachedBuffer. How do you think? @fs-eire

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant