Skip to content

provision: build our own LLVM in the checkout - #1272

Merged
hiraditya merged 1 commit into
mainfrom
own-llvm
Oct 7, 2026
Merged

hiraditya merged 1 commit into
mainfrom
own-llvm

Conversation

@hiraditya

Copy link
Copy Markdown
Collaborator

The first step of #1269: Vx can use an LLVM built in the checkout instead of the system's.

  • scripts/provision/build_llvm.sh fetches LLVM 22.1.8 and Enzyme v0.0.302 at pinned commits into toolchain/, with a shallow clone of only llvm, mlir, clang, cmake and third-party. It builds only what Vx runs and installs it into toolchain/install:
    • LLVM and MLIR (what vxc links against, mlir-translate, opt, llc, the MLIR runner libraries);
    • clang, which vxc runs to link programs;
    • FileCheck;
    • Enzyme, built against this LLVM.
  • setup.sh uses toolchain/install before any other LLVM, and points mlir-sys, tblgen and ENZYME_LIB at it. Without toolchain/, nothing changes.
  • docs/INSTALL.md has a short section on it.

Checked: the build took 28 minutes on 14 cores and uses about 12 GB. Against it, vxc builds from scratch and the whole test suite passes (894 tests), the autodiff tests included.

Not in this PR: CI still uses the system LLVM. Building this on every run is too slow, so CI needs a cached build first.

Issue: #1269

Generated With Claude Code

scripts/provision/build_llvm.sh fetches LLVM 22.1.8 and Enzyme v0.0.302
at pinned commits into toolchain/, with a shallow clone of only the
directories it builds. It builds what Vx runs and nothing else, and
installs into toolchain/install:

- LLVM and MLIR, which vxc links against, with mlir-translate, opt,
  llc and the MLIR runner libraries;
- clang, which vxc runs to link programs;
- FileCheck, for the tests;
- Enzyme, built against this LLVM, since an LLVM plugin loads only
  into the LLVM it was built for.

setup.sh uses toolchain/install before any other LLVM, and then points
mlir-sys, tblgen and ENZYME_LIB at it. The system LLVM is still used
when there is no toolchain/.

The build took 28 minutes on 14 cores and uses about 12 GB. Against
it, vxc builds from scratch and the whole test suite passes, the
autodiff tests included. CI still uses the system LLVM: building this
on every run is too slow, so it needs a cached build first.

Issue: #1269
@hiraditya
hiraditya added this pull request to stack #1364 October 7, 2026 17:55
@hiraditya
hiraditya merged commit a3f8b46 into main Oct 7, 2026
3 checks passed
@hiraditya
hiraditya deleted the own-llvm branch October 7, 2026 18:36
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