Skip to content

Update LLVM Version from 16->22.1#4334

Merged
mitchdz merged 252 commits intomainfrom
llvm22_update
May 4, 2026
Merged

Update LLVM Version from 16->22.1#4334
mitchdz merged 252 commits intomainfrom
llvm22_update

Conversation

@atgeller
Copy link
Copy Markdown
Collaborator

@atgeller atgeller commented Apr 15, 2026

Summary:
Migrate CUDA-Q compiler and runtime from LLVM/MLIR 16 to LLVM/MLIR 22.1. This encompasses 154 files with ~7,300 lines of changes across the entire codebase, including op creation APIs, opaque pointer adoption, interface refactors, Python binding migration, and build system updates.

Major Changes:

  • Op Creation API: builder.create<Op>(loc, ...)Op::create(builder, loc, ...)
  • Opaque Pointers: Migrate typed LLVM pointers to opaque pointers (!llvm.ptr); remove element-type info from
    LLVMPointerType::get()
  • Rewrite Infrastructure: PatternRewriter::updateRootInPlacemodifyOpInPlace; applyPatternsAndFoldGreedily → applyPatternsGreedily
  • Pass Macros: Update pass definition macros from GEN_PASS_CLASSES to GEN_PASS_DEF_*
  • Python Bindings: Fix cross-DSO registration, return value policies, and type coercion
  • Runtime: Update JIT compilation infrastructure, LLVM target APIs, and argument conversion for opaque pointers
  • Tests: Update FileCheck patterns, QIR CHECK directives, and clang diagnostic verification for MLIR 22 output format changes
  • Toolchains: Replace gcc11, gcc12, and clang16, with bootstrapped llvm toolchain for CI testing. Follow up will work on re-enabling cross-compiler gcc12 toolchain (still used for wheel builds).

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 15, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@atgeller
Copy link
Copy Markdown
Collaborator Author

atgeller commented Apr 15, 2026

/ok to test 04d0dbc

Command Bot: Processing...

boschmitt and others added 6 commits April 16, 2026 21:17
This breaks the compiler's dependency to the runtime library.

Signed-off-by: boschmitt <7152025+boschmitt@users.noreply.github.com>
Used nanobind 2.9.2 per mlir/python/requirements.txt.
Needed some explicit `py::arg("kwarg")` though most changes are from
clang-format.

Signed-off-by: Renaud Kauffmann <rkauffmann@nvidia.com>
Fixing build errors from llvm22 migration and formatting.

---------

Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
…VM 22.1)

Signed-off-by: Sachin Pisal <spisal@nvidia.com>
schweitzpgi and others added 7 commits April 17, 2026 01:09
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
behavior. Setting it to false through a reference changes that behavior
and has potential side-effects beyond the current node being traversed.
Back out these changes pending further investigation.

Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
@sacpis
Copy link
Copy Markdown
Collaborator

sacpis commented Apr 17, 2026

/ok to test 29d712c

Command Bot: Processing...

atgeller and others added 12 commits April 17, 2026 11:31
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
@sacpis
Copy link
Copy Markdown
Collaborator

sacpis commented May 4, 2026

/ok to test 76371e2

Command Bot: Processing...

atgeller added 10 commits May 4, 2026 10:32
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Update toolchains for LLVM22 migration

Replaces existing toolchains (gcc11, gcc12, and clang16) with an updated bootstrapping llvm toolchain in devdeps.
@atgeller atgeller marked this pull request as ready for review May 4, 2026 22:13
@atgeller atgeller changed the title Llvm22 update Update LLVM Version from 16->22 May 4, 2026
@atgeller atgeller added maintenance Work items to update and improve the code base release notes Changes need to be captured in the release notes build The issue related to the CUDA Quantum build breaking change Change breaks backwards compatibility dependencies Pull requests that update a dependency file labels May 4, 2026
atgeller and others added 3 commits May 4, 2026 15:27
Signed-off-by: Adam Geller <adgeller@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
@sacpis sacpis changed the title Update LLVM Version from 16->22 Update LLVM Version from 16->22.1 May 4, 2026
@mitchdz mitchdz merged commit 508391a into main May 4, 2026
8 checks passed
@mitchdz mitchdz deleted the llvm22_update branch May 4, 2026 22:46
github-actions Bot pushed a commit that referenced this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Change breaks backwards compatibility build The issue related to the CUDA Quantum build dependencies Pull requests that update a dependency file maintenance Work items to update and improve the code base release notes Changes need to be captured in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants