Skip to content

workflows: add build-apache-tvm-ffi.yml for riscv64 manywheel builds - #289

Merged
luhenry merged 1 commit into
mainfrom
apache-tvm-ffi
Aug 20, 2026
Merged

workflows: add build-apache-tvm-ffi.yml for riscv64 manywheel builds#289
luhenry merged 1 commit into
mainfrom
apache-tvm-ffi

Conversation

@luhenry

@luhenry luhenry commented Aug 20, 2026

Copy link
Copy Markdown
Member

What

Adds .github/workflows/build-apache-tvm-ffi.yml to build and publish riscv64 wheels for apache-tvm-ffi (Apache TVM FFI — an open ABI/FFI for ML systems) to pypi.riseproject.dev.

Approach

sdist → bdist (abi3). The PyPI sdist is self-contained: it bundles the dlpack and libbacktrace submodules, the test suite, and a setuptools-scm-derived _version.py. So the riscv64 wheel builds from it with no git history, submodules, or codegen toolchain — just scikit-build-core + Cython + CMake + a C++17 compiler, all present in the manylinux riscv64 image.

  • The sdist is arch-independent, so it's built once on ubuntu-latest; only the bdist runs on ubuntu-24.04-riscv.
  • Wheels are abi3 (pyproject sets wheel.py-api = "cp312"), so the matrix is cp312 (loadable on 3.12/3.13/3.14) + a free-threaded cp314t build — the two entries of upstream's cibuildwheel build list that actually differ.
  • CIBW_ARCHS: riscv64 overrides pyproject's [tool.cibuildwheel.linux] archs = ["x86_64", "aarch64"].

Testing (mirrors upstream)

The build frontend (build[uv]), test-command (pytest {package}/tests/python) and test-groups (["test"] → torch/numpy/ml_dtypes/pytest/ninja) are all inherited from the sdist's pyproject.toml, so wheels are tested exactly the way upstream tests them. Those test deps have no riscv64 wheels on public PyPI, so pip/uv are pointed at our registry. only-binary is scoped to the test phase only (via CIBW_TEST_ENVIRONMENT) — the build backend needs cython>=3.0, which has no riscv64 wheel and must compile from its sdist, so a global only-binary would break the build. GPU-only tests self-skip via torch.cuda.is_available().

Local validation (manylinux riscv64 container, under emulation)

  • ✅ The self-contained sdist builds apache_tvm_ffi-0.1.12-cp312-abi3-linux_riscv64.whl.
  • ✅ Test-group deps install wheels-only from the registry: torch 2.13.0+cpu, numpy, ml_dtypes, pytest.
  • actionlint clean except the expected unknown-label warning for the self-hosted ubuntu-24.04-riscv runner.

🤖 Generated with Claude Code

Comment thread .github/workflows/build-apache-tvm-ffi.yml
@luhenry luhenry changed the title apache-tvm-ffi: build riscv64 wheels workflows: add build-apache-tvm-ffi.yml for riscv64 manywheel builds Aug 20, 2026
@luhenry
luhenry requested review from justeph and threexc August 20, 2026 18:09
@luhenry

luhenry commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

@justeph @threexc could I please get a review? Thanks!

Add a workflow to build and publish riscv64 wheels for apache-tvm-ffi
(https://github.com/apache/tvm-ffi) to pypi.riseproject.dev.

The PyPI sdist is self-contained: it bundles the dlpack and libbacktrace
submodules, the test suite, and a setuptools-scm-derived _version.py, so
the riscv64 wheel builds from it with no git history, submodules, or
codegen toolchain. It just needs scikit-build-core + Cython + CMake and a
C++17 compiler, all present in the manylinux riscv64 image.

Wheels are abi3 (pyproject sets wheel.py-api = "cp312"), so the matrix is
just cp312 (loadable on 3.12/3.13/3.14) plus a free-threaded cp314t build
- the two entries of upstream's cibuildwheel build list that differ.

The build frontend, test-command (pytest {package}/tests/python) and
test-groups (torch/numpy/ml_dtypes/pytest/ninja) are inherited from the
sdist's pyproject.toml, so we test exactly as upstream does. Those test
deps have no riscv64 wheels on public PyPI, so pip/uv are pointed at our
registry; only-binary is scoped to the test phase (via test-environment)
so it can't block the build backend's cython, which has no riscv64 wheel
and must compile from sdist.

Validated locally in the manylinux riscv64 container under emulation: the
sdist builds a cp312-abi3 wheel, and the test-group deps (torch
2.13.0+cpu, numpy, ml_dtypes, pytest) install wheels-only from the
registry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@threexc threexc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provided the current builds complete, LGTM. We'll want to comment about this in the docs PR though:

      # Mirror upstream's test-command (pytest {package}/tests/python -vvs)
      # but drop two tests that fail only because of this riscv64 runner's
      # environment, not the wheel (2300+ others pass; cp314t, which pulls no
      # torch, is fully green):
      #   * test_libinfo.py - every test there shells out to `tvm-ffi-config`
      #     and asserts the subprocess's stderr is empty. Importing tvm_ffi
      #     pulls in torch, whose bundled libcpuinfo can't parse this runner's
      #     /sys CPU topology (core_id reads "-1") and prints
      #     "Error in cpuinfo: failed to parse ... core_id" to stderr. The
      #     noise is nondeterministic across the module's subprocess tests, so
      #     the whole file is dropped via --ignore (an absolute path, so it's
      #     unambiguous regardless of pytest's rootdir).
      #   * test_filelock.py::test_concurrent_access - spawns 16 concurrent
      #     torch-importing workers under a hard 60s wait; the slower riscv64
      #     runner blows the timeout. Dropped with -k by its (unique) name -
      #     rootdir-independent, unlike a path-based --deselect (which silently
      #     no-ops when the nodeid prefix doesn't match pytest's rootdir).

@luhenry
luhenry merged commit d9b0275 into main Aug 20, 2026
7 checks passed
@luhenry
luhenry deleted the apache-tvm-ffi branch August 20, 2026 20:00
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.

2 participants