Repository navigation
Vendor the XLA FFI headers instead of requiring jax to build - #200
Merged
Merged
Conversation
The JAX extension only needs the header-only XLA FFI API. Pinning
jax==0.8.0 in build-system requires already fixed the headers at that
version, but made the sdist unbuildable wherever jaxlib publishes no
wheel (e.g. macOS x86_64) and pulled jaxlib into every isolated build.
Copy xla/ffi/api/{api,c_api,ffi}.h verbatim from jaxlib 0.8.0 into
c++/vendor/xla (Apache 2.0) and drop jax from the build requirements.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #193.
The JAX extension (
xla_ops) only needs the XLA FFI API, which is three self-contained headers (xla/ffi/api/{api,c_api,ffi}.h, ~160 KB, stdlib-only, Apache 2.0). Thejax==0.8.0pin in[build-system] requireswas effectively vendoring them via pip: every build compiled against the 0.8.0 headers and ran on any jax >= 0.8.0. Checking them in gives the same result without:Changes
c++/vendor/xla/: headers copied verbatim from thejaxlib==0.8.0wheel, plus XLA'sLICENSEand a README describing provenance and how to update.CMakeLists.txt: drop thejax.ffi.include_dir()probe; buildxla_opsagainst the vendored headers (BUILD_JAXoption kept).pyproject.toml: removejaxfrom[build-system] requires.MANIFEST.in: includec++/vendor/xla.The extension now builds on every platform, including Intel macOS. That's harmless because it's only loaded when jax is imported.
Verification
uv build(sdist, then a wheel from that sdist) with no jax installed. The sdist contains the headers and the wheel containscelerite2/jax/xla_ops.python/test/jax: 31 passed against both jax 0.12.0.1 and jax 0.8.0 at runtime.🤖 Generated with Claude Code