Skip to content

♻️ Require LLVM/MLIR for all source builds - #2732

Merged
burgholzer merged 2 commits into
mainfrom
codex/require-llvm-mlir
Oct 10, 2026
Merged

burgholzer merged 2 commits into
mainfrom
codex/require-llvm-mlir

Conversation

@burgholzer

@burgholzer burgholzer commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Require LLVM/MLIR for every MQT Core source build, including embedded builds. Remove the no-MLIR option, presets, and CI row, and use LLVM's SHA256 and unreachable facilities in place of the private implementations. Benchmark case IDs retain their exact bytes. Reuse LLVM environment lookup, scope guards, and a borrowed callback for private DD vector traversal. Scope guards also restore DD printing precision on early returns. This extracts the dependency change from #2545 without changing its error-handling APIs or exception/RTTI policy.

Installed Development consumers discover a matching LLVM SDK and inherit its headers and libraries. Runtime-only consumers still need no SDK, including when Development artifacts are present in the same installation. Optional Development lookup remains optional. Statically linked LLVM symbols stay private to the native shared libraries.

Migration: Remove BUILD_MQT_CORE_MLIR=OFF and use the regular debug or release presets. All source builds require LLVM/MLIR 23.1 or newer; Development consumers need the LLVM major/minor version used to build Core. Replace calls to the removed qdmi::unreachable() helper with llvm_unreachable("reason") and include llvm/Support/ErrorHandling.h directly. Empty QDMI environment variables now count as set; unset them to enable fallback discovery. An empty JSON configuration is diagnosed. Python APIs are unchanged.

Validation on Linux ARM64:

  • Release build with LTO: 4,005 native tests passed; one existing test skipped.
  • Built and installed the wheel: all 1,009 focused QDMI, Qiskit, and DD Python tests passed. Stub generation passed with no generated API changes. Benchmark case-ID golden tests also pass.
  • Relocated source-install consumers passed with GCC and Clang; the Clang probe used native archives without GCC LTO bitcode. Device-free add_subdirectory embedding passed.
  • Runtime-only source and wheel consumers passed with LLVM discovery disabled. Optional Development succeeded without LLVM; required/default Development failed with the intended diagnostic.
  • Shared-library export checks found no exported LLVM definitions in CoreBench or CoreQDMI; Core API exports remain available.
  • Repository lint and whole-file C++ lint passed. Existing SHA256 case-ID golden tests pass unchanged.

A focused review also checked callback lifetimes, cleanup, and environment handling. Windows/macOS execution and hosted CI remain pending.

AI assistance: Codex implemented and reviewed this change under explicit authorization.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

Remove the no-MLIR build variant and reuse LLVM for semantic case-ID
hashing and unreachable paths. Keep the existing throwing APIs and
exception settings.

Discover LLVM for installed Development consumers while keeping Runtime
lookup SDK-free. Hide statically linked LLVM implementation symbols in
the native shared libraries without changing Core's public exports.

Assisted-by: Codex
@burgholzer burgholzer added dependencies Pull requests that update a dependency file refactor Anything related to code refactoring c++ Anything related to C++ code packaging Anything related to Python packaging MLIR Anything related to MLIR labels Oct 10, 2026
@burgholzer burgholzer self-assigned this Oct 10, 2026
@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
include/mqt-core/qdmi/common/Common.hpp 0.0% 7 Missing ⚠️
src/qdmi/QDMI.cpp 66.6% 1 Missing ⚠️
src/qdmi/driver/DeviceRegistry.cpp 80.0% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Use Process::GetEnv directly and treat empty variables as present, so
invalid empty configuration is diagnosed instead of silently ignored.
Use scope_exit for Qiskit instruction cleanup and DD output precision,
including early returns. Borrow private vector callbacks with function_ref.

Assisted-by: Codex
@burgholzer burgholzer added this to the v4.1.0 - QDMI 1.4 / MQSF milestone Oct 10, 2026
@burgholzer
burgholzer merged commit 715da0e into main Oct 10, 2026
25 of 26 checks passed
@burgholzer
burgholzer deleted the codex/require-llvm-mlir branch October 10, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code dependencies Pull requests that update a dependency file MLIR Anything related to MLIR packaging Anything related to Python packaging refactor Anything related to code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant