Skip to content

Commit 2bd1e14

Browse files
committed
Merge branch 'main' into adjust-subgroup-kernel-args
2 parents d6f2f3e + 57f6079 commit 2bd1e14

548 files changed

Lines changed: 34516 additions & 4613 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/onnx-opset-bump-checklist/SKILL.md

Lines changed: 557 additions & 0 deletions
Large diffs are not rendered by default.

.agents/skills/ort-build/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ You do **not** need `--update` when only modifying existing `.cc`/`.h` files —
6565
| `--build_wheel` | Build the Python wheel package |
6666
| `--use_cuda` | Enable CUDA EP. Requires `--cuda_home`/`--cudnn_home` or `CUDA_HOME`/`CUDNN_HOME` env vars. On Windows, only `cuda_home`/`CUDA_HOME` is validated. |
6767
| `--target T` | Build a specific CMake target (requires `--build`; e.g., `onnxruntime_common`, `onnxruntime_test_all`) |
68+
| `--use_webgpu` | Enable WebGPU EP. To run its tests locally on Linux without a GPU, see the `webgpu-local-testing` skill. |
6869
| `--build_dir` | Build output directory |
6970

7071
## Build output path

.agents/skills/ort-test/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ Python test naming convention: `test_<method>_<expected_behavior>_[when_<conditi
7979
- **Redirect test output to a file** (e.g., `> test_output.txt 2>&1`) — output can be large.
8080
- For C++ tests, verify the build directory exists and a prior build completed before running.
8181
- Use `--gtest_filter` to run a targeted subset when the full suite takes too long.
82+
- **Running WebGPU tests locally on Linux without a GPU** — WebGPU op tests build into `onnxruntime_provider_test` and can run against a software Vulkan adapter (Mesa lavapipe). See the `webgpu-local-testing` skill.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
name: webgpu-local-testing
3+
description: Build and run ONNX Runtime WebGPU provider tests on Linux WITHOUT a real GPU, using a software Vulkan adapter (Mesa lavapipe). Use when you need to exercise WebGPU EP kernels off-Mac — the Linux webgpu CI leg is build-only, so software Vulkan is how you actually run WebGPU correctness tests locally. SCOPE: lavapipe only validates host-side enforce/shape bugs and MatMul-free kernels; any graph containing MatMul (including the expanded-Attention node tests) crashes lavapipe and runs ONLY on macOS-arm64 Metal, which is the source of truth for those. Covers install (dnf on Azure Linux), the --use_webgpu build flag, the onnxruntime_provider_test target, VK_ICD_FILENAMES, and the lavapipe MatMul crash gotcha.
4+
---
5+
6+
# Running ONNX Runtime WebGPU Tests Locally on Linux (No GPU)
7+
8+
Reusable knowledge for exercising the **WebGPU execution provider** on a Linux box
9+
with no physical GPU.
10+
11+
> **Scope**: Linux ORT WebGPU only. macOS uses the Metal backend and a real GPU;
12+
> this skill is the off-Mac story for running WebGPU EP kernels in CI-less dev loops.
13+
14+
## 1. Why software Vulkan is enough
15+
16+
On Linux, ORT's WebGPU EP runs on **Dawn** with the **Vulkan** backend. Vulkan does
17+
not require a hardware GPU — **Mesa lavapipe** is a software (CPU) Vulkan adapter that
18+
Dawn enumerates like any other device. For **EP correctness tests** this is sufficient
19+
because:
20+
21+
- Many host-side validation paths (shape/broadcast checks, `ORT_ENFORCE`s) fire
22+
**before** any shader is dispatched. E.g. the WebGPU broadcast `ORT_ENFORCE` runs
23+
host-side, so the failure is observable on a software adapter without ever touching
24+
the GPU.
25+
- Element-wise and broadcasting kernels that do dispatch run correctly (if slowly) on
26+
lavapipe, so their numeric output can be validated against the CPU reference.
27+
28+
You are trading speed for not needing hardware. It is **not** a substitute for a real
29+
GPU on perf-sensitive or driver-specific paths — but for kernel correctness it is the
30+
practical local loop.
31+
32+
> **Scope — what lavapipe can and cannot validate.** Software Vulkan covers (a)
33+
> **host-side** failures (shape/broadcast `ORT_ENFORCE`s that fire *before* any shader
34+
> dispatch) and (b) **MatMul-free** kernels that dispatch. It does **NOT** cover any
35+
> graph that contains a **MatMul** — the MatMul family crashes lavapipe's LLVM JIT (see
36+
> §5). This explicitly includes the motivating expanded-Attention node tests
37+
> (`test_attention_4d_softcap_neginf_mask_expanded`): they decompose to
38+
> `softmax(Q·Kᵀ + bias)·V`, which **contains MatMuls**, so they **cannot run on
39+
> lavapipe**. For those, **macOS-arm64 Metal is the source of truth**. Concretely, the
40+
> #28969 WebGPU broadcast-underflow fix was validated on lavapipe via a standalone
41+
> Add-broadcast `OpTester` proxy (a host-side enforce/shape path) — **NOT** via the
42+
> expanded-Attention node test. **Never** run lavapipe green and conclude an
43+
> Attention/MatMul fix is validated off-Mac.
44+
45+
## 2. Install the software Vulkan stack (Azure Linux — use `dnf`, NOT `apt`)
46+
47+
```bash
48+
dnf install -y mesa-vulkan-drivers vulkan-loader
49+
# optional, for sanity-checking the adapter:
50+
dnf install -y vulkan-tools && vulkaninfo | head
51+
```
52+
53+
`mesa-vulkan-drivers` provides lavapipe; `vulkan-loader` provides the ICD loader.
54+
The lavapipe ICD manifest lands at `/usr/share/vulkan/icd.d/lvp_icd.<arch>.json`
55+
`lvp_icd.x86_64.json` on x86_64, `lvp_icd.aarch64.json` on arm64. The examples below
56+
use the x86_64 name; substitute your arch, or glob it:
57+
`VK_ICD_FILENAMES=$(echo /usr/share/vulkan/icd.d/lvp_icd.*.json)`.
58+
59+
## 3. Build with `--use_webgpu`
60+
61+
```bash
62+
./build.sh --config Release --parallel --use_webgpu
63+
```
64+
65+
See the `ort-build` skill for general build phases and flags.
66+
67+
## 4. Run the WebGPU provider tests
68+
69+
WebGPU operator/kernel tests are **provider op tests** — they build into the
70+
`onnxruntime_provider_test` target (**NOT** `onnxruntime_test_all`; see the `ort-test`
71+
skill for the executable taxonomy). Point the Vulkan loader at the lavapipe ICD and
72+
select a subset with `--gtest_filter`:
73+
74+
```bash
75+
cd build/Linux/Release
76+
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \
77+
./onnxruntime_provider_test --gtest_filter="*WebGPU*"
78+
```
79+
80+
`VK_ICD_FILENAMES` forces Vulkan to load **only** lavapipe, so the run is
81+
deterministic regardless of what else is installed.
82+
83+
## 5. Gotcha: lavapipe crashes on the MatMul family
84+
85+
`MathOpTest.MatMulFloatType` (and other MatMul-family tests) crash lavapipe with:
86+
87+
```
88+
LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations
89+
```
90+
91+
This is a **pre-existing limitation of software Vulkan (Mesa lavapipe's LLVM JIT)**,
92+
not an ORT bug. **Exclude the MatMul family** from broad lavapipe runs:
93+
94+
```bash
95+
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \
96+
./onnxruntime_provider_test --gtest_filter="*WebGPU*:-*MatMul*"
97+
```
98+
99+
## 6. Why this matters: the Linux webgpu CI leg is build-only
100+
101+
The Linux webgpu CI leg (`py-linux-webgpu-stage.yml`) **only builds** — it does not run
102+
WebGPU kernels. A green Linux webgpu leg therefore does **not** mean any WebGPU test
103+
actually executed. The macOS-arm64 webgpu leg is the only CI leg that runs WebGPU
104+
backend node tests. So a local lavapipe run is the practical way to **actually exercise
105+
WebGPU kernels off-Mac** before you push.
106+
107+
But mind the §1 scope: lavapipe covers host-side enforce/shape paths and **MatMul-free**
108+
kernels only. Any **MatMul-containing** graph — including the expanded-Attention node
109+
tests (`test_attention_4d_softcap_neginf_mask_expanded`) — crashes lavapipe and runs
110+
**only** on the macOS-arm64 Metal leg, which is the source of truth for those. A green
111+
lavapipe run never validates a MatMul/Attention fix off-Mac.

.github/copilot-instructions.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copilot Instructions for ONNX Runtime
2+
3+
For detailed codebase conventions, architecture, and coding standards, see [AGENTS.md](../AGENTS.md).
4+
5+
## Code Review
6+
7+
### No C API Version Bump Needed for API Additions
8+
9+
`ORT_API_VERSION`, the `ort_api_1_to_N` function pointer table, and the version-boundary `static_assert` checks in
10+
`onnxruntime/core/session/onnxruntime_c_api.cc` are updated only during release preparation — not each time a new API
11+
is added. See [`docs/Versioning.md`](../docs/Versioning.md) for the full release versioning process.
12+
13+
During development, new API function pointers are appended to the **current** `ort_api_1_to_N` table. This is the
14+
expected workflow and does **not** require a version bump, a new table, or new `static_assert` entries. Do not flag
15+
PRs that append new function pointers to the current table as needing a version bump.

.github/workflows/windows_webgpu.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ jobs:
197197
--cmake_generator "Visual Studio 17 2022" `
198198
--enable_onnx_tests `
199199
--use_webgpu shared_lib `
200-
--wgsl_template static `
201200
--use_vcpkg --use_vcpkg_ms_internal_asset_cache `
202201
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=ON onnxruntime_ENABLE_DAWN_BACKEND_D3D12=1 onnxruntime_ENABLE_DAWN_BACKEND_VULKAN=1 `
203202
--disable_rtti `

.lintrunner.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ exclude_patterns = [
116116
'winml/lib/Api.Image/shaders/**', # Contains data chunks
117117
'onnxruntime/contrib_ops/cuda/bert/flash_attention/flash_fwd_launch_template.h', # Bool Switches hang Clang
118118
'onnxruntime/core/providers/coreml/mlprogram_test_scripts/**', # test scripts only
119+
'tools/python/wgsl_template/test/testcases/**', # Generated golden fixtures; must match tool output byte-for-byte
120+
'tools/python/wgsl_template/test/in_tree_golden/**', # Generated golden snapshots; must match tool output byte-for-byte
119121
]
120122
command = [
121123
'python',

VERSION_NUMBER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.27.0
1+
1.28.0

cmake/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ option(onnxruntime_USE_XNNPACK "Build with XNNPACK support. Provides an alternat
149149
option(onnxruntime_USE_WEBNN "Build with WebNN support. Enable hardware acceleration in web browsers." OFF)
150150
option(onnxruntime_USE_WEBGPU "Build with WebGPU support. Enable WebGPU via C/C++ interface." OFF)
151151
option(onnxruntime_USE_EP_API_ADAPTERS "Build EP (e.g. WebGPU) as a plugin EP shared library using EP API adapters" OFF)
152-
option(onnxruntime_WGSL_TEMPLATE "Specify the code generator for WGSL template. Default is static." "static")
153152
option(onnxruntime_USE_EXTERNAL_DAWN "Build with treating Dawn as external dependency. Will not link Dawn at build time." OFF)
154153
option(onnxruntime_CUSTOM_DAWN_SRC_PATH "Path to custom Dawn src dir.")
155154
option(onnxruntime_BUILD_DAWN_SHARED_LIBRARY "Build Dawn as a shared library" OFF)
@@ -675,11 +674,17 @@ else()
675674
if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND onnxruntime_target_platform STREQUAL "aarch64")
676675
check_cxx_compiler_flag(-march=armv8.2-a+bf16 HAS_ARM64_BFLOAT16)
677676
if(NOT HAS_ARM64_BFLOAT16)
678-
message(FATAL_ERROR "The compiler doesn't support BFLOAT16!!!")
677+
message(FATAL_ERROR "The compiler/assembler does not support the aarch64 +bf16 ISA extension. "
678+
"On aarch64 this typically requires GCC >= 12 paired with a sufficiently recent binutils "
679+
"(the capability is gated by the assembler, not the compiler alone). "
680+
"See https://github.com/microsoft/onnxruntime/issues/22837 for details.")
679681
endif()
680682
check_cxx_compiler_flag(-march=armv8.2-a+fp16 HAS_ARM64_FLOAT16)
681683
if(NOT HAS_ARM64_FLOAT16)
682-
message(FATAL_ERROR "The compiler doesn't support FLOAT16!!!")
684+
message(FATAL_ERROR "The compiler/assembler does not support the aarch64 +fp16 ISA extension. "
685+
"On aarch64 this typically requires GCC >= 12 paired with a sufficiently recent binutils "
686+
"(the capability is gated by the assembler, not the compiler alone). "
687+
"See https://github.com/microsoft/onnxruntime/issues/22837 for details.")
683688
endif()
684689
endif()
685690

cmake/deps.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ microsoft_gsl;https://github.com/microsoft/GSL/archive/refs/tags/v4.2.1.zip;1094
3434
microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.250325.1.zip;826c8bd47c2258ec61b8b218e031e5b33d27f761
3535
mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.1.1.zip;d5ee7d34223d0567892db5179849939c8769dc41
3636
mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.82.0.zip;9bc9e01dffb64d9e0773b2e44d2f22c51aace063
37-
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.21.0.zip;321d4acc807c8e0fb0bbcc0424a143dffde1e846
37+
# ONNX pinned to the 1.22.0 final release (tag v1.22.0). rc2->final changed only CI
38+
# workflow yml + VERSION_NUMBER (no operator-schema, opset, or testdata change), so it is
39+
# pure version plumbing. The 7 CI requirements.txt files are pinned to onnx==1.22.0 (now on PyPI).
40+
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.22.0.zip;2b2cd58ac7a26df5371266149e0c76776330cdf1
3841
# Use the latest commit of 10.9-GA
3942
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/d5dce67db7c2e64b07e055571f5ec06f7f254de2.zip;01114d3b67650857281fa50faa2e412130a63b69
4043
protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.12.zip;7cf2733949036c7d52fda017badcab093fe73bfa
@@ -54,11 +57,12 @@ tensorboard;https://github.com/tensorflow/tensorboard/archive/373eb09e4c5d2b3cc2
5457
cutlass;https://github.com/NVIDIA/cutlass/archive/refs/tags/v4.4.2.zip;4b0bae4428b84370407c0a71778b13dc2eee5be1
5558
extensions;https://github.com/microsoft/onnxruntime-extensions/archive/c24b7bab0c12f53da76d0c31b03b9f0f8ec8f3b4.zip;239063aee4946a9af147b473a4c3da78ba7413b4
5659
directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e
57-
cudnn_frontend;https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v1.12.0.zip;7e733cfdc410d777b76122d64232499205589a96
60+
cudnn_frontend;https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v1.24.0.zip;a55a1980bf5c57692d66ae7bc3b39798f5535e1f
5861
dawn;https://github.com/google/dawn/archive/ec7b457e5bb1fcec6f59733c4f3dd84d2f885a38.zip;d4d64d1729104b61e654073566f1a376e16cad92
5962
kleidiai;https://github.com/ARM-software/kleidiai/archive/refs/tags/v1.20.0.tar.gz;6895e72b3d5cf1173358164cb3d64c9d7d33cc84
6063
# kleidiai-qmx is pinned to a specific commit as there are no tagged releases. When an appropriate tagged release becomes available,
6164
# this entry will be updated to use refs/tags/<version> instead of the raw commit hash.
6265
kleidiai-qmx;https://github.com/qualcomm/kleidiai/archive/2f10c9a8d32f81ffeeb6d4885a29cc35d2b0da87.zip;5e855730a2d69057a569f43dd7532db3b2d2a05c
66+
# TODO(danielsongmicrosoft): Remove duktape once the dynamic WGSL generator is deleted; it is no longer used by any active build path.
6367
duktape;https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz;8200c8e417dbab7adcc12c4dbdef7651cfc55794
6468
vulkan_headers;https://codeload.github.com/KhronosGroup/Vulkan-Headers/tar.gz/refs/tags/v1.4.344;57bc528ef7c4a3f7bfbb59e64a187e3734bd29d8

0 commit comments

Comments
 (0)