From 3096be6defa36b7867b177cd9c8fd3900806fdb4 Mon Sep 17 00:00:00 2001 From: "riseproject-dev[bot]" <330740410+riseproject-dev[bot]@users.noreply.github.com> Date: Fri, 9 Oct 2026 08:52:18 +0000 Subject: [PATCH 1/3] onnxsim: Add version 0.8.1 Signed-off-by: riseproject-dev[bot] <330740410+riseproject-dev[bot]@users.noreply.github.com> --- docs/packages/onnxsim.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/packages/onnxsim.yaml b/docs/packages/onnxsim.yaml index 94fc399b58d..8d4d49ce9c2 100644 --- a/docs/packages/onnxsim.yaml +++ b/docs/packages/onnxsim.yaml @@ -23,3 +23,4 @@ versions: - filename: onnxsim-0.7.3-cp312-abi3-manylinux_2_39_riscv64.whl sha256: 630922bc5ff479b7616d602f3a8dc9d2bdf749096413be6990ce5e66cf89cfe7 requires-python: '>=3.10' +- version: 0.8.1 From 4dc4f72c17c7a6a3edef5e589568a2542fc08397 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 9 Oct 2026 16:33:16 +0000 Subject: [PATCH 2/3] onnxsim: carry forward riscv64 patches to 0.8.1 Nightly version bump omitted the patches/onnxsim/ directory for 0.8.1, so the build's unconditional `git apply .../*.patch` step failed with "No such file or directory" before any build/test ran. Copied forward the same patch set from 0.7.3 (unchanged since then). --- ...n-in-test_profiling-s-foldable-model.patch | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch diff --git a/patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch b/patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch new file mode 100644 index 00000000000..10189f21760 --- /dev/null +++ b/patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Thu, 24 Sep 2026 00:00:00 +0000 +Subject: [PATCH] tests: pin ir_version in test_profiling's _foldable_model + +Every other test file that builds an onnx.ModelProto by hand pins +ir_version explicitly (test_python_api.py, test_function_rewriter.py, +test_constant_fold_determinism.py, etc. all pass ir_version=... to +helper.make_model()). test_profiling.py's _foldable_model() is the one +holdout: it calls helper.make_model(graph, opset_imports=[...]) with no +ir_version, so the model is stamped with whatever onnx.IR_VERSION the +currently installed onnx package defines. + +onnxsim statically links a vendored onnx (via the onnx-optimizer git +submodule, frozen at a pinned commit) into its C++ core, and that +core's checker enforces its own, older notion of the max supported IR +version. Once the *installed* onnx package (an unpinned "onnx" runtime +dependency in pyproject.toml) is newer than whatever onnx-optimizer's +submodule was pinned to at release time, every one of +_foldable_model()'s callers in this file fails identically: + + RuntimeError: Your model ir_version 14 is higher than the + checker's (13). + +before reaching any of what the test actually means to check (the +profiler's spans, the OrtSession nesting, the env var save/restore). +This is a real ambient-versioning gap, not a riscv64-only symptom: the +same break reproduces on any platform the moment pip resolves an onnx +release newer than the vendored submodule tolerates, which is exactly +why every sibling test file already pins ir_version defensively - +test_profiling.py just missed doing the same for its one hand-built +model. + +Match the existing convention used throughout the suite (ir_version=10 +regardless of opset) so the fixture stays valid across the wide range +of onnx versions the unpinned runtime dependency can resolve to. + +Upstream-Status: To upstream [no push/issue access to onnxsim/onnxsim from this environment - only riseproject-dev/python-wheels is attached; the fix is a one-line ir_version pin matching every sibling test file's existing convention] + +Signed-off-by: Ludovic Henry +--- +diff --git a/tests/test_profiling.py b/tests/test_profiling.py +--- a/tests/test_profiling.py ++++ b/tests/test_profiling.py +@@ -29,7 +29,18 @@ + x = helper.make_tensor_value_info("x", TensorProto.FLOAT, [1, 4]) + y = helper.make_tensor_value_info("y", TensorProto.FLOAT, [1, 4]) + graph = helper.make_graph([add_const, add_x], "g", [x], [y], [a, b]) +- model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 17)]) ++ model = helper.make_model( ++ graph, ++ opset_imports=[helper.make_opsetid("", 17)], ++ # Pin ir_version like every other model-building test in this suite ++ # already does (test_python_api.py, test_function_rewriter.py, etc.): ++ # onnx.helper.make_model() otherwise stamps the installed onnx package's ++ # current onnx.IR_VERSION, which floats upward with each onnx release and ++ # can exceed what the vendored onnx-optimizer/onnx submodule's checker ++ # (frozen at a pinned commit) accepts, e.g. "Your model ir_version 14 is ++ # higher than the checker's (13)" once a newer onnx is installed. ++ ir_version=10, ++ ) + onnx.checker.check_model(model) + return model + From 8ccc9de9040fb66173a82296b72c3fc9882c69e0 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 10 Oct 2026 07:53:34 +0000 Subject: [PATCH 3/3] onnxsim: drop the upstreamed test_profiling ir_version patch for 0.8.1 onnxsim 0.8.1 rewrote tests/test_profiling.py's _foldable_model() to build its model through a new _model() helper (onnx.parser.parse_model) that stamps ir_version=10 by default, instead of the bare helper.make_model(graph, opset_imports=[...]) call our patch pinned. That is exactly the fix the patch carried, so the carried-forward copy no longer applies (hunk at tests/test_profiling.py:29) and has nothing left to change; 0.7.3 keeps it. With no patches left for 0.8.1, guard the "Apply patches" step on hashFiles() like build-fastparquet.yml does, so a version without a patches/onnxsim// directory skips the step instead of failing git apply on an unmatched glob. --- .github/workflows/build-onnxsim.yml | 4 ++ ...n-in-test_profiling-s-foldable-model.patch | 64 ------------------- 2 files changed, 4 insertions(+), 64 deletions(-) delete mode 100644 patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch diff --git a/.github/workflows/build-onnxsim.yml b/.github/workflows/build-onnxsim.yml index 1339b7eb6d9..b27d75c4185 100644 --- a/.github/workflows/build-onnxsim.yml +++ b/.github/workflows/build-onnxsim.yml @@ -94,7 +94,11 @@ jobs: path: python-wheels persist-credentials: false + # 0.7.3 needs the test_profiling ir_version pin; 0.8.1 ships it (its + # _model() helper pins ir_version=10), so later versions may have no + # patches/ directory at all. - name: Apply patches + if: hashFiles(format('python-wheels/patches/onnxsim/{0}/*.patch', env.ONNXSIM_VERSION)) != '' run: git apply -v python-wheels/patches/onnxsim/${{ env.ONNXSIM_VERSION }}/*.patch - name: Build wheels diff --git a/patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch b/patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch deleted file mode 100644 index 10189f21760..00000000000 --- a/patches/onnxsim/0.8.1/0001-tests-pin-ir_version-in-test_profiling-s-foldable-model.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ludovic Henry -Date: Thu, 24 Sep 2026 00:00:00 +0000 -Subject: [PATCH] tests: pin ir_version in test_profiling's _foldable_model - -Every other test file that builds an onnx.ModelProto by hand pins -ir_version explicitly (test_python_api.py, test_function_rewriter.py, -test_constant_fold_determinism.py, etc. all pass ir_version=... to -helper.make_model()). test_profiling.py's _foldable_model() is the one -holdout: it calls helper.make_model(graph, opset_imports=[...]) with no -ir_version, so the model is stamped with whatever onnx.IR_VERSION the -currently installed onnx package defines. - -onnxsim statically links a vendored onnx (via the onnx-optimizer git -submodule, frozen at a pinned commit) into its C++ core, and that -core's checker enforces its own, older notion of the max supported IR -version. Once the *installed* onnx package (an unpinned "onnx" runtime -dependency in pyproject.toml) is newer than whatever onnx-optimizer's -submodule was pinned to at release time, every one of -_foldable_model()'s callers in this file fails identically: - - RuntimeError: Your model ir_version 14 is higher than the - checker's (13). - -before reaching any of what the test actually means to check (the -profiler's spans, the OrtSession nesting, the env var save/restore). -This is a real ambient-versioning gap, not a riscv64-only symptom: the -same break reproduces on any platform the moment pip resolves an onnx -release newer than the vendored submodule tolerates, which is exactly -why every sibling test file already pins ir_version defensively - -test_profiling.py just missed doing the same for its one hand-built -model. - -Match the existing convention used throughout the suite (ir_version=10 -regardless of opset) so the fixture stays valid across the wide range -of onnx versions the unpinned runtime dependency can resolve to. - -Upstream-Status: To upstream [no push/issue access to onnxsim/onnxsim from this environment - only riseproject-dev/python-wheels is attached; the fix is a one-line ir_version pin matching every sibling test file's existing convention] - -Signed-off-by: Ludovic Henry ---- -diff --git a/tests/test_profiling.py b/tests/test_profiling.py ---- a/tests/test_profiling.py -+++ b/tests/test_profiling.py -@@ -29,7 +29,18 @@ - x = helper.make_tensor_value_info("x", TensorProto.FLOAT, [1, 4]) - y = helper.make_tensor_value_info("y", TensorProto.FLOAT, [1, 4]) - graph = helper.make_graph([add_const, add_x], "g", [x], [y], [a, b]) -- model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 17)]) -+ model = helper.make_model( -+ graph, -+ opset_imports=[helper.make_opsetid("", 17)], -+ # Pin ir_version like every other model-building test in this suite -+ # already does (test_python_api.py, test_function_rewriter.py, etc.): -+ # onnx.helper.make_model() otherwise stamps the installed onnx package's -+ # current onnx.IR_VERSION, which floats upward with each onnx release and -+ # can exceed what the vendored onnx-optimizer/onnx submodule's checker -+ # (frozen at a pinned commit) accepts, e.g. "Your model ir_version 14 is -+ # higher than the checker's (13)" once a newer onnx is installed. -+ ir_version=10, -+ ) - onnx.checker.check_model(model) - return model -