ONNX Runtime WebGPU PR Monitor

Last Updated: 02/20/2026, 06:46 PM | Total: 121 PRs

Showing 1-10 of 16 PRs
Page 1 of 2
👤 guschmue📅 Created: 02/20/2026
🤖 AI 摘要

## PR 主要改动总结 **主要功能:** 此 PR 为 ONNX Runtime 的 WebGPU 后端 flash attention 实现添加了 head_sink 支持,使其能够支持 GPT-OSS 模型。 **解决的问题:** 扩展了 flash attention 的功能范围,通过支持 head_sink 特性来处理特定的注意力机制模式,这是 GPT-OSS 等模型所需的关键能力。修改涉及核心 flash attention 逻辑(.cc/.h)和多个 WGSL 着色器模板文件。 **技术要点:** - 在 flash attention 的 C++ 实现中增加了约 40 行代码来处理 head_sink 参数 - 更新了三个 WGSL 着色器模板(decode_split_vx、decode_qkt 和主模板)以支持新的计算逻辑 - 同步调整了 group_query_attention 相关代码以保持一致性 **影响:** 增强了 WebGPU 后端对现代 Transformer 模型的支持能力,特别是 GPT 系列模型的推理性能优化。

📁 Changed Files (6 files, 109 changes: +86/-23)
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
ep:WebGPU
👤 tianleiwu📅 Created: 02/20/2026
🤖 AI 摘要

## PR 主要改动总结 **1. 主要功能改动** 该 PR 在 CI 流水线中启用了 Python 3.14 测试支持,并升级了多个核心依赖包版本,包括 numpy (2.4.2)、triton (3.5.0)、onnxscript (0.6.2)、onnx-ir (0.1.16) 和 onnx (1.20.1),移除了基于 Python 版本的条件判断逻辑。 **2. 解决的问题** 解决了之前因依赖包不支持 Python 3.14 而无法启用相应 CI 测试的问题。同时修复了 `onnxruntime_test_python_mlops.py` 测试中的栈溢出问题,通过修改异常处理代码 (`onnxruntime_pybind_exceptions.cc`) 提升了测试稳定性。 **3. WebGPU 影响** 此 PR 主要涉及 Python 环境和依赖升级,对 WebGPU 功能无直接影响,但为整体项目的现代化和兼容性提供了基础支持。 **4. 技术要点** 修改覆盖了 18 个文件,主要涉及 Linux/Windows/macOS 多平台的 Docker 镜像和 CI 配置文件中的 requirements.txt,统一了依赖版本管理,简化了跨版本兼容性维护工作。

📁 Changed Files (18 files, 153 changes: +88/-65)
.github/actions/macos-ci-setup/action.yml
.github/workflows/linux_ci.yml
.github/workflows/mac.yml
.github/workflows/macos-ci-build-and-test-workflow.yml
.github/workflows/windows_cuda.yml
cmake/deps.txt
onnxruntime/python/onnxruntime_pybind_exceptions.cc
tools/ci_build/build.py
tools/ci_build/github/azure-pipelines/stages/py-win-gpu-stage.yml
tools/ci_build/github/azure-pipelines/stages/py-win-webgpu-stage.yml
tools/ci_build/github/azure-pipelines/templates/py-win-cpu.yml
tools/ci_build/github/linux/docker/inference/aarch64/python/cpu/scripts/requirements.txt
tools/ci_build/github/linux/docker/scripts/lort/requirements.txt
tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt
tools/ci_build/github/linux/docker/scripts/requirements.txt
tools/ci_build/github/linux/python/requirements.txt
tools/ci_build/github/windows/python/requirements.txt
tools/ci_build/requirements/transformers-test/requirements.txt
👤 fs-eire📅 Created: 02/16/2026
🤖 AI 摘要

## PR 主要改动总结 **主要功能改动:** 修复了 `RemoveDuplicateCastTransformer` 优化器中跨执行提供器(EP)边界进行 Cast 算子融合的错误行为。现在添加了 EP 检查,确保只有在两个 Cast 节点位于同一个执行提供器时才会进行融合优化。 **解决的问题:** 修复了 #27291 号问题。之前 `Cast(int64->float, CPU)` 和 `Cast(float->float16, WebGPU)` 会被错误地融合成 `Cast(int64->float16, WebGPU)`,导致 WebGPU 执行提供器无法找到对应的 kernel 而失败。 **对 WebGPU 的影响:** 直接修复了 WebGPU EP 的稳定性问题,防止生成 WebGPU 不支持的数据类型转换操作,确保模型优化后仍能在 WebGPU 上正确执行。 **技术要点:** 在 `insert_cast_transformer.cc` 中添加了执行提供器一致性检查逻辑(+24/-5 行),并在测试文件中增加了 58 行回归测试用例验证修复效果。

📁 Changed Files (2 files, 90 changes: +85/-5)
onnxruntime/core/optimizer/insert_cast_transformer.cc
onnxruntime/test/framework/insert_cast_transformer_test.cc
ep:WebGPU
👤 Jiawei-Shao📅 Created: 01/30/2026
🤖 AI 摘要

## PR 主要改动总结 **核心改动:** 这个 PR 从 WebGPU 执行提供程序(EP)的 `MatMul::ComputeInternal()` 函数中移除了所有处理 `bias`(偏置)相关的逻辑代码。 **解决的问题:** 由于 ONNX 的 `MatMul` 算子本身不支持 `bias` 作为输入参数,因此在实现中处理偏置的逻辑是冗余和不必要的。这次清理移除了 18 行代码,仅添加 3 行,简化了实现。 **对 WebGPU 支持的影响:** 这是一次代码清理优化,不影响功能正确性,反而使 WebGPU 后端的矩阵乘法实现更加精简和符合 ONNX 规范。 **技术要点:** 移除了 `has_bias` 相关的条件判断和处理分支,使代码逻辑更清晰,减少了不必要的复杂度。

📁 Changed Files (1 files, 21 changes: +3/-18)
onnxruntime/core/providers/webgpu/math/matmul.cc
👤 jarrelscy📅 Created: 01/16/2026
🤖 AI 摘要

## PR 主要改动总结 **核心改动:** 修复了 ONNX Runtime WebGPU 执行提供程序中 Split 算子对动态输出形状的处理错误。 **解决的问题:** - 当 Split 算子的输出形状在运行时动态计算时,C++ 层错误地向 JavaScript 层传递了零值的 splitSizes 数组 - 这导致下游算子(如 Conv)因接收到错误的输入形状(如 [1,0,22])而失败,报告通道数不匹配错误 **技术要点:** - C++ 侧在 `split.h` 中添加了 `has_dim_value()` 检查,避免在动态形状场景下错误使用 `dim_value()` 的零返回值 - 当检测到动态形状时,跳过传递 splitSizes 参数,让 JavaScript 层在运行时自行计算正确的分割尺寸 - TypeScript 侧(split.ts)增强了运行时形状计算逻辑,能够处理未预定义的分割尺寸情况 **对 WebGPU 的影响:** 显著提升了 WebGPU 后端对动态模型的支持能力,使包含动态 Split 操作的神经网络模型能够正确执行。

📁 Changed Files (3 files, 149 changes: +131/-18)
js/web/lib/wasm/jsep/webgpu/ops/split.ts
js/web/test/data/ops/split.jsonc
onnxruntime/core/providers/js/operators/split.h
ep:WebGPU
👤 wenqinI📅 Created: 01/16/2026
🤖 AI 摘要

## PR 主要改动总结 **1. 核心功能:** 此 PR 为 ONNX Runtime 的 WebGPU 后端中的 `im2col` 核心添加了对任意 `input_channel` 大小的支持,通过引入 `vec1` 类型处理非 4 的倍数的输入通道数。 **2. 性能提升:** 解决了之前仅支持输入通道数为 4 的倍数的限制,使更多模型受益。在 YOLOv8n_pose 模型上,整体性能提升约 7%,对于输入通道数非 4 倍数的 Conv2D 算子性能提升达 50%。 **3. 技术实现:** 修改了 WGSL 着色器模板和 C++ 实现代码,通过动态选择向量化类型(vec1/vec2/vec4)来适配不同的输入通道配置,移除了之前对通道数必须是 4 的倍数的硬性限制。 **4. WebGPU 影响:** 增强了 WebGPU 后端对各种 CNN 模型的兼容性和性能表现,特别是对通道数配置不规则的模型提供了更好的支持。

📁 Changed Files (3 files, 59 changes: +38/-21)
onnxruntime/core/providers/webgpu/nn/im2col_matmul.cc
onnxruntime/core/providers/webgpu/nn/im2col_matmul.h
onnxruntime/core/providers/webgpu/nn/im2col_matmul.wgsl.template
👤 Copilot📅 Created: 01/16/2026
🤖 AI 摘要

## PR 主要改动总结 **核心改动:** 该 PR 通过在 `setup.py` 中添加自定义 Distribution 类,为所有 ONNX Runtime 变体包(包括 onnxruntime-webgpu)的 wheel 元数据注入 `Provides-Dist: onnxruntime` 字段,解决了现代 Python 依赖解析器(pip ≥20.3、uv、poetry 等)将变体包与基础包视为无关包而同时安装的问题。 **解决的问题:** 修复了依赖冲突问题 - 当项目同时依赖 `onnxruntime-gpu`(或其他变体)和间接依赖 `onnxruntime` 的包时,之前会错误地同时安装两个包,现在依赖解析器能正确识别变体包已提供基础包功能。 **对 WebGPU 的影响:** onnxruntime-webgpu 包现在会正确声明它提供了 onnxruntime 的功能,避免与基础包或其他变体包产生安装冲突。 **技术要点:** 通过 monkey-patch `setuptools.Distribution.write_pkg_file` 方法,在构建 wheel 时自动注入符合 PEP 566 规范的元数据,仅对非基础包生效,无需修改各变体包的单独配置。

📁 Changed Files (1 files, 67 changes: +67/-0)
setup.py
👤 qjia7📅 Created: 01/14/2026
🤖 AI 摘要

## PR 主要改动总结 ### 核心功能 此 PR 为 ONNX Runtime 添加了**支持偏移量的张量拷贝功能**,允许在源和目标张量之间进行部分数据拷贝,而不仅限于完整张量拷贝。主要在 C API 层面新增了 `CopyTensorWithOffsets` 等方法,并在数据传输框架层进行了相应扩展。 ### 解决的问题 解决了原有张量拷贝机制无法精细控制拷贝范围的限制,新增了指定源/目标偏移量和拷贝大小的能力,使得内存操作更加灵活高效,避免了不必要的全量数据传输。 ### WebGPU 影响 针对 WebGPU Provider 进行了适配性改造,更新了 `buffer_manager` 和 `data_transfer` 模块,使其支持带偏移量的 GPU 缓冲区操作,增强了 WebGPU 后端在处理大型张量时的内存管理效率。 ### 技术要点 涉及 18 个文件的修改(新增 220 行,删除 40 行),核心改动集中在数据传输抽象层(`data_transfer.h/cc`)和 WebGPU 缓冲区管理模块,同时扩展了公开 C API 接口以支持外部调用。

📁 Changed Files (18 files, 260 changes: +220/-40)
include/onnxruntime/core/session/onnxruntime_c_api.h
include/onnxruntime/core/session/onnxruntime_ep_c_api.h
onnxruntime/core/framework/data_transfer.cc
onnxruntime/core/framework/data_transfer.h
onnxruntime/core/framework/plugin_data_transfer.cc
onnxruntime/core/providers/webgpu/buffer_manager.cc
onnxruntime/core/providers/webgpu/buffer_manager.h
onnxruntime/core/providers/webgpu/data_transfer.cc
onnxruntime/core/providers/webgpu/data_transfer.h
onnxruntime/core/providers/webgpu/webgpu_provider_factory.cc
onnxruntime/core/session/onnxruntime_c_api.cc
onnxruntime/core/session/ort_apis.h
onnxruntime/test/autoep/library/example_plugin_ep/ep_data_transfer.cc
onnxruntime/test/autoep/library/example_plugin_ep/ep_data_transfer.h
onnxruntime/test/autoep/library/example_plugin_ep_kernel_registry/ep_data_transfer.cc
onnxruntime/test/autoep/library/example_plugin_ep_kernel_registry/ep_data_transfer.h
onnxruntime/test/autoep/library/example_plugin_ep_kernel_registry/kernels/utils.h
onnxruntime/test/shared_lib/test_data_copy.cc
👤 prathikr📅 Created: 01/12/2026
🤖 AI 摘要

## PR 主要改动总结 **1. 主要改动** 该 PR 从 GitHub Actions 的 lint 工作流中移除了对 `/js/` 文件夹的代码检查配置,删除了 20 行相关配置代码。 **2. 解决的问题** 由于 `/js/` 文件夹已被 `core/providers/webgpu` 替代,原有的针对 `/js/` 目录的 lint 检查已不再需要,此改动清理了过时的配置。 **3. 对 WebGPU 支持的影响** 这是 WebGPU 代码重构后的清理工作,反映了 WebGPU 实现已迁移到核心 provider 架构中,代码组织更加规范化。 **4. 技术要点** 纯粹的构建配置清理,移除冗余的 CI/CD 流程配置,不涉及功能代码变更。

📁 Changed Files (1 files, 20 changes: +0/-20)
.github/workflows/lint.yml
👤 fs-eire📅 Created: 01/06/2026
🤖 AI 摘要

## PR 主要改动总结 ### 核心功能 本 PR 为 ONNX Runtime 添加了一套 **header-only 的 EP (Execution Provider) API 适配器**,包含 14 个新增头文件,共计 1071 行代码,用于支持将 WebGPU EP 和 CUDA EP 作为插件式执行提供器进行构建。 ### 解决的问题 通过提供统一的适配器层,简化了外部执行提供器的开发流程。核心模块包括算子内核(OpKernel)、内核定义构建器(KernelDefBuilder)、内存分配器(Allocator)、日志系统(Logging)和数据传输管理器等基础组件,使得 EP 可以独立编译并以插件形式加载。 ### 对 WebGPU 的影响 这是 **WebGPU EP 插件化的关键基础设施**,使 WebGPU 执行提供器能够作为独立模块构建和部署,无需深度耦合到 ONNX Runtime 核心代码,提高了模块化程度和开发灵活性。 ### 技术要点 采用 header-only 设计避免 ABI 兼容性问题,通过适配器模式封装了内核注册、张量操作、设备管理等核心接口,为后续 EP 插件生态建设奠定了架构基础。

📁 Changed Files (16 files, 1441 changes: +1441/-0)
include/onnxruntime/ep/README.md
include/onnxruntime/ep/adapter/allocator.h
include/onnxruntime/ep/adapter/data_transfer_manager.h
include/onnxruntime/ep/adapter/ep.h
include/onnxruntime/ep/adapter/kernel_def.h
include/onnxruntime/ep/adapter/kernel_def_builder.h
include/onnxruntime/ep/adapter/kernel_registry.h
include/onnxruntime/ep/adapter/logging.h
include/onnxruntime/ep/adapter/node.h
include/onnxruntime/ep/adapter/op_kernel.h
include/onnxruntime/ep/adapter/op_kernel_info.h
include/onnxruntime/ep/adapter/tensor_helper.h
include/onnxruntime/ep/adapters.h
include/onnxruntime/ep/api.h
include/onnxruntime/ep/common.h
include/onnxruntime/ep/get_capability_utils.h