Make WebGPU EP compatible with EP API#26907
Merged
fs-eire merged 27 commits intomicrosoft:mainfrom Mar 24, 2026
Merged
Conversation
1ca0d32 to
6873ade
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends WebGPU EP to support building as both a bundled EP (static library) and an EP API-based plugin EP (shared library). The changes introduce a new adapter infrastructure in include/onnxruntime/ep/ that bridges C-API objects to simulate ORT internal class behaviors, enabling compile-time switching between build modes with minimal code changes.
Key changes:
- New EP adapter infrastructure with header-only wrapper classes for kernel info, context, registry, and EP interface
- WebGPU EP API implementation (
api.cc,factory.cc/h,ep.cc/h) inonnxruntime/core/providers/webgpu/ep/ - Templated CPU tensor operator base classes to work with both native and adapter OpKernelInfo types
- Enhanced C API with
KernelInfo_GetOperatorType,KernelInfo_GetSinceVersion, andKernelInfo_GetEp - Test infrastructure updates including example kernel registry changes (Mul kernel renamed to BinaryOp supporting both Add and Mul)
Reviewed changes
Copilot reviewed 75 out of 75 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| include/onnxruntime/ep/*.h | New EP adapter infrastructure headers providing C-API wrappers for kernel registration and execution |
| onnxruntime/core/providers/webgpu/ep/* | WebGPU EP API implementation for factory, EP instance, and plugin entry points |
| onnxruntime/core/providers/cpu/tensor/*.h | Templated base classes for tensor ops to support both native and adapter kernel info types |
| onnxruntime/test/autoep/* | Test updates including BinaryOp generalization and additional test coverage |
| onnxruntime/core/session/*.cc | Core API additions for kernel info operator type, version, and EP retrieval |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4d451dc to
e52d706
Compare
9e3419b to
0e58206
Compare
4a5e066 to
6333b00
Compare
fs-eire
added a commit
that referenced
this pull request
Feb 28, 2026
### Description This PR adds a few headers for supporting building WebGPU EP and CUDA EP as plugin EPs. See summary of #26907
e5caa04 to
a12a6a9
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
This reverts commit 5932371.
edgchen1
approved these changes
Mar 23, 2026
adrianlizarraga
approved these changes
Mar 24, 2026
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
This PR makes it possible to build WebGPU EP as an EP API based plugin EP.
Requirements
The goal of this PR is to support both building WebGPU EP as a bundled EP and an EP API based plugin EP. This approach allows:
Design & Implementation
Instead of changing WebGPU EP from a bundled EP to an EP API based plugin EP in one shot, this PR extend WebGPU EP to support building as plugin EP.
add a new folder
include/onnxruntime/epwith a bunches of header files. Those files are not WebGPU specific. They are used for:onnxruntime::ep::Epto inherit fromThese header files allow a compile time "switch" to the different set of types to minimize changes to existing code. Specifically,
pch.his required to be included as PCH to make sure the "override" to take place correctly.add a new folder
onnxruntime/core/providers/webgpu/epfor EP API implementation, specifically:api.cc: implementsCreateEpFactoriesandReleaseEpFactoryep.ccep.h: implement classonnxruntime::webgpu::ep::Epfactory.ccfactory.h: implement classonnxruntime::webgpu::ep::FactoryDependencies and Prerequisites
(unmerged changes are included as a part of current PR)
Missing Parts