diff --git a/.github/workflows/build-llvm.yml b/.github/workflows/build-llvm.yml index 204fba3..4f8eb2f 100644 --- a/.github/workflows/build-llvm.yml +++ b/.github/workflows/build-llvm.yml @@ -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- type: boolean diff --git a/README.md b/README.md index 5425df2..e27a837 100644 --- a/README.md +++ b/README.md @@ -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-` (e.g. `llvm-19.1.7`) and ships three assets: +Each release is tagged `llvm-` (e.g. `llvm-21.1.8`) and ships three assets: | Asset | Target triple | |-------------------------|----------------------------| @@ -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/ @@ -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) @@ -48,11 +48,11 @@ 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-` 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-` 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 @@ -60,11 +60,11 @@ 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 diff --git a/scripts/build-llvm-linux.sh b/scripts/build-llvm-linux.sh index 03c2cb6..e7dbb0b 100755 --- a/scripts/build-llvm-linux.sh +++ b/scripts/build-llvm-linux.sh @@ -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) diff --git a/scripts/build-llvm-windows.ps1 b/scripts/build-llvm-windows.ps1 index d3bcd3e..c5e1b33 100644 --- a/scripts/build-llvm-windows.ps1 +++ b/scripts/build-llvm-windows.ps1 @@ -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: @@ -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") } diff --git a/scripts/package-prebuilt.sh b/scripts/package-prebuilt.sh index 66e6b7d..92f214f 100755 --- a/scripts/package-prebuilt.sh +++ b/scripts/package-prebuilt.sh @@ -6,7 +6,7 @@ set -euo pipefail # # / # 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)