Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
llvm_version:
description: LLVM version to build (e.g. 7.1.0 or 19.1.7)
description: LLVM version to build (e.g. 7.1.0 or 21.1.8)
required: true
default: 19.1.7
default: 21.1.8
release:
description: Publish tarballs to a GitHub release tagged llvm-<version>
type: boolean
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The repo itself contains only the build scripts and CI; the tarballs live as rel

## What's published

Each release is tagged `llvm-<version>` (e.g. `llvm-19.1.7`) and ships three assets:
Each release is tagged `llvm-<version>` (e.g. `llvm-21.1.8`) and ships three assets:

| Asset | Target triple |
|-------------------------|----------------------------|
Expand All @@ -27,7 +27,7 @@ Each tarball expands to a single top-level directory matching the target name (`
```
bin/
llvm-config[.exe] # probed by build.rs for components, cxxflags, libs
llvm-as[.exe] # used by the LLVM 19 build path to assemble libintrinsics.ll
llvm-as[.exe] # used by the LLVM 21 build path to assemble libintrinsics.ll
include/
llvm/
llvm-c/
Expand All @@ -39,7 +39,7 @@ lib/

## Build configuration

Both LLVM 7 and LLVM 19 are built with the same flags:
Both LLVM 7 and LLVM 21 are built with the same flags:

- `CMAKE_BUILD_TYPE=Release`
- `LLVM_TARGETS_TO_BUILD=X86;NVPTX` (x86_64) or `AArch64;NVPTX` (aarch64)
Expand All @@ -48,23 +48,23 @@ Both LLVM 7 and LLVM 19 are built with the same flags:
- `LLVM_INCLUDE_{EXAMPLES,TESTS,BENCHMARKS}=OFF`
- Linux only: `LLVM_BUILD_LLVM_DYLIB=ON`, `LLVM_LINK_LLVM_DYLIB=ON`, `LLVM_ENABLE_{ZLIB,TERMINFO}=ON`

Linux builds run on `ubuntu-22.04` (glibc 2.35) for both x86_64 and aarch64, giving a floor that matches the rust-cuda container baseline. Windows builds run on `windows-2022`. **LLVM 7 on Windows is compiled with `clang-cl` from the preinstalled LLVM toolchain** because MSVC v143 (the default compiler on `windows-2022`) refuses LLVM 7's older sources without source patches; LLVM 19 uses MSVC directly.
Linux builds run on `ubuntu-22.04` (glibc 2.35) for both x86_64 and aarch64, giving a floor that matches the rust-cuda container baseline. Windows builds run on `windows-2022`. **LLVM 7 on Windows is compiled with `clang-cl` from the preinstalled LLVM toolchain** because MSVC v143 (the default compiler on `windows-2022`) refuses LLVM 7's older sources without source patches; LLVM 21 uses MSVC directly.

## How to build and publish a new version

Trigger [`build-llvm.yml`](.github/workflows/build-llvm.yml) from the Actions tab via **Run workflow**, supplying the LLVM version (e.g. `7.1.0` or `19.1.7`). The matrix runs on Linux (x86_64 and aarch64) and Windows runners. With the default `release: true` input, the workflow then creates (or updates) a release tagged `llvm-<version>` and uploads both tarballs as assets — re-running clobbers the existing assets, so it's safe to retry. Untick `release` to build without publishing; tarballs are still available as run artifacts on the workflow run page.
Trigger [`build-llvm.yml`](.github/workflows/build-llvm.yml) from the Actions tab via **Run workflow**, supplying the LLVM version (e.g. `7.1.0` or `21.1.8`). The matrix runs on Linux (x86_64 and aarch64) and Windows runners. With the default `release: true` input, the workflow then creates (or updates) a release tagged `llvm-<version>` and uploads all three tarballs as assets — re-running clobbers the existing assets, so it's safe to retry. Untick `release` to build without publishing; tarballs are still available as run artifacts on the workflow run page.

## How to reproduce locally

The CI uses these scripts directly. To rebuild a tarball locally:

```sh
# Linux
LLVM_VERSION=19.1.7 INSTALL_PREFIX="$PWD/install" ./scripts/build-llvm-linux.sh
LLVM_VERSION=21.1.8 INSTALL_PREFIX="$PWD/install" ./scripts/build-llvm-linux.sh
INSTALL_PREFIX="$PWD/install" ARTIFACT_NAME=linux-x86_64 ./scripts/package-prebuilt.sh

# Windows (PowerShell)
$env:LLVM_VERSION = '19.1.7'; $env:INSTALL_PREFIX = "$PWD\install"
$env:LLVM_VERSION = '21.1.8'; $env:INSTALL_PREFIX = "$PWD\install"
./scripts/build-llvm-windows.ps1
$env:ARTIFACT_NAME = 'windows-x86_64'
bash ./scripts/package-prebuilt.sh
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-llvm-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set -euo pipefail
# matching the layout that scripts/package-prebuilt.sh expects.
#
# Required env:
# LLVM_VERSION e.g. 7.1.0 or 19.1.7
# LLVM_VERSION e.g. 7.1.0 or 21.1.8
# INSTALL_PREFIX absolute path; cmake --install target
#
# Optional env:
# WORK_DIR where to extract sources (default: $PWD/llvm-src)

: "${LLVM_VERSION:?LLVM_VERSION must be set (e.g. 7.1.0 or 19.1.7)}"
: "${LLVM_VERSION:?LLVM_VERSION must be set (e.g. 7.1.0 or 21.1.8)}"
: "${INSTALL_PREFIX:?INSTALL_PREFIX must be set}"

ARCH=$(uname -m)
Expand Down
7 changes: 6 additions & 1 deletion scripts/build-llvm-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $ErrorActionPreference = 'Stop'
# $env:INSTALL_PREFIX matching the layout scripts/package-prebuilt.sh expects.
#
# Required env:
# LLVM_VERSION e.g. 7.1.0 or 19.1.7
# LLVM_VERSION e.g. 7.1.0 or 21.1.8
# INSTALL_PREFIX absolute path; cmake --install target
#
# Notes on toolchain choice:
Expand Down Expand Up @@ -71,6 +71,11 @@ if (-not (Test-Path $srcDir)) {
# FILE/DIR type, which it determines by stat'ing — fails when the
# target hasn't been extracted yet). The build only needs llvm/,
# cmake/, and third-party/, so extract just those three subtrees.
# LLVM 21 adds compatibility symlinks in mlgo-utils before their targets.
# Extract the Python package first so Git tar can materialize those links.
if ($llvmMajor -ge 21) {
Expand-LlvmTarball $tarball @("$srcDir/llvm/utils/mlgo-utils/mlgo")
}
Expand-LlvmTarball $tarball @("$srcDir/llvm", "$srcDir/cmake", "$srcDir/third-party")
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/package-prebuilt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euo pipefail
#
# <ARTIFACT_NAME>/
# bin/llvm-config[.exe]
# bin/llvm-as[.exe] (only used by the LLVM 19 build path)
# bin/llvm-as[.exe] (only used by the modern LLVM build path)
# include/llvm/...
# include/llvm-c/...
# lib/* (static archives + shared libs on Linux)
Expand Down