Skip to content

quadrants: Add version 1.3.3 - #3270

Draft
luhenry wants to merge 16 commits into
mainfrom
port/quadrants
Draft

luhenry wants to merge 16 commits into
mainfrom
port/quadrants

Conversation

@luhenry

@luhenry luhenry commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Genesis-AI's scikit-build-core fork of taichi: a C++ compiler with an LLVM JIT CPU backend. Upstream publishes no riscv64 wheel.

Mirrors upstream's manylinux_wheel.yml.

Differs from upstream

  • Builds LLVM+clang 22.1.0 from source (RISCV target only) - quadrants-sdk-builds ships no riscv64 LLVM
  • CUDA/AMDGPU/Vulkan turned off - no riscv64 backend exists for any of them
  • --group dev trimmed to the build-only subset - full group pulls pyright, which has no riscv64 wheel/sdist

Testing

  • smoke import + qd.init(arch=qd.cpu) only - upstream's pytest suite (tests/run_tests.py) is deferred to a follow-up

License: OK

Patches

  • 0001-Add-a-riscv64-CPU-arch.patch - To upstream. Adds riscv64 to the CPU-arch enum; without it CMake FATAL_ERRORs on an unknown processor.
  • 0002-CI-support-riscv64-in-the-LLVM-sccache-manylinux-build-scripts.patch - Inappropriate [no riscv64 LLVM/sccache release exists]. Wires our from-source LLVM in and turns off the nonexistent GPU backends.
  • 0003-CI-trim-riscv64-dev-group-install-and-drop-submodule-reinit.patch - Inappropriate [riscv64 has no pyright wheel]. pip install --group dev otherwise fails outright.

First riscv64 attempt; CI running at the time of this PR, see checks for current status.

Genesis-AI's fork of taichi: a scikit-build-core C++ compiler with an
LLVM JIT CPU backend. Compared with the parked taichi entry, two of
taichi's three walls are gone here: quadrants targets LLVM 22.1.0
(opaque pointers; RuntimeDyldELF has real RISC-V relocation handling
since LLVM 20, confirmed directly against llvmorg-22.1.0 source: 42
riscv hits, a real resolveRISCVRelocation()) and finds clang via
clang-22/21/20. The remaining wall is quadrants having no riscv64 CPU
arch and no riscv64 LLVM to build against:

- patches/quadrants/1.3.3/0001 adds a riscv64 CPU arch alongside
  x64/arm64 everywhere they're handled (CXXFlags, the arch enum,
  rhi/arch.cpp, and four scattered "is this a CPU arch" checks in the
  LLVM codegen/transforms).
- 0002/0003 patch the CI build scripts: no riscv64 LLVM/sccache
  release exists to download, so setup_llvm() expects LLVM_DIR to
  already point at the LLVM we build ourselves, setup_sccache()
  no-ops (ccache from the manylinux image covers it instead), CUDA/
  AMDGPU/Vulkan (no riscv64 backend for any of them) are turned off,
  and the dev dependency group is trimmed to what the build actually
  needs (full --group dev pulls pyright, which has no riscv64 wheel
  or sdist).

build-quadrants.yml builds LLVM+clang 22.1.0 from source once (RISCV
target only, matching build-libclang.yml's from-source precedent but
also linking OrcJIT/ExecutionEngine/RuntimeDyld, which libclang.so
doesn't need), then reuses it across the cp310/cp311/cp312/cp313
matrix - mirroring upstream's own manylinux_wheel.yml scripts
(1_prerequisites.sh/2_build.sh/3_check.sh) almost verbatim, pointed at
our own LLVM instead of their quadrants-sdk-builds releases. GCC (not
our built clang) still compiles the bulk of the project, same as
upstream; clang only compiles the LLVM JIT's runtime.cpp bitcode, and
the main library links the static LLVM libraries GCC-side, which is
an ordinary cross-compiler-ABI link on Linux.

No gpl_sources job: the build doesn't statically link libstdc++ into
the wheel (that flag is MinGW-only in QuadrantsCXXFlags.cmake), and
glibc-based manylinux auditwheel doesn't bundle it either.
jobs.<job_id>.container and jobs.<job_id>.name don't have the env
context available (only github/needs/strategy/matrix/inputs/vars), so
${{ env.MANYLINUX_RISCV64_IMAGE }} in container: and ${{ env.LLVM_VERSION }}
in a job name failed workflow validation outright (zero jobs scheduled,
run marked failed). Hardcode the image literal in both container
blocks, matching build-openmm.yml/build-syntaqlite.yml, and drop the
now-unused MANYLINUX_RISCV64_IMAGE workflow env (LLVM_VERSION stays -
run/with contexts do have env available).
luhenry added a commit that referenced this pull request Oct 15, 2026
@luhenry
luhenry marked this pull request as draft October 15, 2026 12:13
All four riscv64 build legs (cp310-cp313) failed identically in
1_prerequisites.sh's `pip install "cmake<4.0.0" ...` with:

  -- Could NOT find OpenSSL ...
  CMake Error at Utilities/cmcurl/CMakeLists.txt:772 (message):
    Could not find OpenSSL. Install an OpenSSL development package ...
  ERROR: Failed building wheel for cmake

With PIP_EXTRA_INDEX_URL set, pip resolves the highest version
satisfying a constraint across both the public index and ours, and
an sdist-only candidate still counts as resolvable. PyPI's cmake
publishes no riscv64 wheel for any release (checked its JSON: only
macOS/Windows/manylinux x86_64/aarch64/ppc64le/s390x/armv7l and
musllinux), and the newest release under "<4.0.0" at the time of
this PR, 3.31.10, is newer than the 3.31.6 we mirror -- so pip picked
3.31.10's sdist over our riscv64 wheel and tried to build CMake
itself from source, which fails configuring its bundled cmcurl for
lack of OpenSSL dev headers in the manylinux_riscv64 image.

Pin to "cmake==3.31.6", the exact version docs/packages/cmake.yaml
publishes a manylinux_2_39_riscv64 wheel for (same fix shape as
patches/ouster-sdk/1.0.1/0002-build-use-a-cmake-release-with-a-riscv64-wheel.patch,
the porting skill's gotcha 30: "the version has to line up, not
just the name").
1_prerequisites.sh ran `yum install -y ccache` on riscv64, but ccache
is EPEL-only on RHEL derivatives and manylinux_2_39_riscv64 ships no
EPEL (gotcha 51), so every interpreter leg failed with "Unable to find
a match: ccache". Upstream never installs ccache; drop the line and
build uncached, and update the sccache.py comment in 0002 that relied
on it.
_publish-wheel.yml now requires a matrix input (main's "publish:
Validate effective wheel targets"), but this PR branch forked before
that landed and quadrants has never been merged to main, so
build-quadrants.yml never picked up the matching one-line update every
already-published package's workflow got. The merge ref combines the
new required-input _publish-wheel.yml with this branch's old
build-quadrants.yml, so any run has failed startup with "Input matrix is
required, but not provided".

Pass it the same way the mass-update commit did for every other
package's publish job.
Runs 42731185766's cp311 and cp313 build jobs both failed CMake
configure identically: "Commit" printed blank and "CMake Error at
CMakeLists.txt:35 (string): string sub-command STRIP requires two
arguments.", followed later by "Configuring incomplete, errors
occurred!" (cp310 and cp312 failed earlier in the same run, to an LLVM
artifact download timeout and a GitLab submodule-fetch overload
respectively -- unrelated transient infra, rerun rather than patched).

1_prerequisites.sh's riscv64 branch dropped the upstream
`git config --global --add safe.directory /__w/quadrants/quadrants`
call outright instead of replacing it, reasoning that the hardcoded
path doesn't match our checkout layout. But this job runs inside a
`container:`, which doesn't see the safe.directory entry
actions/checkout already added to the *runner's* own host gitconfig;
without an equivalent here, the `git` this script installs refuses
every command against the checkout as "dubious ownership" --
including CMakeLists.txt's own `git rev-parse` for the build's commit
string, which swallows that failure and leaves the variable unset
instead of erroring, surfacing two lines later as the STRIP argument
error instead.

Add the safe.directory call back on riscv64, pointed at
$GITHUB_WORKSPACE (our actual checkout path, under any job's
container) instead of upstream's hardcoded one.
… clang

All 4 build jobs (cp310-cp313) fail identically in "Build and check
wheel", confirmed from the real job log (run 43082591853, job
131834368413): the CMake custom command that direct-invokes our
from-source riscv64 clang to generate the LLVM CPU-JIT runtime bitcode
module fails with "runtime.cpp:16:10: fatal error: 'atomic' file not
found" (ninja target generate_llvm_runtime_riscv64).

Patch 0002's riscv64 branch in scripts_new/manylinux_wheel/2_build.sh
turns the CUDA/AMDGPU/Vulkan backends off and skips QD_BUILD_TESTS, but
never sets any C++ include path for riscv64 - only the x86_64/aarch64
branch sets CPLUS_INCLUDE_PATH, pointed at the gcc-toolset-14 SCL
package's libstdc++ headers. Our own from-source-built clang
(llvm-install/bin/clang) has no baked-in knowledge of this image's
system GCC install, unlike the manylinux image's own preinstalled
clang, which locates it automatically for native (non-cross) compiles;
two sibling packages in this repo (daal, scikit-learn-intelex) already
confirm `which gcc` resolves to /usr on this same manylinux_riscv64
image when their own native riscv64 clang builds pass --gcc-toolchain
explicitly.

There is no gcc-toolset SCL package on riscv64 (it's x86_64/aarch64-only
on the manylinux images), so point CPLUS_INCLUDE_PATH at the image's
real system GCC under /usr instead, with the version segment read from
`gcc -dumpversion` rather than hardcoded, so this keeps working across
manylinux image updates the same way the existing x86_64/aarch64 branch
already does for its own gcc-toolset-14/14 pairing.

Verified the resulting patch hunk applies cleanly with `git apply`
(the exact command build-quadrants.yml's own "Patch quadrants source"
step runs) against a reconstructed copy of the pre-patch upstream file,
producing the intended CPLUS_INCLUDE_PATH setup inside the riscv64
branch.
Root cause of the red build_wheels jobs (all 4 interpreters): LLVM was
built with the default LLVM_ENABLE_RTTI=OFF, but quadrants dynamic_casts
across llvm::Pass types at runtime, so quadrants_python.*.so fails to
import with

  undefined symbol: _ZTIN4llvm10ModulePassE
  (typeinfo for llvm::ModulePass)

quadrants-sdk-builds' own llvm-ci.yml (the release bucket this
workflow would otherwise download from, were a riscv64 build
published there) sets -DLLVM_ENABLE_RTTI:BOOL=ON for exactly this
reason; our from-source LLVM build never carried it over.

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