Upgrade modern backend to LLVM 21.1.8 and CUDA 13.3 - #408
Merged
Merged
Conversation
brandonros
marked this pull request as ready for review
September 13, 2026 22:03
Contributor
Looks like we need to install something? |
brandonros
force-pushed
the
experiment/cuda13.3-llvm21
branch
from
September 21, 2026 13:44
4decb7c to
af6880e
Compare
Contributor
Author
Replace the LLVM 19 backend feature with LLVM 21 while retaining LLVM 7 for the legacy path. Update feature forwarding, LLVM tool discovery, the vector-add example, the Nix shell, container definitions, and docs. - rustc_llvm_wrapper: guard the Instrumentation.h include to LLVM < 19 and update wrapper APIs for LLVM 21; add tests/llvm-wrapper capture checks. - nvvm: restore kernel annotations after the LLVM 21 bitcode upgrade. - cust: handle CUDA 13.3's CU_GRAPH_NODE_TYPE_RESERVED_16 graph node type. - CI: add LLVM 21 vector-add jobs on x86_64 and aarch64 using CUDA 13.3.1 and LLVM 21.1.8 prebuilts, with a configurable PREBUILT_LLVM_URL; install libzstd-dev so the static LLVM link resolves -lzstd. - Update the Windows CUDA installer action for CUDA 13.3.1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
brandonros
force-pushed
the
experiment/cuda13.3-llvm21
branch
from
September 21, 2026 13:45
af6880e to
0e5545c
Compare
Contributor
Author
|
@LegNeato Rust-GPU/rustc_codegen_nvvm-llvm#4 and then this whenever you're ready/if you have any feedback thanks |
Contributor
|
Will merge once the other one builds, thanks! |
This was referenced Sep 22, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Replace the modern LLVM 19 backend feature with LLVM 21 while retaining LLVM 7 for the legacy path. Update feature forwarding, LLVM tool discovery, the vector-add example, and documentation together. The modern Nix shell uses LLVM 21.1.8 and CUDA 13.3; CUDA 13 Docker definitions use CUDA 13.3.1 bases. Update the Windows CUDA installer action to support CUDA 13.3.1.
LLVM 21 compatibility fixes included here:
rustc_llvm_wrapper: guard thellvm/Transforms/Instrumentation.hinclude to LLVM < 19 (the header is gone in LLVM 21; only the legacy pass registry uses it) and update the wrapper to the LLVM 21 APIs.tests/llvm-wrapper/adds a small C++ check of the attribute/capture semantics the wrapper relies on.nvvm: restore kernel annotations after the LLVM 21 bitcode upgrade.cust: handle CUDA 13.3's newCU_GRAPH_NODE_TYPE_RESERVED_16graph node type, which made an existing match non-exhaustive.Extend the existing Linux CI matrix with LLVM 21 vector-add host/PTX compilation on x86_64 and aarch64, using CUDA 13.3.1 and LLVM 21.1.8 prebuilts. The six existing LLVM 7 configurations retain their workspace checks. There is no separate experiment workflow.
LLVM 21 prebuilts
The backend's default LLVM 21 download URL is the upstream
Rust-GPU/rustc_codegen_nvvm-llvmllvm-21.1.8release, which does not exist yet, so default downloads fail until it is published. That needs Rust-GPU/rustc_codegen_nvvm-llvm#4 merged and a release withlinux-x86_64.tar.xz,linux-aarch64.tar.xz, andwindows-x86_64.tar.xz.Until then, the archive directory is overridable through
PREBUILT_LLVM_URL(environment variable for the backend, repository Actions variable for CI; documented in the guide). The CI LLVM 21 jobs currently default to the same three archives published at https://github.com/brandonros/rustc_codegen_nvvm-llvm/releases/tag/llvm-21.1.8. Before merge, that default and the guide example should point at the upstream release.Status
All LLVM 7 Linux jobs, both Windows jobs, and all container image builds pass, including the new
Ubuntu-24.04/CUDA-13.3.1/LLVM-21.1.8image.The two LLVM 21 jobs compiled the wrapper and
rustc_codegen_nvvm, then failed linkinglibrustc_codegen_nvvm.sowithunable to find library -lzstd: the prebuilts are built with zstd support, sollvm-config --system-libsemits-lzstd, and the job's container did not installlibzstd-dev. The fix is to installlibzstd-devin that job.Not ready to merge: pending the upstream release, a green LLVM 21 CI run, and runtime validation. The LLVM 21 jobs only compile the vector-add example; GPU execution and broader LLVM 21 workspace checks are not covered yet.
Based directly on upstream
main; no portable PTX exporter changes are included.