Skip to content

onnxruntime: add build-onnxruntime.yml for riscv64 wheels - #363

Merged
luhenry merged 5 commits into
mainfrom
onnxruntime
Aug 26, 2026
Merged

onnxruntime: add build-onnxruntime.yml for riscv64 wheels#363
luhenry merged 5 commits into
mainfrom
onnxruntime

Conversation

@luhenry

@luhenry luhenry commented Aug 25, 2026

Copy link
Copy Markdown
Member

Adds a riscv64 wheel build for onnxruntime 1.29.0.

onnxruntime publishes no sdist, and its setup.py packages an already-built CMake tree rather than driving the build itself, so cibuildwheel cannot be used. The workflow mirrors upstream's templates/py-linux.yml and the two scripts it runs inside the build container (build_linux_python_package.sh, run_python_tests.sh): a podman run against quay.io/pypa/manylinux_2_39_riscv64 invokes tools/ci_build/build.py, then the wheel is auditwheel-repaired and tested.

Deviations from upstream, all noted inline:

  • upstream's build image is an internal AzureCR one; the manylinux image is used instead;
  • --use_vcpkg/--use_vcpkg_ms_internal_asset_cache dropped - the asset cache is MS-internal and the dependencies build fine from cmake/deps.txt;
  • --enable_lto dropped, to keep peak link memory and build time down on the riscv runner;
  • --compile_no_warning_as_error passed explicitly - upstream gets the same effect from SYSTEM_COLLECTIONURI being set in ADO (see build.py:use_dev_mode);
  • Rocky's CMake 3.31 installed over the image's CMake 4, matching what upstream installs into its own build images (several FetchContent'ed dependencies predate CMake 4);
  • auditwheel repair run explicitly - setup.py's manylinux allow-list has no riscv64 entry, so it tags the wheel linux_riscv64 and skips the repair it runs elsewhere;
  • the three C++ gtest binaries run_python_tests.sh also runs are skipped: they test the library rather than the wheel and read the ONNX node corpus from /data/onnx, which upstream mounts from its own agents.

The Python test list is build.py:run_onnxruntime_tests' own CPU path, unchanged.

onnxruntime publishes no sdist and its setup.py packages an already-built
CMake tree, so cibuildwheel can't drive it: the workflow mirrors upstream's
py-linux.yml by running tools/ci_build/build.py inside the manylinux
riscv64 image, then repairs and tests the wheel the same way
run_python_tests.sh does.
Upstream's build image adds a non-root onnxruntimedev user and runs the
build as it; the manylinux container runs as root, which build.py refuses
by default.
…tall

run_python_tests.sh installs /build/<config>/requirements.txt (cmake's copy of
the repo-root one) before the --no-index install, so onnxruntime's runtime
dependencies resolve from an index; without it the test container only had
whatever the CI test requirements happened to pull in.
The smoke check asserted on onnxruntime.capi._pybind_state, which is a
pure-Python shim that re-exports the extension; the compiled module is
onnxruntime.capi.onnxruntime_pybind11_state. All four jobs built and
auditwheel-repaired their wheel and then failed on that assertion.

The cp312 job separately lost a ~9h runner slot to a transient
"No URLs in mirrorlist" from dnf, so that install is now retried.
@luhenry
luhenry merged commit 1a61b22 into main Aug 26, 2026
9 checks passed
@luhenry
luhenry deleted the onnxruntime branch August 26, 2026 22:56
@luhenry luhenry linked an issue Aug 26, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onnxruntime riscv64 support

1 participant