Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
290b3ac
Integrate ONNX 1.22.0rc1 version plumbing (T1)
titaiwangms Jun 2, 2026
4902f14
T4: bump onnx pin 1.21.0 -> 1.22.0rc1 across CI requirements.txt files
titaiwangms Jun 2, 2026
4e50dbc
Enable ONNX opset 27 in ORT C++: bump transpose-optimizer max opset t…
titaiwangms Jun 2, 2026
a47e1a0
Add opset-27 ONNX backend test filters and regenerate webgl operator …
titaiwangms Jun 2, 2026
2a490c1
T6: opset-27 (ONNX 1.22) optimizer + EP guard updates for Range
titaiwangms Jun 2, 2026
69d665c
T6: add Range opset-27 to GatherToSlice fusion + opset-27 test
titaiwangms Jun 2, 2026
56f2642
T7: regenerate docs/OperatorKernels.md for opset-27 Range (ONNX 1.22.…
titaiwangms Jun 2, 2026
909aab2
Narrow opset-27 ONNX backend test filters: drop over-broad CausalConv…
titaiwangms Jun 2, 2026
1179812
review-polish A4: clarify opset-27 Range comment that fp16/bf16 model…
titaiwangms Jun 2, 2026
3f8fcee
review-polish: make GPU/CUDA/DML-unverified status explicit in opset-…
titaiwangms Jun 2, 2026
8b3fb0f
Add onnx-opset-bump-checklist skill doc
titaiwangms Jun 2, 2026
1c4a280
Bump CUDA Range kernel to opset 27 (mirror CPU)
titaiwangms Jun 2, 2026
a443299
onnx-opset-bump skill: encode 'bump ALL execution providers together'…
titaiwangms Jun 2, 2026
db5b7cd
Update FunctionTest cycle-rejection assertions for ONNX 1.22 checker …
titaiwangms Jun 3, 2026
38f1724
Fix opset-27 GatherToSliceFusion test on strict ALLOW_RELEASED_ONNX_O…
titaiwangms Jun 3, 2026
08dfd41
Filter unimplemented ONNX 1.22 FlexAttention + dtype-256 backend tests
titaiwangms Jun 3, 2026
f799965
Pin released opset in symlink-data test to avoid ONNX 1.22 opset-27 d…
titaiwangms Jun 3, 2026
745a725
Bump ONNX pin 1.22.0rc1 -> 1.22.0rc2; drop local Xcode workaround
titaiwangms Jun 9, 2026
94909dd
docs(skill): document x-block-origin 404 failure mode + per-RC re-mir…
titaiwangms Jun 9, 2026
fc54625
docs(skill): add CI 404 failure signature + consolidated fix options …
titaiwangms Jun 9, 2026
b506b9f
Conform ConvTranspose output_shape to ONNX spec (drop non-spec rank+2…
titaiwangms Jun 9, 2026
ad6358a
Fix second rc2 shape-inference regression in test_op_split.py
titaiwangms Jun 9, 2026
ddf721b
Handle rc2 backend conformance: skip expanded softcap-neginf attentio…
titaiwangms Jun 10, 2026
171a446
Fix WebGPU binary-elementwise broadcast shared-dim over-count underfl…
titaiwangms Jun 10, 2026
409a5e7
Un-skip expanded softcap-neginf Attention backend tests (#28969 fixed)
titaiwangms Jun 10, 2026
3f3f4fa
docs(skill): close 3 gaps in onnx-opset-bump-checklist (webgpu CI sco…
titaiwangms Jun 10, 2026
22303c1
docs(skill): add webgpu-local-testing skill for running WebGPU tests …
titaiwangms Jun 10, 2026
0a25d14
Bump pinned ONNX 1.22.0rc2 -> 1.22.0 (final release)
titaiwangms Jun 15, 2026
be80f73
Load current-opset fusion tests with allow_released_opsets_only=false
titaiwangms Jun 15, 2026
80674c1
Document opset-27 under-development test handling and bump gotchas
titaiwangms Jun 15, 2026
d00fd69
Code polish: named opset-allow constant + broadcast util doc/rename (…
titaiwangms Jun 16, 2026
db8d8bb
Drop dead leading opset 1 from Range fusion version lists (exec-12)
titaiwangms Jun 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
557 changes: 557 additions & 0 deletions .agents/skills/onnx-opset-bump-checklist/SKILL.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .agents/skills/ort-build/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ You do **not** need `--update` when only modifying existing `.cc`/`.h` files —
| `--build_wheel` | Build the Python wheel package |
| `--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. |
| `--target T` | Build a specific CMake target (requires `--build`; e.g., `onnxruntime_common`, `onnxruntime_test_all`) |
| `--use_webgpu` | Enable WebGPU EP. To run its tests locally on Linux without a GPU, see the `webgpu-local-testing` skill. |
| `--build_dir` | Build output directory |

## Build output path
Expand Down
1 change: 1 addition & 0 deletions .agents/skills/ort-test/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ Python test naming convention: `test_<method>_<expected_behavior>_[when_<conditi
- **Redirect test output to a file** (e.g., `> test_output.txt 2>&1`) — output can be large.
- For C++ tests, verify the build directory exists and a prior build completed before running.
- Use `--gtest_filter` to run a targeted subset when the full suite takes too long.
- **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.
111 changes: 111 additions & 0 deletions .agents/skills/webgpu-local-testing/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: webgpu-local-testing
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.
---

# Running ONNX Runtime WebGPU Tests Locally on Linux (No GPU)

Reusable knowledge for exercising the **WebGPU execution provider** on a Linux box
with no physical GPU.

> **Scope**: Linux ORT WebGPU only. macOS uses the Metal backend and a real GPU;
> this skill is the off-Mac story for running WebGPU EP kernels in CI-less dev loops.

## 1. Why software Vulkan is enough

On Linux, ORT's WebGPU EP runs on **Dawn** with the **Vulkan** backend. Vulkan does
not require a hardware GPU — **Mesa lavapipe** is a software (CPU) Vulkan adapter that
Dawn enumerates like any other device. For **EP correctness tests** this is sufficient
because:

- Many host-side validation paths (shape/broadcast checks, `ORT_ENFORCE`s) fire
**before** any shader is dispatched. E.g. the WebGPU broadcast `ORT_ENFORCE` runs
host-side, so the failure is observable on a software adapter without ever touching
the GPU.
- Element-wise and broadcasting kernels that do dispatch run correctly (if slowly) on
lavapipe, so their numeric output can be validated against the CPU reference.

You are trading speed for not needing hardware. It is **not** a substitute for a real
GPU on perf-sensitive or driver-specific paths — but for kernel correctness it is the
practical local loop.

> **Scope — what lavapipe can and cannot validate.** Software Vulkan covers (a)
> **host-side** failures (shape/broadcast `ORT_ENFORCE`s that fire *before* any shader
> dispatch) and (b) **MatMul-free** kernels that dispatch. It does **NOT** cover any
> graph that contains a **MatMul** — the MatMul family crashes lavapipe's LLVM JIT (see
> §5). This explicitly includes the motivating expanded-Attention node tests
> (`test_attention_4d_softcap_neginf_mask_expanded`): they decompose to
> `softmax(Q·Kᵀ + bias)·V`, which **contains MatMuls**, so they **cannot run on
> lavapipe**. For those, **macOS-arm64 Metal is the source of truth**. Concretely, the
> #28969 WebGPU broadcast-underflow fix was validated on lavapipe via a standalone
> Add-broadcast `OpTester` proxy (a host-side enforce/shape path) — **NOT** via the
> expanded-Attention node test. **Never** run lavapipe green and conclude an
> Attention/MatMul fix is validated off-Mac.

## 2. Install the software Vulkan stack (Azure Linux — use `dnf`, NOT `apt`)

```bash
dnf install -y mesa-vulkan-drivers vulkan-loader
# optional, for sanity-checking the adapter:
dnf install -y vulkan-tools && vulkaninfo | head
```

`mesa-vulkan-drivers` provides lavapipe; `vulkan-loader` provides the ICD loader.
The lavapipe ICD manifest lands at `/usr/share/vulkan/icd.d/lvp_icd.<arch>.json` —
`lvp_icd.x86_64.json` on x86_64, `lvp_icd.aarch64.json` on arm64. The examples below
use the x86_64 name; substitute your arch, or glob it:
`VK_ICD_FILENAMES=$(echo /usr/share/vulkan/icd.d/lvp_icd.*.json)`.

## 3. Build with `--use_webgpu`

```bash
./build.sh --config Release --parallel --use_webgpu
```

See the `ort-build` skill for general build phases and flags.

## 4. Run the WebGPU provider tests

WebGPU operator/kernel tests are **provider op tests** — they build into the
`onnxruntime_provider_test` target (**NOT** `onnxruntime_test_all`; see the `ort-test`
skill for the executable taxonomy). Point the Vulkan loader at the lavapipe ICD and
select a subset with `--gtest_filter`:

```bash
cd build/Linux/Release
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \
./onnxruntime_provider_test --gtest_filter="*WebGPU*"
```

`VK_ICD_FILENAMES` forces Vulkan to load **only** lavapipe, so the run is
deterministic regardless of what else is installed.

## 5. Gotcha: lavapipe crashes on the MatMul family

`MathOpTest.MatMulFloatType` (and other MatMul-family tests) crash lavapipe with:

```
LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations
```

This is a **pre-existing limitation of software Vulkan (Mesa lavapipe's LLVM JIT)**,
not an ORT bug. **Exclude the MatMul family** from broad lavapipe runs:

```bash
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \
./onnxruntime_provider_test --gtest_filter="*WebGPU*:-*MatMul*"
```

## 6. Why this matters: the Linux webgpu CI leg is build-only

The Linux webgpu CI leg (`py-linux-webgpu-stage.yml`) **only builds** — it does not run
WebGPU kernels. A green Linux webgpu leg therefore does **not** mean any WebGPU test
actually executed. The macOS-arm64 webgpu leg is the only CI leg that runs WebGPU
backend node tests. So a local lavapipe run is the practical way to **actually exercise
WebGPU kernels off-Mac** before you push.

But mind the §1 scope: lavapipe covers host-side enforce/shape paths and **MatMul-free**
kernels only. Any **MatMul-containing** graph — including the expanded-Attention node
tests (`test_attention_4d_softcap_neginf_mask_expanded`) — crashes lavapipe and runs
**only** on the macOS-arm64 Metal leg, which is the source of truth for those. A green
lavapipe run never validates a MatMul/Attention fix off-Mac.
5 changes: 4 additions & 1 deletion cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ microsoft_gsl;https://github.com/microsoft/GSL/archive/refs/tags/v4.2.1.zip;1094
microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.250325.1.zip;826c8bd47c2258ec61b8b218e031e5b33d27f761
mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.1.1.zip;d5ee7d34223d0567892db5179849939c8769dc41
mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.82.0.zip;9bc9e01dffb64d9e0773b2e44d2f22c51aace063
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.21.0.zip;321d4acc807c8e0fb0bbcc0424a143dffde1e846
# ONNX pinned to the 1.22.0 final release (tag v1.22.0). rc2->final changed only CI
# workflow yml + VERSION_NUMBER (no operator-schema, opset, or testdata change), so it is
# pure version plumbing. The 7 CI requirements.txt files are pinned to onnx==1.22.0 (now on PyPI).
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.22.0.zip;2b2cd58ac7a26df5371266149e0c76776330cdf1
# Use the latest commit of 10.9-GA
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/d5dce67db7c2e64b07e055571f5ec06f7f254de2.zip;01114d3b67650857281fa50faa2e412130a63b69
protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.12.zip;7cf2733949036c7d52fda017badcab093fe73bfa
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/onnx
Submodule onnx updated 978 files
76 changes: 20 additions & 56 deletions cmake/patches/onnx/onnx.patch
Original file line number Diff line number Diff line change
@@ -1,80 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 044996e..ded7e39 100644
index 791e24b..5f861a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
@@ -46,6 +46,7 @@ option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for ONNX operator schemas." OFF)
option(ONNX_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF)
option(ONNX_PYODIDE_BUILD "Build ONNX for Pyodide/Emscripten (wasm32)." OFF)
+option(ONNX_MINIMAL_BUILD "Build only essential ONNX components" OFF)
option(ONNX_INSTALL "Install ONNX targets, headers, and CMake config files" ON)
if(WIN32)
option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime" OFF)
@@ -399,14 +400,28 @@ relative_protobuf_generate_cpp(ONNX_PROTO_SRCS
onnx/onnx-operators.in.proto
onnx/onnx-data.in.proto)

-file(GLOB_RECURSE __tmp_srcs "${ONNX_ROOT}/onnx/*.h" "${ONNX_ROOT}/onnx/*.cc")
-file(GLOB_RECURSE onnx_gtests_src "${ONNX_ROOT}/onnx/test/cpp/*.h"
- "${ONNX_ROOT}/onnx/test/cpp/*.cc"
- "${ONNX_ROOT}/onnx/backend/test/cpp/*.cc"
- "${ONNX_ROOT}/onnx/backend/test/cpp/*.h")
-list(REMOVE_ITEM __tmp_srcs "${ONNX_ROOT}/onnx/cpp2py_export.cc")
-list(REMOVE_ITEM __tmp_srcs ${onnx_gtests_src} "${ONNX_ROOT}/onnx/test/cmake/main.cc")
-list(APPEND ONNX_SRCS ${__tmp_srcs})
option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime. Ignored if CMAKE_MSVC_RUNTIME_LIBRARY is defined." OFF)
@@ -515,7 +516,22 @@ add_dependencies(onnx_proto onnx_proto_gen)
# Core library. Hand-written sources come from target_sources(onnx ...) in the
# subdirectories; the protobuf objects are pulled in from onnx_proto.
add_library(onnx $<TARGET_OBJECTS:onnx_proto>)
-add_subdirectory(onnx)
+if(ONNX_MINIMAL_BUILD)
+ message(STATUS "Configuring ONNX minimal build")
+ set(ONNX_SRCS
+ "${ONNX_ROOT}/onnx/common/common.h"
+ "${ONNX_ROOT}/onnx/defs/data_type_utils.h"
+ "${ONNX_ROOT}/onnx/defs/data_type_utils.cc"
+ # ORT's minimal/WebAssembly builds only need ONNX's type utilities and the
+ # generated protobuf sources (linked via onnx_proto above); skip pulling in
+ # the full operator/schema sources via add_subdirectory(onnx).
+ target_sources(onnx PRIVATE
+ "${ONNX_ROOT}/onnx/defs/data_type_utils.cc"
+ )
+ # Ensure ONNX_ML is treated as ON for minimal build consistency with ORT's file
+ set(ONNX_ML ON CACHE BOOL "Enable traditional ML API." FORCE)
+ # Minimal build doesn't need Python or tests
+ set(ONNX_BUILD_PYTHON OFF CACHE BOOL "Build Python binaries" FORCE)
+ set(ONNX_BUILD_TESTS OFF CACHE BOOL "Build ONNX C++ APIs Tests" FORCE)
+else()
+ file(GLOB_RECURSE __tmp_srcs "${ONNX_ROOT}/onnx/*.h" "${ONNX_ROOT}/onnx/*.cc")
+ file(GLOB_RECURSE onnx_gtests_src "${ONNX_ROOT}/onnx/test/cpp/*.h"
+ "${ONNX_ROOT}/onnx/test/cpp/*.cc"
+ "${ONNX_ROOT}/onnx/backend/test/cpp/*.cc"
+ "${ONNX_ROOT}/onnx/backend/test/cpp/*.h")
+ list(REMOVE_ITEM __tmp_srcs "${ONNX_ROOT}/onnx/cpp2py_export.cc")
+ list(REMOVE_ITEM __tmp_srcs ${onnx_gtests_src} "${ONNX_ROOT}/onnx/test/cmake/main.cc")
+ list(APPEND ONNX_SRCS ${__tmp_srcs})
+ add_subdirectory(onnx)
+endif()

set(LINKED_PROTOBUF_TARGET protobuf::libprotobuf)
if(ONNX_USE_LITE_PROTO)
diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake
index 1987edd..04b3088 100644
--- a/cmake/Utils.cmake
+++ b/cmake/Utils.cmake
@@ -103,18 +103,7 @@ endfunction()

function(add_onnx_compile_options target)
if(MSVC)
- # For disabling Protobuf related warnings
- set(protobuf_warnings
- /wd4146 # unary minus operator applied to unsigned type, result still
- # unsigned
- /wd4244 # 'argument': conversion from 'google::protobuf::uint64' to
- # 'int', possible loss of data
- /wd4267 # Conversion from 'size_t' to 'int', possible loss of data
- /wd4141 # 'inline': used more than once
- /wd4047 # '=': 'uintptr_t' differs in levels of indirection from 'void *'
- )
add_msvc_runtime_flag(${target})
- target_compile_options(${target} PUBLIC ${protobuf_warnings})
if(ONNX_WERROR)
target_compile_options(${target} PRIVATE "/WX")
endif()
add_dependencies(onnx onnx_proto)
set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)
add_onnx_global_defines(onnx)
diff --git a/onnx/defs/nn/old.cc b/onnx/defs/nn/old.cc
index a6a8a83..153da87 100644
index 3887169..8432613 100644
--- a/onnx/defs/nn/old.cc
+++ b/onnx/defs/nn/old.cc
@@ -4026,7 +4026,6 @@ ONNX_OPERATOR_SET_SCHEMA(
@@ -4078,7 +4078,6 @@ ONNX_OPERATOR_SET_SCHEMA(
GroupNormalization,
18,
OpSchema()
Expand Down
76 changes: 20 additions & 56 deletions cmake/vcpkg-ports/onnx/binskim.patch
Original file line number Diff line number Diff line change
@@ -1,80 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 044996e..ded7e39 100644
index 791e24b..5f861a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,7 @@ option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
@@ -46,6 +46,7 @@ option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for ONNX operator schemas." OFF)
option(ONNX_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF)
option(ONNX_PYODIDE_BUILD "Build ONNX for Pyodide/Emscripten (wasm32)." OFF)
+option(ONNX_MINIMAL_BUILD "Build only essential ONNX components" OFF)
option(ONNX_INSTALL "Install ONNX targets, headers, and CMake config files" ON)
if(WIN32)
option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime" OFF)
@@ -399,14 +400,28 @@ relative_protobuf_generate_cpp(ONNX_PROTO_SRCS
onnx/onnx-operators.in.proto
onnx/onnx-data.in.proto)

-file(GLOB_RECURSE __tmp_srcs "${ONNX_ROOT}/onnx/*.h" "${ONNX_ROOT}/onnx/*.cc")
-file(GLOB_RECURSE onnx_gtests_src "${ONNX_ROOT}/onnx/test/cpp/*.h"
- "${ONNX_ROOT}/onnx/test/cpp/*.cc"
- "${ONNX_ROOT}/onnx/backend/test/cpp/*.cc"
- "${ONNX_ROOT}/onnx/backend/test/cpp/*.h")
-list(REMOVE_ITEM __tmp_srcs "${ONNX_ROOT}/onnx/cpp2py_export.cc")
-list(REMOVE_ITEM __tmp_srcs ${onnx_gtests_src} "${ONNX_ROOT}/onnx/test/cmake/main.cc")
-list(APPEND ONNX_SRCS ${__tmp_srcs})
option(ONNX_USE_MSVC_STATIC_RUNTIME "Build with MSVC static runtime. Ignored if CMAKE_MSVC_RUNTIME_LIBRARY is defined." OFF)
@@ -515,7 +516,22 @@ add_dependencies(onnx_proto onnx_proto_gen)
# Core library. Hand-written sources come from target_sources(onnx ...) in the
# subdirectories; the protobuf objects are pulled in from onnx_proto.
add_library(onnx $<TARGET_OBJECTS:onnx_proto>)
-add_subdirectory(onnx)
+if(ONNX_MINIMAL_BUILD)
+ message(STATUS "Configuring ONNX minimal build")
+ set(ONNX_SRCS
+ "${ONNX_ROOT}/onnx/common/common.h"
+ "${ONNX_ROOT}/onnx/defs/data_type_utils.h"
+ "${ONNX_ROOT}/onnx/defs/data_type_utils.cc"
+ # ORT's minimal/WebAssembly builds only need ONNX's type utilities and the
+ # generated protobuf sources (linked via onnx_proto above); skip pulling in
+ # the full operator/schema sources via add_subdirectory(onnx).
+ target_sources(onnx PRIVATE
+ "${ONNX_ROOT}/onnx/defs/data_type_utils.cc"
+ )
+ # Ensure ONNX_ML is treated as ON for minimal build consistency with ORT's file
+ set(ONNX_ML ON CACHE BOOL "Enable traditional ML API." FORCE)
+ # Minimal build doesn't need Python or tests
+ set(ONNX_BUILD_PYTHON OFF CACHE BOOL "Build Python binaries" FORCE)
+ set(ONNX_BUILD_TESTS OFF CACHE BOOL "Build ONNX C++ APIs Tests" FORCE)
+else()
+ file(GLOB_RECURSE __tmp_srcs "${ONNX_ROOT}/onnx/*.h" "${ONNX_ROOT}/onnx/*.cc")
+ file(GLOB_RECURSE onnx_gtests_src "${ONNX_ROOT}/onnx/test/cpp/*.h"
+ "${ONNX_ROOT}/onnx/test/cpp/*.cc"
+ "${ONNX_ROOT}/onnx/backend/test/cpp/*.cc"
+ "${ONNX_ROOT}/onnx/backend/test/cpp/*.h")
+ list(REMOVE_ITEM __tmp_srcs "${ONNX_ROOT}/onnx/cpp2py_export.cc")
+ list(REMOVE_ITEM __tmp_srcs ${onnx_gtests_src} "${ONNX_ROOT}/onnx/test/cmake/main.cc")
+ list(APPEND ONNX_SRCS ${__tmp_srcs})
+ add_subdirectory(onnx)
+endif()

set(LINKED_PROTOBUF_TARGET protobuf::libprotobuf)
if(ONNX_USE_LITE_PROTO)
diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake
index 1987edd..04b3088 100644
--- a/cmake/Utils.cmake
+++ b/cmake/Utils.cmake
@@ -103,18 +103,7 @@ endfunction()

function(add_onnx_compile_options target)
if(MSVC)
- # For disabling Protobuf related warnings
- set(protobuf_warnings
- /wd4146 # unary minus operator applied to unsigned type, result still
- # unsigned
- /wd4244 # 'argument': conversion from 'google::protobuf::uint64' to
- # 'int', possible loss of data
- /wd4267 # Conversion from 'size_t' to 'int', possible loss of data
- /wd4141 # 'inline': used more than once
- /wd4047 # '=': 'uintptr_t' differs in levels of indirection from 'void *'
- )
add_msvc_runtime_flag(${target})
- target_compile_options(${target} PUBLIC ${protobuf_warnings})
if(ONNX_WERROR)
target_compile_options(${target} PRIVATE "/WX")
endif()
add_dependencies(onnx onnx_proto)
set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)
add_onnx_global_defines(onnx)
diff --git a/onnx/defs/nn/old.cc b/onnx/defs/nn/old.cc
index a6a8a83..153da87 100644
index 3887169..8432613 100644
--- a/onnx/defs/nn/old.cc
+++ b/onnx/defs/nn/old.cc
@@ -4026,7 +4026,6 @@ ONNX_OPERATOR_SET_SCHEMA(
@@ -4078,7 +4078,6 @@ ONNX_OPERATOR_SET_SCHEMA(
GroupNormalization,
18,
OpSchema()
Expand Down
4 changes: 2 additions & 2 deletions cmake/vcpkg-ports/onnx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO onnx/onnx
REF "v${VERSION}"
SHA512 3cee4c0fbc9e260e360a62a59e324e0b127a5749f958e0704989b407a4c1179c637ef86e41a406e7868537a62a11a821e3433005eb0725f979145f8d514926bd
REF "v1.22.0"
SHA512 13fafff073a8e0bcf67fd06195da979c3c6273b3f5fdd25f5e5c39ad6af20eefe107f13dc73d52b6021e986d87401e46121e00bba8fbd09f098334e34f78462f
PATCHES
fix-cmakelists.patch
fix-dependency-protobuf.patch
Expand Down
2 changes: 1 addition & 1 deletion cmake/vcpkg-ports/onnx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onnx",
"version-semver": "1.21.0",
"version-semver": "1.22.0",
"port-version": 0,
"description": "Open standard for machine learning interoperability",
"homepage": "https://onnx.ai",
Expand Down
Loading
Loading