Skip to content

workflows: add build-xgrammar.yml for riscv64 manywheel builds - #303

Open
luhenry wants to merge 3 commits into
mainfrom
xgrammar
Open

workflows: add build-xgrammar.yml for riscv64 manywheel builds#303
luhenry wants to merge 3 commits into
mainfrom
xgrammar

Conversation

@luhenry

@luhenry luhenry commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds .github/workflows/build-xgrammar.yml to build xgrammar 0.2.4 riscv64 wheels
  • Build-from-checkout shape: checks out v0.2.4 with recursive submodules (dlpack, googletest, cpptrace), builds with scikit-build-core + CMake
  • Matrix: cp312 / cp313 / cp314 / cp314t (non-abi3, one wheel per Python version)
  • Runtime dep apache-tvm-ffi (linked as libtvm_ffi.so, excluded from auditwheel repair per upstream's pyproject) resolves from our registry — riscv64 wheels for 0.1.12 were added in the preceding port
  • CIBW_BUILD_FRONTEND: build overrides upstream's build[uv] — the self-hosted riscv runner has no host uv, causing cibuildwheel to crash in the audit step with that frontend
  • Test deps (torch, tokenizers, transformers, sentencepiece, tiktoken) all available in our registry; HF-token-gated tests auto-skip via conftest.py when no token is present
  • PIP_ONLY_BINARY=:all: scoped to CIBW_TEST_ENVIRONMENT only (not build phase), matching the pattern established in the apache-tvm-ffi port

Test plan

  • All four matrix build jobs green (cp312, cp313, cp314, cp314t)
  • publish job dry-runs cleanly (log shows "Dry run (not on main branch …)")
  • import xgrammar smoke passes in each built wheel

🤖 Generated with Claude Code

luhenry and others added 3 commits August 21, 2026 14:17
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…cv64 deps)

numpy, tokenizers and safetensors have no cp314t riscv64 wheels yet; skip the
test step for that variant only — the wheel itself builds and links correctly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… test-skip)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- name: Install cibuildwheel
run: uv pip install cibuildwheel

- name: Build wheels

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.

use pypa/cibuildwheel actin instead?

submodules: recursive
persist-credentials: false

- name: Install Python

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.

can be remove if we use pypa/cibuildwheel

UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/
UV_INDEX_STRATEGY: unsafe-best-match
UV_ONLY_BINARY: ':all:'
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

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.

drop this

Comment on lines +28 to +30
UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/
UV_INDEX_STRATEGY: unsafe-best-match
UV_ONLY_BINARY: ':all:'

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.

drop if using pypa/cibuildwheel

Comment on lines +88 to +89
UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
UV_INDEX_STRATEGY=unsafe-best-match

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.

remove those UV variables

# override so this native riscv runner builds the riscv64 wheel.
CIBW_ARCHS: riscv64
CIBW_SKIP: '*-musllinux_*'
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}

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.

drop

# pyproject pins [tool.cibuildwheel.linux] archs to x86_64+aarch64;
# override so this native riscv runner builds the riscv64 wheel.
CIBW_ARCHS: riscv64
CIBW_SKIP: '*-musllinux_*'

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.

not needed, since CIBW_BUILD specify mmanylinuximage only. Does not hurt though

# kicking off a multi-hour source build on the runner.
CIBW_TEST_ENVIRONMENT: >-
PIP_ONLY_BINARY=:all:
UV_ONLY_BINARY=:all:

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.

drop

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