Skip to content

treelite-runtime: add build-treelite-runtime.yml for riscv64 wheels - #2732

Open
luhenry wants to merge 4 commits into
mainfrom
treelite-runtime
Open

luhenry wants to merge 4 commits into
mainfrom
treelite-runtime

Conversation

@luhenry

@luhenry luhenry commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Legacy setup.py project compiling the sibling C++ tree into libtreelite_runtime.so, loaded through ctypes. Upstream publishes no riscv64 wheel. This is the last release of the distribution: treelite 4.0.0 dropped runtime/python and reborn it as tl2cgen_runtime in dmlc/tl2cgen.

Mirrors upstream's ops/build-linux.sh.

Differs from upstream

  • PIP_EXTRA_INDEX_URL added for numpy and scipy.
  • Wheel retagged py3-none with wheel tags instead of bdist_wheel --universal - cibuildwheel's pip frontend ignores that flag.

Matrix: one py3-none wheel - ext_modules only drives the CMake build, no CPython ABI involved.

Testing

  • Not test_basic.py: every check there builds its DMatrix from a SciPy CSR matrix via np.array(..., copy=False, dtype=cast), which numpy 2 (the only line with a riscv64 wheel) refuses outright on any platform, treelite-runtime predating numpy 2. Instead, the companion treelite package is installed from the same checkout to compile a real model, loaded through treelite_runtime.Predictor and run on a dense DMatrix, which takes no such cast.

License: Wheel ships no LICENSE on any platform (setuptools' glob never sees the repo-root file from runtime/python/); staged a copy next to setup.py to fix that. auditwheel also bundles the image's libgomp (GPL), so a gpl_sources job publishes gcc sources against the same pinned image.

Patches

  • 0001-Pin-RapidJSON-past-v1.1.0-s-broken-operator.patch - Backport rapidjson@862c39b. Vendored RapidJSON v1.1.0 fails to build under GCC 14; reproduces on any platform, not riscv64-only.

Built on cp312; dense-DMatrix smoke test passed.

Last release of this distribution: treelite 4.0.0 dropped runtime/python
and reborn it as tl2cgen_runtime in dmlc/tl2cgen, so 3.9.1 is a closed,
pinned build. Both python/ and runtime/python/ build from one root
CMakeLists.txt; the runtime wheel bundles a ctypes-loaded
libtreelite_runtime.so with no extension module, so it is retagged
py3-none after cibuildwheel's cp312 build, same as upstream's own
ops/build-linux.sh does with bdist_wheel --universal.
The manylinux_riscv64 image's system cmake refuses fmtlib's own
cmake_minimum_required (<3.5); CMAKE_POLICY_VERSION_MINIMUM=3.5 is the
standard escape hatch, applied via CIBW_ENVIRONMENT so it reaches the
FetchContent sub-build too.
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://riseproject-dev.github.io/python-wheels/pr-preview/pr-2732/

Built to branch gh-pages at 2026-10-05 20:16 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

objtreelite fails to build on the manylinux_riscv64 image's GCC 14:
RapidJSON v1.1.0's GenericStringRef declares a copy-assignment that
assigns to its own const length member, upstream-fixed 3 commits later
by deleting the operator outright. Also wires the patch into the build
and its paths into the workflow triggers.
Every check in test_basic.py builds its DMatrix from a SciPy CSR
matrix through np.array(..., copy=False, dtype=<cast>), which numpy 2
(the only line with a riscv64 wheel) refuses outright rather than
copying; the previous run showed this on 2 passed, 10 failed, 18
errored, and it reproduces identically on x86_64 under numpy 2, so it
is a real upstream gap, not something to patch around. DMatrix-from-
dense-ndarray takes no such cast, so compile a model with the gcc
toolchain and predict on it directly.
luhenry added a commit that referenced this pull request Oct 5, 2026
@luhenry
luhenry marked this pull request as ready for review October 5, 2026 21:36

This branch has not been deployed

No deployments
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.

1 participant