Skip to content

Vendor the XLA FFI headers instead of requiring jax to build - #200

Merged
dfm merged 1 commit into
mainfrom
vendor-xla-ffi-headers
Oct 24, 2026
Merged

dfm merged 1 commit into
mainfrom
vendor-xla-ffi-headers

Conversation

@dfm

@dfm dfm commented Oct 24, 2026

Copy link
Copy Markdown
Member

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). The jax==0.8.0 pin in [build-system] requires was 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 the jaxlib==0.8.0 wheel, plus XLA's LICENSE and a README describing provenance and how to update.
  • CMakeLists.txt: drop the jax.ffi.include_dir() probe; build xla_ops against the vendored headers (BUILD_JAX option kept).
  • pyproject.toml: remove jax from [build-system] requires.
  • MANIFEST.in: include c++/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 contains celerite2/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

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>
@dfm
dfm merged commit 98f905e into main Oct 24, 2026
11 checks passed
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