Repository navigation
Reintegrate ONNX 1.23.2 base plumbing - #33134
Conversation
Restore the reverted ONNX 1.23 integration and Float6 adapter mappings on current main. Align source, archive, vcpkg, CI and materialization pins with 1.23.1 and retain the released-opset 28 metadata workaround and regressions. Preserve subsequent free-threaded Python packaging support, repair vcpkg protobuf patch context, and derive equivalence-test version parity from the archive pin. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Split prior Cast registrations and preserve existing conversion type sets so CPU fallback casts and current-opset provider tests bind valid kernels. Keep FP6 conversion support deferred, add version-boundary regressions, remove resolved Cast backend exclusions, and update operator documentation. Isolate strict Python backend policy tests from CI's global permissive opset environment. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Define the DirectML Cast-28 version constant and regenerate the web operator table. Reject unsupported floating floor-Mod and CRD SpaceToDepth in QNN capability checks, with focused regression coverage preserving integer Mod and DCR support. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Opset-28 Mod remains incorrectly claimable by unverified providers, strict-policy coverage is disabled, and deprecated JSEP/WebGL backends are expanded.
Review effort: Balanced
Findings: 1
Open (6)
Cap non-CPU EPs or implement Mod-28 semantics · New Do not add Cast-28 support to deprecated JSEP · New Test session opt-out with unreleased opset 29 model · New Remove CPU BitShift opset-28 exclusions · New Child backend corpus disables strict released-opset validation · New Keep deprecated WebGL Cast support capped at opset 27 · New
What changed in this PR
Reintegrates ONNX 1.23.1 and opset 28 across dependency plumbing, runtime type mappings, providers, tests, and generated documentation.
Changes:
- Updates ONNX source, Python, vcpkg, and materialized-test pins.
- Adds opset-28 Cast, Mod, BitShift, FP6 mapping, and provider compatibility changes.
- Updates backend tests, filters, optimizers, patches, and operator documentation.
| File | Description |
|---|---|
tools/python/materialize_onnx_node_tests.py |
Tightens corpus validation |
tools/ci_build/test_build_args.py |
Tests backend-test environment |
tools/ci_build/github/windows/python/requirements.txt |
Pins ONNX 1.23.1 |
tools/ci_build/github/linux/python/requirements.txt |
Pins ONNX 1.23.1 |
tools/ci_build/github/linux/docker/scripts/requirements.txt |
Pins ONNX 1.23.1 |
tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt |
Pins ONNX 1.23.1 |
tools/ci_build/github/linux/docker/scripts/lort/requirements.txt |
Pins ONNX 1.23.1 |
tools/ci_build/github/linux/docker/inference/aarch64/python/cpu/scripts/requirements.txt |
Pins ONNX 1.23.1 |
tools/ci_build/github/linux/build_linux_python_package.sh |
Updates free-threaded note |
tools/ci_build/build.py |
Configures backend opset policy |
requirements-materialize-onnx-node-tests.txt |
Pins materializer ONNX |
onnxruntime/test/unittest_util/op_tester.cc |
Adds released ONNX import |
onnxruntime/test/unittest_util/graph_transform_test_builder.cc |
Updates load comments |
onnxruntime/test/testdata/onnx_backend_test_series_overrides.jsonc |
Relaxes attention tolerance |
onnxruntime/test/testdata/onnx_backend_test_series_filters.jsonc |
Adds opset-28 exclusions |
onnxruntime/test/python/transformers/test_moe_cuda.py |
Pins MoE model opset |
onnxruntime/test/python/transformers/test_cuda_plugin_ep.py |
Caps plugin opset |
onnxruntime/test/python/requirements.txt |
Pins ONNX 1.23.1 |
onnxruntime/test/python/onnxruntime_test_python_backend.py |
Tests backend loading behavior |
onnxruntime/test/python/onnx_node_test_equivalence_test.py |
Tightens version equivalence |
onnxruntime/test/python/onnx_backend_test_series.py |
Guards backend opset policy |
onnxruntime/test/providers/qnn/qnn_model_wrapper_test.cc |
Tests SpaceToDepth rejection |
onnxruntime/test/providers/qnn/mod_op_test.cc |
Tests QNN Mod fallback |
onnxruntime/test/providers/dml_onnx_tensor_wrapper_test.cc |
Updates malformed-tensor expectations |
onnxruntime/test/providers/cpu/tensor/compress_op.test.cc |
Pins Compress test opset |
onnxruntime/test/providers/cpu/tensor/cast_op_test.cc |
Adds Cast-28 coverage |
onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc |
Tests Mod and BitShift |
onnxruntime/test/providers/cpu/controlflow/scan_test.cc |
Updates ONNX errors |
onnxruntime/test/optimizer/qdq_transformer_test.cc |
Pins QDQ model opset |
onnxruntime/test/optimizer/layout_transformation_potentially_added_ops_test.cc |
Stages QDQ-28 exception |
onnxruntime/test/onnx/TestCase.cc |
Updates node-test exclusions |
onnxruntime/test/onnx/tensorprotoutils.cc |
Maps FP6 C types |
onnxruntime/test/onnx/main.cc |
Excludes one QNN case |
onnxruntime/test/framework/type_info_test.cc |
Tests FP6 mappings |
onnxruntime/test/framework/tensorutils_test.cc |
Tests FP6 sizes |
onnxruntime/python/backend/backend.py |
Propagates opset policy |
onnxruntime/python/backend/backend_rep.py |
Normalizes NumPy scalars |
onnxruntime/core/session/inference_session.cc |
Honors session opset policy |
onnxruntime/core/providers/webnn/builders/impl/qdq_op_builder.cc |
Caps QDQ at 27 |
onnxruntime/core/providers/webnn/builders/impl/base_op_builder.h |
Raises WebNN ceiling |
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc |
Splits Cast registration |
onnxruntime/core/providers/webgpu/compute_context.h |
Unifies logger accessor |
onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.h |
Raises VSINPU ceiling |
onnxruntime/core/providers/qnn/builder/opbuilder/simple_op_builder.cc |
Rejects SpaceToDepth CRD |
onnxruntime/core/providers/qnn/builder/opbuilder/mod_op_builder.cc |
Rejects floating floor Mod |
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/impl/quantizelinear_op_builder.cc |
Caps QuantizeLinear |
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/impl/dequantizelinear_op_builder.cc |
Caps DequantizeLinear |
onnxruntime/core/providers/nnapi/nnapi_builtin/builders/impl/base_op_builder.h |
Raises NNAPI ceiling |
onnxruntime/core/providers/js/operators/cast.cc |
Registers JSEP Cast-28 |
onnxruntime/core/providers/js/js_execution_provider.cc |
Registers JSEP kernel |
onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorVersions.h |
Defines Cast-28 version |
onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorRegistration.cpp |
Registers DML Cast-28 |
onnxruntime/core/providers/dml/DmlExecutionProvider/src/AbiCustomRegistry.cpp |
Caps DML BitShift |
onnxruntime/core/providers/cuda/tensor/cast_op.cc |
Splits CUDA Cast |
onnxruntime/core/providers/cuda/math/binary_elementwise_ops.cc |
Registers CUDA Mod-28 |
onnxruntime/core/providers/cuda/math/binary_elementwise_ops_impl.cu |
Instantiates floating Mod |
onnxruntime/core/providers/cuda/cuda_execution_provider.cc |
Registers CUDA kernels |
onnxruntime/core/providers/cuda/cu_inc/common.cuh |
Implements floating floor Mod |
onnxruntime/core/providers/cpu/tensor/cast_op.cc |
Splits CPU Cast |
onnxruntime/core/providers/cpu/math/element_wise_ops.cc |
Implements Mod and BitShift |
onnxruntime/core/providers/cpu/cpu_execution_provider.cc |
Registers CPU kernels |
onnxruntime/core/providers/coreml/builders/impl/base_op_builder.h |
Raises CoreML ceiling |
onnxruntime/core/optimizer/transpose_optimization/optimizer_api.h |
Raises optimizer ceiling |
onnxruntime/core/optimizer/pad_fusion.cc |
Accepts Cast-28 |
onnxruntime/core/optimizer/layer_norm_fusion.cc |
Accepts Cast-28 |
onnxruntime/core/optimizer/isinf_reducesum_fusion.cc |
Accepts Cast-28 |
onnxruntime/core/optimizer/fast_gelu_fusion.cc |
Accepts Cast-28 |
onnxruntime/core/optimizer/embed_layer_norm_fusion.cc |
Updates opset matchers |
onnxruntime/core/optimizer/attention_fusion_helper.h |
Accepts Cast-28 |
onnxruntime/core/framework/tensorprotoutils.h |
Adds FP6 element sizes |
onnxruntime/core/framework/tensorprotoutils.cc |
Maps FP6 element types |
onnxruntime/core/framework/tensor_type_and_shape.cc |
Converts FP6 types |
onnxruntime/core/framework/onnxruntime_map_type_info.h |
Extends enum bijection |
js/web/docs/webgpu-operators.md |
Documents WebGPU Cast-28 |
js/web/docs/webgl-operators.md |
Documents WebGL opset 28 |
include/onnxruntime/ep/adapter/tensor_helper.h |
Maps adapter FP6 types |
include/onnxruntime/core/session/onnxruntime_c_api.h |
Adds public FP6 enums |
include/onnxruntime/core/graph/schema_registry.h |
Matches ONNX signature |
docs/python/examples/plot_pipeline.py |
Replaces removed drawer API |
docs/OperatorKernels.md |
Regenerates kernel documentation |
csharp/test/Microsoft.ML.OnnxRuntime.Tests.NetCoreApp/InferenceTest.netcore.cs |
Enables uint16 BitShift tests |
cmake/vcpkg-ports/onnx/vcpkg.json |
Updates vcpkg version |
cmake/vcpkg-ports/onnx/portfile.cmake |
Updates archive and hash |
cmake/vcpkg-ports/onnx/fix-dependency-protobuf.patch |
Rebases protobuf patch |
cmake/vcpkg-ports/onnx/binskim.patch |
Rebases ONNX patch mirror |
cmake/patches/onnx/onnx.patch |
Patches ONNX 1.23.1 |
cmake/onnxruntime_unittests.cmake |
Tightens materialization setup |
cmake/deps.txt |
Pins ONNX source archive |
.github/workflows/linux_ci.yml |
Updates dependency comment |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Cap unverified Mod-28 graph-provider support, add an assignment-aware fallback regression, restore strict backend-corpus policy, exercise the per-session opt-out with unreleased opset29 passthrough graphs, and enable the implemented BitShift corpus cases. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Populate graph inputs and outputs before passing the serialized OpTester model to the session loader. Exercise the same serialization path with CPU in every build so missing graph resolution cannot be masked by unavailable optional providers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the shared tensor element conversion helper, retaining FP6 mappings and both sets of conversion tests. ONNX 1.23.1 already includes main's ONNX portability fixes, so keep the release-specific dependency patch without duplicate hunks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Run the CPU reference through OpTester so its Debug-only destructor guard recognizes that the test executed. Preserve the serialized-model checks for provider assignment and CPU fallback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
onnx 1.23.2 is released: https://pypi.org/project/onnx/#history. Please update to 1.23.2 |
There was a problem hiding this comment.
🟡 Changes recommended
SpaceToDepth-28 CRD can execute with legacy DCR kernels, and OpenVINO still advertises unsupported BitShift-28 semantics.
2 open findings
6 resolved since last review
Cap non-CPU EPs or implement Mod-28 semantics Child backend corpus disables strict released-opset validation Remove CPU BitShift opset-28 exclusions Test session opt-out with unreleased opset 29 model Do not add Cast-28 support to deprecated JSEP Keep deprecated WebGL Cast support capped at opset 27
🧠 Review effort: Balanced
Use the released opset metadata fix upstream and remove the redundant local schema patch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reject unverified provider semantics, expand SpaceToDepth-28 through its ONNX function, and preserve pre-28 fusion and native behavior. Check literal DCR/CRD outputs and provider routing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reuse shared wire-number conversion for INT2, UINT2, and FLOAT8E8M0 after the main merge. This fixes 34 native corpus failures without adding skips. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve configurable released-opset policy with main's ModelOptions initialization and retain shared ABI-safe tensor conversion alongside upstream node-runner fixes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Accept the exact SpaceToDepth native-kernel boundary before opset-28 function expansion and cover it with validator regressions. Keep external-buffer compilation and in-memory subgraph coverage in WASM without attempting unsupported host-filesystem external-data loads. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Copilot resolve the merge conflicts in this pull request |
…ess-check # Conflicts: # onnxruntime/test/framework/inference_session_test.cc Co-authored-by: gramalingam <10075881+gramalingam@users.noreply.github.com>
Merged the latest |
Ti-Tai Wang (titaiwangms)
left a comment
There was a problem hiding this comment.
Can you try to trigger that python package pipeline before we merging this in?
<details><summary>Claude's draft</summary> Replaces the port of the reverted microsoft/onnxruntime#32359 with a backport of its redo, microsoft/onnxruntime#33134 "Reintegrate ONNX 1.23.2 base plumbing", taken at its current head d9485f2a (open, CI green, one approval; not merged, so it may still change). Only the include/ and onnxruntime/ changes are taken, as before. They apply to 1.31.0 with patches 0001-0013 without fuzz except for two comment-only hunks in inference_session_test.cc, which are dropped. #33134 registers Cast for opset 28 itself, so the conda-forge kernel patch (0015) is regenerated on top of it without its Cast hunks; the other 14 type-only operators still need it. Its header is shortened. meta.yaml carries only the two-line comment for 0014. Resume this Claude session: ``` cd /home/mark/git/feedstock/onnxruntime-feedstock claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054 ``` </details> Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
<details><summary>Claude's draft</summary> On 1.31.0 the first graph_transform_test.cc hunk of microsoft/onnxruntime#33134 matched an identical lambda in SliceConcatToSpaceToDepthFusionWithPermutedBlockOrderTest, about 130 lines below its real target, because main has more tests ahead of it than 1.31.0. SliceConcatToSpaceToDepthFusionTest then ran at opset 28 without the branch that expects the fusion to be skipped and failed in a local linux-64 build: graph_transform_test.cc:7656: Failure Value of: op_to_count.count("Slice") == 0 || ... Move the block into the test upstream put it in. The other hunks that apply with a large offset (tensorprotoutils.cc, pad_fusion.cc) were checked and are in the right place. Resume this Claude session: ``` cd /home/mark/git/feedstock/onnxruntime-feedstock claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054 ``` </details> Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
<details><summary>Claude's draft</summary> The patch extended 14 existing CPU kernel registrations to opset 28 (QuantizeLinear, DequantizeLinear, Einsum, OneHot, DepthToSpace, Unique, Compress, Celu, ReverseSequence, ReduceLogSum, ReduceLogSumExp and the three Optional operators). Upstream has no equivalent change: its per-operator opset-28 work is in the open, currently stale pull requests microsoft/onnxruntime 32362, 32372, 32378, 32381 and 32393, and microsoft/onnxruntime#33134 only registers Cast, Mod and BitShift. Do not carry a feature upstream does not have. With this removed the package matches #33134: opset 28 is accepted, but a model using one of those operators at opset 28 fails at session creation with "Failed to find kernel", as it would with upstream. The protobuf link patch moves from 0016 to 0015. Resume this Claude session: ``` cd /home/mark/git/feedstock/onnxruntime-feedstock claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054 ``` </details> Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
<details><summary>Claude's draft</summary> Replaces the backport of microsoft/onnxruntime#33134 (float6 types, opset 28, new Cast/Mod/BitShift kernels; 75 files) with microsoft/onnxruntime#33259 "Fix builds with newer installed ONNX versions" at 9be45798 (open, not reviewed yet; 4 files, +27/-7). #33259 only relaxes the two compile-time checks that size their tables by TensorProto_DataType_DataType_ARRAYSIZE, so onnxruntime 1.31.0 compiles against libonnx 1.23.2 with the two float6 types treated as unsupported. It adds no feature upstream 1.31.0 does not have. It applies to 1.31.0 without changes. Consequence: onnxruntime keeps its 1.31.0 operator coverage. libonnx 1.23.2 reports opset 28 as released, so opset-28 models are accepted, but nodes whose schema was re-versioned in opset 28 (Cast, Mod, BitShift and 16 others) have no kernel and fail at session creation. Resume this Claude session: ``` cd /home/mark/git/feedstock/onnxruntime-feedstock claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054 ``` </details> Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
<details><summary>Claude's draft</summary> With only the build fix (microsoft/onnxruntime#33259), onnxruntime 1.31.0 compiles against libonnx 1.23.2 but 37 unit tests fail in a local linux-64 build. libonnx 1.23.2 reports opset 28 as released, tests that do not name an ai.onnx opset get 28, and 1.31.0 has no Cast kernel for it ("Failed to find kernel for Cast(28)", 35 times). Rather than skip them, add a test-only patch: * op_tester.cc: give test models an explicit ai.onnx opset of 27 when the test does not set one (CausalConvWithStateTest.*, MoETest.QMoETest_*). * GetCurrentOnnxOpset() in graph_transform_test.cc and graph_transform_test_layernorm.cc: cap at 27 (EmbedLayerNormFusionFormat{2,3}CurrentOpset). * Test updates taken from microsoft/onnxruntime#33134: layout_transformation_potentially_added_ops_test.cc (opset-28 Q/DQ exception), qdq_transformer_test.cc (pin to opset 25) and scan_test.cc (ONNX 1.23 shape-inference messages). 27 is what these tests run at upstream, where ONNX 1.22 is vendored. No library code changes. Resume this Claude session: ``` cd /home/mark/git/feedstock/onnxruntime-feedstock claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054 ``` </details> Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
<details><summary>Claude's draft</summary> The build-only fix (microsoft/onnxruntime#33259) left onnxruntime without kernels for the operators ONNX re-versioned in opset 28, so every test that builds a model at libonnx 1.23.2's default opset had to be pinned back to opset 27. The test-only patch covered the CPU suites, but the osx-arm64 jobs still failed in six CoreMLExecutionProviderTest cases with "Failed to find kernel for Cast(28)", and fixing those would have meant patching more test code than any upstream PR does. Go back to microsoft/onnxruntime#33134 (head d9485f2a, still open), which adds opset 28 and the Cast/Mod/BitShift 28 kernels along with the test updates, and drop both the #33259 patch and the test-only opset pin. The recipe is now identical to 423a84b, which built locally on linux-64 with only the machine-specific GroupQueryAttention test failing. Resume this Claude session: ``` cd /home/mark/git/feedstock/onnxruntime-feedstock claude --resume c16b7120-814d-4a38-9b1f-2afd9f75d054 ``` </details> Claude-Session: https://claude.ai/code/session_01XZa8BwzZpVJtREiCoVo1k6
|
cc Tianlei Wu (@tianleiwu) It says we need one more approval for copilot helping PR. |
PR #33134 added SpaceToDepthOpset28ModesAndProviderRouting with an expectation that opset 28 nodes expand via ONNX function expansion (EXPECT_FALSE(has_space_to_depth)), because native opset 28 kernels were intentionally deferred to this PR (#32362). Now that native opset 28 SpaceToDepth kernels are implemented for CPU and CUDA, update the test to assert that the node remains SpaceToDepth (EXPECT_TRUE), routes to CPU for CPUExecutionProvider, routes to CUDA for CUDAExecutionProvider, and falls back from DML to CPU for CRD mode while DCR routes to DML. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>



Description
Reintegrate the ONNX 1.23 base plumbing originally introduced by #32359 and reverted by #33073, now using ONNX 1.23.2.
Motivation and Context
This is a redo of #32359 after its rollback in #33073. ONNX 1.23.2 includes the external tensor read/re-save fix from onnx/onnx#8472 for onnx/onnx#8471 and the released-opset metadata fix from onnx/onnx#8544 for onnx/onnx#8529. The redundant local
LastReleaseVersionMappatch has been removed. Remaining FetchContent/vcpkg patches are byte-identical and apply against the pinned release.Scope: This PR establishes dependency/runtime base integration. Full per-operator opset-28 support remains separate follow-up work; see #32362, #32369, #32372, #32378, #32381, and #32393. These references describe staged scope, not a claim that every follow-up has landed or every opset-28 operator is supported. Runtime function expansion is a full-build fallback, not minimal/ORT-format runtime coverage.
Local validation
Completed on Windows with retained CPU-only Ninja/MSVC
RelWithDebInfobuilds and strict released-opset policy:onnxruntime_provider_test,onnxruntime_test_all,onnx_test_runner, and Python bindings against ONNX 1.23.2; retained build remains available for incremental work.--minimal_build extendedshared runtime configured, compiled, and linked successfully with ML/contrib ops and unit tests disabled. This exercisesONNX_MINIMAL_BUILD=ON; it is not a minimal-runtime function-op execution test.-m 1500collected 1,760 cases: 1,590 succeeded, 170 not implemented, zero failed, exit 0. These results do not establish complete opset-28 support.Remaining validation/infrastructure limits: GPU and other EP execution relies on CI; optional-provider routing checks are compiled into the relevant builds but were unavailable locally. Full unfiltered C++ suites and the ancillary broad
ALLtarget were not rerun. The oracle-dependent corpus equivalence test skips because upstream no longer ships the corpus. The new ONNX 1.23.2 tarball currently returns 404 from the Microsoft vcpkg asset mirror; it still needs Terrapin/infra seeding before read-onlyx-block-originvcpkg legs can download it. FetchContent and the successful minimal build are mirror-independent. New-head CI is pending.