Skip to content

Commit 0753501

Browse files
brandonrosclaude
andcommitted
refactor(rustc_codegen_nvvm): parameterize build.rs over LlvmFlavor
Collapse the per-LLVM duplication in the build script into a single `LlvmFlavor` struct with two const instances (LLVM7, LLVM19). One `find_llvm_config`, `find_llvm_as`, `configure_libintrinsics`, and `rustc_llvm_build` now drive both toolchain paths; `required_major_llvm_version`, `find_llvm_config_llvm7`, `find_llvm_config_llvm19`, and `find_llvm_as_llvm19` are gone. Functional changes that fall out of the refactor: - Prebuilt LLVM download now works for the `llvm19` feature too, gated on `USE_PREBUILT_LLVM=1` or as an automatic fallback when no LLVM 19 toolchain is found locally. New `PREBUILT_LLVM_URL_LLVM19` points at the `llvm-19.1.7` release tag. - Prebuilt download now supports `linux-x86_64` and `linux-aarch64` in addition to `windows-x86_64`. The "currently disabled because of segfaults" note on Linux x86_64 is gone — the prebuild repos that produce these archives have been refactored to fix the underlying issue. - `PREBUILT_LLVM_URL_LLVM7` retagged to lowercase `llvm-7.1.0/` to match the new release-tag scheme used by the prebuild repos. - `libintrinsics.bc` is no longer checked in; both LLVM versions now assemble `libintrinsics.ll` on the fly using the `llvm-as` that ships next to the resolved `llvm-config`. Removes the only remaining version-specific branch and means the LLVM 7 path can no longer drift silently when the `.ll` changes. The LLVM 7 candidate-search behavior is also slightly stricter: previously `LLVM_CONFIG` only had to literally start with "7" (matching 7, 70, 700...) and a mismatched env var skipped straight to download; now major-version match is exact and PATH `llvm-config` is tried as a fallback before downloading. `USE_PREBUILT_LLVM=1` still forces direct download. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 929562e commit 0753501

3 files changed

Lines changed: 148 additions & 141 deletions

File tree

.github/workflows/container_images.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ jobs:
3636
- name: Ubuntu-24.04/CUDA-13.0.2
3737
image: "rust-cuda-ubuntu24-cuda13"
3838
dockerfile: ./container/ubuntu24-cuda13/Dockerfile
39+
- name: Ubuntu-24.04/CUDA-13.2.1/LLVM-19.1.7
40+
image: "rust-cuda-ubuntu24-cuda13-llvm19"
41+
dockerfile: ./container/ubuntu24-cuda13-llvm19/Dockerfile
3942
- name: RockyLinux-9/CUDA-12.8.1
4043
image: "rust-cuda-rockylinux9-cuda12"
4144
dockerfile: ./container/rockylinux9-cuda12/Dockerfile
4245
- name: RockyLinux-9/CUDA-13.0.2
4346
image: "rust-cuda-rockylinux9-cuda13"
4447
dockerfile: ./container/rockylinux9-cuda13/Dockerfile
45-
- name: Ubuntu-24.04/CUDA-13.0.2/LLVM-19.1.7
46-
image: "rust-cuda-ubuntu24-cuda13-llvm19"
47-
dockerfile: ./container/ubuntu24-cuda13-llvm19/Dockerfile
4848
steps:
4949
- name: Free up space
5050
# Without this the job will likely run out of disk space.
@@ -163,12 +163,12 @@ jobs:
163163
image: "rust-cuda-ubuntu24-cuda12"
164164
- name: Ubuntu-24.04/CUDA-13.0.2
165165
image: "rust-cuda-ubuntu24-cuda13"
166+
- name: Ubuntu-24.04/CUDA-13.2.1/LLVM-19.1.7
167+
image: "rust-cuda-ubuntu24-cuda13-llvm19"
166168
- name: RockyLinux-9/CUDA-12.8.1
167169
image: "rust-cuda-rockylinux9-cuda12"
168170
- name: RockyLinux-9/CUDA-13.0.2
169171
image: "rust-cuda-rockylinux9-cuda13"
170-
- name: Ubuntu-24.04/CUDA-13.0.2/LLVM-19.1.7
171-
image: "rust-cuda-ubuntu24-cuda13-llvm19"
172172
steps:
173173
- name: Set lowercase repo owner
174174
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr A-Z a-z)" >> $GITHUB_ENV

0 commit comments

Comments
 (0)