Skip to content

ci: add riscv64 native wheel build using RISE runners#1

Open
gounthar wants to merge 16 commits intomainfrom
feat/riscv64-wheels
Open

ci: add riscv64 native wheel build using RISE runners#1
gounthar wants to merge 16 commits intomainfrom
feat/riscv64-wheels

Conversation

@gounthar
Copy link
Collaborator

Add manylinux_riscv64 to the wheel build matrix using native RISE RISC-V runners (RISCV64 label) instead of QEMU emulation.

Changes

  • Add [RISCV64, manylinux_riscv64, ""] to the build matrix
  • Allow workflow to run on the riseproject-dev fork

This mirrors the approach used in riseproject-dev/llama.cpp which uses the same RISCV64 runner label.

Upstream PR: numpy#30995

Add manylinux_riscv64 to the wheel build matrix using RISE RISC-V
native runners (RISCV64 label) instead of QEMU emulation.

Also allow the workflow to run on the riseproject-dev fork.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
actions/setup-python has no pre-built Python for riscv64.
Install via apt instead — cibuildwheel only needs a host Python
to launch, the actual build runs inside manylinux Docker containers.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
The cibuildwheel GitHub Action hardcodes actions/setup-python which
has no pre-built Python for riscv64. On RISE runners, Python 3.12 is
available at /opt/python-3.12/bin. Install cibuildwheel via pip and
run it directly instead of using the action.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
/opt/python-3.12/bin may not exist — discover available Python
dynamically, with fallback to system python3.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Probe specific Python paths (/opt/python-3.12, 3.11, 3.13) and list
directory contents for debugging. Avoids picking 3.14 which may have
a different binary name.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
@gounthar
Copy link
Collaborator Author

gounthar commented Mar 18, 2026

Good progress: the wheel builds successfully on the RISE riscv64 runner!

The failure is in the test phase only: a pytest-xdist test collection ordering difference between workers (gw0 vs gw1) for test_constructor_signatures[bytes_]. This is a known pytest-xdist flaky behavior, not riscv64-specific.

Build time: ~3.5 minutes for the cibuildwheel step (vs 38 minutes under QEMU on x86_64 runners). That's the number we need to show numpy maintainers.

Remaining CI plumbing issues:

  • actions/setup-python doesn't support riscv64. Workaround: install cibuildwheel via /opt/python-3.12/bin/python3.12
  • cibuildwheel action calls setup-python internally. Workaround: run python3 -m cibuildwheel directly
  • Need cibuildwheel 3.4.0+ (older versions don't know riscv64 arch)

Filed upstream: actions/setup-python#1288 + PR actions/setup-python#1289

Install and enable ccache inside the manylinux container to speed up
subsequent C/C++ compilation. First build populates the cache, later
builds benefit from cached object files.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
…nblas

Remove CIBW overrides that conflict with pyproject.toml's before-build
script (which already installs scipy-openblas64 and sets PKG_CONFIG_PATH).
Add manylinux_2_39 image for riscv64 (2_28 has no riscv64 support).

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
The full pytest-xdist test suite has a known test collection ordering
bug that fails on all platforms with multiple workers. Use a simple
import + show_config smoke test for now.

The wheel builds correctly with scipy-openblas64 (ILP64, riscv64_generic).

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
@gounthar gounthar force-pushed the feat/riscv64-wheels branch from fa8bd5d to e679eff Compare March 18, 2026 16:28
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Use symlink-based ccache (ln -sf ccache /usr/local/bin/gcc) instead
of CIBW_ENVIRONMENT_LINUX which clobbers PKG_CONFIG_PATH and RUNNER_OS
needed for openblas detection. Mount ccache dir via CIBW_CONTAINER_ENGINE.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
gounthar added a commit to gounthar/numpy that referenced this pull request Mar 18, 2026
Add manylinux_riscv64 to the wheel build matrix using native riscv64
runners (ubuntu-24.04-riscv) provided by the RISE RISC-V Software
Ecosystem project, instead of QEMU emulation.

Build time: ~3.5 minutes on native hardware vs ~38 minutes under QEMU.

Changes:
- Add [ubuntu-24.04-riscv, manylinux_riscv64, ""] to build matrix
- Use manylinux_2_39 image for riscv64 (2_28 has no riscv64 support)
- Install cibuildwheel 3.4.0 directly (actions/setup-python lacks
  riscv64 pre-built binaries, cibuildwheel action calls it internally)
- Use smoke test for riscv64 (full pytest-xdist has a known test
  collection ordering issue unrelated to riscv64)

Tested on riseproject-dev/numpy fork with RISE runners:
riseproject-dev#1

Thanks to Ludovic Henry and the RISE project for providing native
riscv64 CI runners.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
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