ONNX Runtime WebGPU PR Monitor

Last Updated: 04/29/2026, 07:27 PM | Total: 201 PRs

Showing 1-10 of 30 PRs
Page 1 of 3
👤 TomCrypto📅 Created: 04/29/2026
🤖 AI 摘要

## PR 主要改动总结 **1. 主要功能:** 为 ONNX Runtime 的 WebGPU 执行提供程序(EP)实现了 GridSample 算子,支持 opset 16-19 版本。新增了约 300 行代码,包括核心实现文件和头文件。 **2. 解决的问题:** 填补了 WebGPU EP 中缺失的 GridSample 算子支持,使其与其他主要执行提供程序(如 CUDA、CPU 等)保持功能一致性。扩展了相关测试用例以覆盖 WebGPU EP,并已通过测试验证。 **3. WebGPU 影响:** 增强了 WebGPU EP 的算子完整性,使基于浏览器的 WebGPU 推理能够支持使用 GridSample 的模型(常用于图像采样和空间变换任务),预期可直接被 onnxruntime-web 构建使用。 **4. 技术要点:** 在 WebGPU 执行提供程序中注册了新算子,实现了 GPU 端的网格采样计算逻辑,关闭了 issue #27085。

📁 Changed Files (4 files, 316 changes: +316/-0)
onnxruntime/core/providers/webgpu/tensor/grid_sample.cc
onnxruntime/core/providers/webgpu/tensor/grid_sample.h
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc
onnxruntime/test/providers/cpu/tensor/grid_sample_test.cc
ep:WebGPU
👤 qjia7📅 Created: 04/29/2026
🤖 AI 摘要

## PR 主要改动总结 **核心改动:** 为 ONNX Runtime WebGPU 实现了基于图标注 ID 的独立缓冲区管理器(per-graph buffer manager),替换原有的全局共享缓冲区管理器。这使得多个使用不同提示词的生成器可以各自拥有隔离的缓冲区缓存。 **解决的问题:** 修复了在启用图捕获(graph capture)时,多个生成器之间可能发生的缓冲区数据污染问题。通过为每个图分配独立的缓冲区管理器,确保不同生成器的执行互不干扰。 **技术要点:** 1. 引入 `per_graph_buffer_mgrs_` 映射表,以图标注 ID 为键存储各自的缓冲区管理器 2. 重构 `GpuBufferAllocator`,将固定的 `const BufferManager&` 改为支持动态路由的指针和 `SetBufferManager()` 方法 3. 新增 `ReleaseGraph` API 贯穿整个调用栈(从 EP 基类到 C API),允许在生成器销毁时释放已捕获的图资源,包括命令、缓冲区管理器和跟踪状态

📁 Changed Files (17 files, 242 changes: +209/-33)
include/onnxruntime/core/framework/execution_provider.h
include/onnxruntime/core/session/onnxruntime_c_api.h
include/onnxruntime/core/session/onnxruntime_ep_c_api.h
onnxruntime/core/providers/webgpu/allocator.cc
onnxruntime/core/providers/webgpu/allocator.h
onnxruntime/core/providers/webgpu/ep/ep.cc
onnxruntime/core/providers/webgpu/ep/ep.h
onnxruntime/core/providers/webgpu/ep/factory.cc
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc
onnxruntime/core/providers/webgpu/webgpu_execution_provider.h
onnxruntime/core/session/inference_session.cc
onnxruntime/core/session/inference_session.h
onnxruntime/core/session/onnxruntime_c_api.cc
onnxruntime/core/session/ort_apis.h
onnxruntime/core/session/ort_version_check.h
onnxruntime/core/session/plugin_ep/ep_plugin_provider_interfaces.cc
onnxruntime/core/session/plugin_ep/ep_plugin_provider_interfaces.h
🤖 AI 摘要

## ONNX Runtime GQA 形状验证放宽以兼容旧模型 ### 核心改动 该PR放宽了 Group Query Attention (GQA) 算子中 `seqlens_k` 参数的形状验证规则,以保持与旧模型(如 qwen3-0.6b、qwen3-1.7b)的向后兼容性。这些模型生成的 `seqlens_k` 形状为 `[1,1]` 而非标准的 `[1]`。 ### 解决的问题 修复了 PR #28031 引入的回归问题——该PR通过修正 `&&` 为 `||` 修复了安全漏洞,但严格的形状验证导致一些合法模型无法运行。新的验证规则在保持安全性的同时,接受带有单位维度的形状(如 `[B]`、`[B,1]`、`[1,B]`),只要总元素数等于 batch_size。 ### WebGPU 影响 同步修复了 WebGPU EP (Execution Provider) 中相同的 `&&`/`||` 逻辑错误,并在 JS/WebGPU 代码路径中应用了相同的放宽验证规则,确保跨平台的一致性和兼容性。 ### 技术要点 验证规则变更为:(1) 拒绝标量;(2) 总元素数必须等于 batch_size;(3) 每个维度必须为 1 或 batch_size。重要的是,Compute() 中的元素值边界检查保持不变,完全保留了原有的 OOB 安全修复。

📁 Changed Files (4 files, 285 changes: +211/-74)
js/web/lib/wasm/jsep/webgpu/ops/group-query-attention.ts
js/web/test/data/ops/group-query-attention.jsonc
onnxruntime/contrib_ops/cpu/bert/group_query_attention_helper.h
onnxruntime/test/contrib_ops/group_query_attention_op_test.cc
👤 edgchen1📅 Created: 04/24/2026
🤖 AI 摘要

## PR 主要改动总结 **核心功能:** 为 ONNX Runtime 的 WebGPU 插件执行提供器(EP)添加了完整的 Python 打包支持,包括构建流程和自动化测试管道。 **主要内容:** 1. 新增了 Python wheel 包的构建脚本(`build_wheel.py`)和跨平台打包工具,支持 Linux、Windows 和 macOS 三个平台 2. 建立了完整的 CI/CD 测试管道(Azure Pipelines),包含针对各平台的打包测试阶段,确保 Python 包的质量和功能正确性 3. 添加了 171 行的单元测试代码和 Docker 构建配置,实现了从构建到测试的全流程自动化 **技术影响:** 此改动使得 WebGPU 插件 EP 可以作为独立的 Python 包进行分发和安装,显著降低了用户使用门槛,推动了 ONNX Runtime 在 WebGPU 平台上的部署能力。代码新增 1198 行,仅删除 16 行,是一次完整的功能性扩展。

📁 Changed Files (24 files, 1236 changes: +1231/-5)
plugin-ep-webgpu/MIN_ONNXRUNTIME_VERSION
plugin-ep-webgpu/README.md
plugin-ep-webgpu/VERSION_NUMBER
plugin-ep-webgpu/python/README.md
plugin-ep-webgpu/python/build_wheel.py
plugin-ep-webgpu/python/onnxruntime_ep_webgpu/README.md
plugin-ep-webgpu/python/onnxruntime_ep_webgpu/__init__.py
plugin-ep-webgpu/python/pyproject.toml.in
plugin-ep-webgpu/python/requirements-build-wheel.txt
plugin-ep-webgpu/python/setup.py
plugin-ep-webgpu/python/test/test_webgpu_plugin_ep.py
tools/ci_build/github/azure-pipelines/plugin-webgpu-pipeline.yml
tools/ci_build/github/azure-pipelines/plugin-webgpu-test-pipeline.yml
tools/ci_build/github/azure-pipelines/stages/plugin-linux-webgpu-stage.yml
tools/ci_build/github/azure-pipelines/stages/plugin-linux-webgpu-test-stage.yml
tools/ci_build/github/azure-pipelines/stages/plugin-mac-webgpu-stage.yml
tools/ci_build/github/azure-pipelines/stages/plugin-mac-webgpu-test-stage.yml
tools/ci_build/github/azure-pipelines/stages/plugin-webgpu-packaging-stage.yml
tools/ci_build/github/azure-pipelines/stages/plugin-win-webgpu-stage.yml
tools/ci_build/github/azure-pipelines/stages/plugin-win-webgpu-test-stage.yml
tools/ci_build/github/azure-pipelines/templates/set-plugin-build-variables-step.yml
tools/ci_build/github/linux/build_webgpu_plugin_python_package.sh
tools/ci_build/github/linux/docker/inference/x86_64/python/webgpu/Dockerfile
tools/ci_build/github/linux/docker/inference/x86_64/python/webgpu/scripts/install_centos.sh
👤 xhcao📅 Created: 04/22/2026
🤖 AI 摘要

## PR 主要改动总结 **主要功能改动:** 针对 WebGPU 的 ReduceMean 算子优化了计算策略选择逻辑。当输出尺寸远大于归约维度大小时,改用朴素归约(naive reduction)方法替代共享内存归约方法。 **解决的问题:** 解决了共享内存归约方法在特定场景下的性能问题。当输出维度较大时,共享归约可能需要对输入进行转置操作,这会带来显著的时间开销,影响整体性能。 **对 WebGPU 支持的影响:** 通过根据数据维度特征智能选择归约算法,提升了 WebGPU 后端在处理大输出尺寸归约操作时的执行效率。 **技术要点:** 代码改动量很小(仅 3 行新增,1 行删除),通过添加条件判断实现算法切换,属于性能优化类改动。

📁 Changed Files (1 files, 25 changes: +16/-9)
onnxruntime/core/providers/webgpu/reduction/reduction_ops.cc
ep:WebGPU
👤 sushraja-msft📅 Created: 04/14/2026
🤖 AI 摘要

## PR 主要改动总结 ### 核心功能 为 ONNX Runtime WebGPU 实现了 **TurboQuant 量化加速技术**,这是一个正在开发中的实验性功能,用于优化大语言模型的推理性能。 ### 技术实现 - 采用 **Hadamard 矩阵进行旋转变换**替代论文中的常规矩阵方法,实现了自定义的 TurboQuant 变体 - 主要集成在 Flash Attention 和 Group Query Attention (GQA) 模块中,新增了旋转量化 (rotate_quantize) 的 WebGPU shader 实现 - 基准测试显示在 Phi-4 模型上获得了显著性能提升:**prompt 处理速度达到 1790 tokens/s,token 生成速度为 99.8 tokens/s** ### 代码结构 新增了完整的 TurboQuant 基础设施,包括 Hadamard 变换核心逻辑、WGSL shader 模板、GQA 测试用例和详细的实现计划文档(646 行),共计 2700+ 行新代码,为后续优化奠定基础。

📁 Changed Files (23 files, 2778 changes: +2739/-39)
.vscode/settings.json
cmake/CMakeLists.txt
docs/turbo_quant_plan.md
onnxruntime/contrib_ops/webgpu/bert/attention_common.h
onnxruntime/contrib_ops/webgpu/bert/flash_attention.cc
onnxruntime/contrib_ops/webgpu/bert/flash_attention.h
onnxruntime/contrib_ops/webgpu/bert/flash_attention.wgsl.template
onnxruntime/contrib_ops/webgpu/bert/flash_attention_decode_qkt.wgsl.template
onnxruntime/contrib_ops/webgpu/bert/flash_attention_decode_split_vx.wgsl.template
onnxruntime/contrib_ops/webgpu/bert/group_query_attention.cc
onnxruntime/contrib_ops/webgpu/bert/turbo_quant_common.wgsl.template
onnxruntime/contrib_ops/webgpu/bert/turbo_quant_hadamard.cc
onnxruntime/contrib_ops/webgpu/bert/turbo_quant_hadamard.h
onnxruntime/contrib_ops/webgpu/bert/turbo_quant_rotate_quantize.wgsl.template
onnxruntime/core/providers/webgpu/compute_context.h
onnxruntime/core/providers/webgpu/program_manager.cc
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc
onnxruntime/core/providers/webgpu/webgpu_execution_provider.h
onnxruntime/core/providers/webgpu/webgpu_provider_factory.cc
onnxruntime/core/providers/webgpu/webgpu_provider_options.h
samples/cxx/CMakeLists.txt
samples/cxx/GqaTest.cc
samples/cxx/generate_gqa_model.py
👤 xenova📅 Created: 04/13/2026
🤖 AI 摘要

## PR 主要改动总结 **1. 主要功能:** 此 PR 为 ONNX Runtime 的 WebGPU 后端实现了 DeformConv(可变形卷积)算子,新增了约 370 行实现代码和相应的头文件。 **2. 解决的问题:** 添加 DeformConv 算子支持是为了运行 BiRefNet 模型,填补了 WebGPU 后端在该算子上的功能空缺。 **3. 对 WebGPU 的影响:** 增强了 WebGPU 执行提供程序的算子覆盖范围,使其能够支持更多依赖可变形卷积的深度学习模型,特别是图像分割类模型。 **4. 技术要点:** 在 `webgpu_execution_provider.cc` 中注册了新算子,实现遵循 ONNX 标准的 DeformConv 规范,同时更新了版本检查相关配置。

📁 Changed Files (4 files, 413 changes: +406/-7)
onnxruntime/core/providers/webgpu/nn/deform_conv.cc
onnxruntime/core/providers/webgpu/nn/deform_conv.h
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc
onnxruntime/core/session/ort_version_check.h
ep:WebGPU
🤖 AI 摘要

## PR 主要改动总结 **核心改动:** 修复了 ONNX Runtime JavaScript 实现中的两个关键性 bug,涉及轴向归一化和 WebGPU Slice 算子。 **解决的问题:** 1. 修复了 `normalizeAxis()` 函数中的逻辑错误,将不可能为真的条件 `axis < -tensorRank && axis >= tensorRank` 中的 `&&` 改为 `||`,使其能够正确检测和拒绝超出有效范围的轴参数,避免潜在的数组越界访问 2. 为 WebGPU Slice 算子补充了 `step == 0` 的验证逻辑,与 CPU 实现保持一致,防止除零错误导致的未定义行为(`ceil((end-start)/step)` 计算会产生无穷大并导致类型转换异常) **技术影响:** 提升了 WebGPU 后端的健壮性和安全性,确保恶意或错误输入不会导致运行时崩溃或未定义行为,同时修复了 onnxjs 和 jsep 两个 JavaScript 实现路径中的共同缺陷。

📁 Changed Files (3 files, 5 changes: +3/-2)
js/web/lib/onnxjs/util.ts
js/web/lib/wasm/jsep/util.ts
onnxruntime/core/providers/webgpu/tensor/slice.cc
🤖 AI 摘要

## PR 主要改动总结 **1. 主要功能改动:** 修复了 Windows WebGPU CI 构建超时问题,通过优化测试执行策略减少资源消耗。 **2. 解决的问题:** - 移除了冗余的 `onnxruntime_test_all.exe` 测试执行(该测试已在 CTest 阶段覆盖) - 将 `onnxruntime_provider_test.exe` 拆分为 4 个 GTest 分片并行执行,解决了数百个测试共享单个 WebGPU 上下文导致的 GPU 资源耗尽问题 **3. 对 WebGPU 支持的影响:** 显著提升了 WebGPU Windows CI 的稳定性,避免了测试运行器在执行过程中无响应或崩溃,确保持续集成流程能够正常完成。 **4. 技术要点:** 通过 GTest 的 `GTEST_TOTAL_SHARDS` 和 `GTEST_SHARD_INDEX` 参数实现测试分片,避免 Dawn/WebGPU 在长时间运行大量测试时的资源耗尽问题。

📁 Changed Files (1 files, 37 changes: +34/-3)
.github/workflows/windows_webgpu.yml
👤 guschmue📅 Created: 03/27/2026
🤖 AI 摘要

## PR 改动总结 **主要功能:** 为 ONNX Runtime 的 WebGPU 执行提供程序添加了 LSTM(长短期记忆网络)算子的完整支持,新增了约 666 行代码实现 LSTM 的 GPU 加速计算。 **解决的问题:** 填补了 WebGPU 后端对循环神经网络(RNN)中核心算子 LSTM 的支持空白,使得包含 LSTM 层的模型能够在 WebGPU 环境中运行,扩展了 WebGPU 后端对序列建模任务的支持能力。 **对 WebGPU 的影响:** 显著增强了 WebGPU 执行提供程序对深度学习模型的覆盖范围,特别是自然语言处理、时间序列预测等需要 LSTM 的场景,提升了浏览器端运行复杂 RNN 模型的能力。 **技术要点:** 实现包含独立的 LSTM 头文件和实现文件(lstm.h/cc),并在 WebGPU 执行提供程序中注册该算子,涉及 LSTM 特有的门控机制、隐藏状态管理和 GPU 计算着色器的适配。

📁 Changed Files (3 files, 673 changes: +673/-0)
onnxruntime/core/providers/webgpu/rnn/lstm.cc
onnxruntime/core/providers/webgpu/rnn/lstm.h
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc
ep:WebGPU