[webgpu] revise class ComputeContext in WebGPU EP - #26552
Merged
Yulong Wang (fs-eire) merged 2 commits intoNov 13, 2025
Merged
Conversation
Contributor
Author
|
/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the ComputeContext class in the WebGPU execution provider to prevent direct access to the BufferManager, improving encapsulation and making buffer memory issues easier to diagnose.
Key changes:
- Moved
WebGpuContextretrieval and error scope management fromComputeContexttoWebGpuKernel::Compute - Introduced
BufferManagerAccessornested class with friend access to restrictBufferManageraccess toWebGpuContextonly - Updated
ComputeContextconstructor to acceptWebGpuContext&as a parameter instead of fetching it internally
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
webgpu_kernel.h |
Moved constructor and Compute method implementations from inline to separate .cc file |
webgpu_kernel.cc |
Implemented WebGpuKernel constructor and Compute method with validation mode error scope handling |
webgpu_context.cc |
Updated BufferManager access to use BufferManagerAccessor |
compute_context.h |
Added BufferManagerAccessor nested class and updated constructor signature |
compute_context.cc |
Simplified implementation with new constructor and BufferManagerAccessor::Get method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Jiajia Qin (qjia7)
previously approved these changes
Nov 12, 2025
Guenther Schmuelling (guschmue)
previously approved these changes
Nov 12, 2025
Yulong Wang (fs-eire)
dismissed stale reviews from Guenther Schmuelling (guschmue) and Jiajia Qin (qjia7)
via
November 12, 2025 22:16
a5563b8
Guenther Schmuelling (guschmue)
approved these changes
Nov 12, 2025
Rohanjames1997
pushed a commit
to Rohanjames1997/onnxruntime
that referenced
this pull request
Dec 4, 2025
### Description revise class ComputeContext in WebGPU EP. Avoid potential access to `ComputeContext::BufferManager`, which may cause it very difficult to diagnose buffer memory issue.
Sumit Kumar (Sumit2318)
pushed a commit
that referenced
this pull request
Jan 6, 2026
### Description revise class ComputeContext in WebGPU EP. Avoid potential access to `ComputeContext::BufferManager`, which may cause it very difficult to diagnose buffer memory issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
revise class ComputeContext in WebGPU EP.
Avoid potential access to
ComputeContext::BufferManager, which may cause it very difficult to diagnose buffer memory issue.