Conversation
Mirrors build-onnxoptimizer.yml: onnxsim vendors onnx-optimizer (which vendors onnx) as git submodules and links onnx/protobuf statically, the same shape already ported. cp310 is dropped for the same reason (onnxoptimizer has no riscv64 onnx wheel there); cp312's abi3 wheel serves 3.12+.
luhenry
added a commit
that referenced
this pull request
Sep 24, 2026
An include list whose entries share no key with the base matrix collapses onto a single job instead of adding one per entry (confirmed against onnxoptimizer's own CI run, which built only cp312 despite listing cp311 too). Make python a real matrix dimension so include only attaches onnxruntime to the matching combination.
Contributor
|
luhenry
added a commit
that referenced
this pull request
Sep 24, 2026
…m to ci-running (build jobs still in_progress on PR #2266)
CI confirmed the wheel itself builds and passes abi3audit on both interpreters, but pytest aborts collection outright on test_python_api.py, test_simple.py, test_timm.py, test_rfdetr.py and test_yolo.py: each does a module-level import of torch, timm or onnxruntime with no pytest.importorskip guard, so a missing module is a collection error (exit code 2) rather than a skip. None of those packages have riscv64 wheels (onnxruntime only from cp312, which still lacks timm/rfdetr/ ultralytics/torch), so ignore the files themselves.
cp312-manylinux_riscv64's test step failed all 10 tests in
tests/test_profiling.py:
RuntimeError: Your model ir_version 14 is higher than the
checker's (13).
_foldable_model() builds its onnx.ModelProto via helper.make_model()
with no ir_version, so the model is stamped with whatever
onnx.IR_VERSION the installed onnx package currently defines - and
our registry's newest riscv64 onnx build for cp312 is 1.23.0. onnxsim
statically links a vendored onnx (via the onnx-optimizer git
submodule, frozen at a pinned commit) whose checker only recognizes up
to ir_version 13, so any onnx installed newer than that submodule's
pin breaks every caller of _foldable_model() before the test gets to
what it actually means to check.
Every other test file that builds a model by hand pins ir_version
explicitly; test_profiling.py's _foldable_model() was the one
holdout. Match the existing convention (ir_version=10) so the fixture
stays valid across the range of onnx versions the unpinned runtime
dependency can resolve to.
Adds the checkout/apply-patches step pair (mirroring
build-py-spy.yml) and patches/onnxsim/** to path triggers.
cp311 has no riscv64 onnxruntime wheel, so onnxsim's check_n equivalence check runs through onnx's ReferenceEvaluator instead. For opset 9-13 that dispatches BatchNormalization to BatchNormalization_9, whose inference path is guarded by `if momentum is None` -- but OpRun fills the attribute with its schema default 0.9, so it always takes the momentum branch and blends the batch's own mean/var into the running statistics. The unsimplified Conv+BN model is therefore evaluated wrongly, and the correctly fused single Conv is reported as a mismatch (max diff 5.33 in the riscv64 log). Not riscv64-specific and not a precision issue: onnxsim 0.7.3's PyPI x86_64 wheel with onnx 1.23.0 / numpy 2.4.6 and no onnxruntime fails the same two tests every run (max diff 1.3-3.7). Against a float64 numpy reference, the fused Conv is within 3.7e-6 while the reference evaluator's Conv+BN is off by 16.3 and matches the momentum-blended formula to 2.3e-6. With onnxruntime installed (cp312 here, and every leg of upstream's CI) both tests pass. onnx main still has the same BatchNormalization_9 code.
setup.py appends `.dev<N>` from `git rev-list --count v<ver>..HEAD` whenever git is available, which it is in the cibuildwheel container, so the previous run built onnxsim-0.7.3.dev0-*.whl. The publish job titles the release from the wheel metadata and would have shipped onnxsim-v0.7.3.dev0. Upstream's own tag builds set ONNXSIM_RELEASE for exactly this; mirror that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
onnxsim0.7.3Compiles a C++ extension (via nanobind) that statically links a vendored onnx-optimizer, onnx and protobuf to simplify ONNX graphs. Upstream publishes no riscv64 wheel.
Mirrors upstream's
build-and-test.yml, narrowed to the same onnxoptimizer-style static-link shape already ported in #2258.Differs from upstream
python -m nanobind --cmake_dirand would otherwise fetch it from GitHubONNXSIM_RELEASEset from the tag - upstream's own setup.py appends a.devNgit-describe suffix without it, which would have publishedonnxsim-0.7.3.dev0Matrix: cp311 and cp312 only - onnx has no riscv64 wheel for cp310; cp312's abi3 wheel also serves 3.13+
Testing
pytest.importorskip-guarded and skip without riscv64 wheelstest_fuse_conv_bn_into_conv/test_fuse_convtranspose_bn- onnx'sReferenceEvaluatorhas aBatchNormalization_9bug (always mixes in batch stats regardless ofmomentum) that these two tests hit only without onnxruntime; reproduces identically on x86_64License: OK - the wheel statically links onnx (MIT) and protobuf (BSD-3-Clause) via the vendored onnx-optimizer (Apache-2.0), pulling in abseil (Apache-2.0, no NOTICE file), already covered by onnxsim's own LICENSE.