Skip to content

✨ Add configurable QDMI device discovery - #1912

Merged
burgholzer merged 13 commits into
mainfrom
codex/qdmi-configuration-foundation
Jul 29, 2026
Merged

✨ Add configurable QDMI device discovery#1912
burgholzer merged 13 commits into
mainfrom
codex/qdmi-configuration-foundation

Conversation

@burgholzer

@burgholzer burgholzer commented Jul 15, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Summary

This PR extracts the additive, MQT Core 3.x-compatible QDMI configuration
foundation from #1901. It adds stable device identities and configurable
discovery while retaining the current client interface, qdmi::Driver, FoMaC,
Qiskit, and neutral-atom APIs.

The breaking object-model refactor remains in #1901 and will be rebased onto
this foundation.

What changed

  • Discover versioned definitions from qdmi.json, [tool.qdmi], environment
    configuration, packaged fragments, and C++ runtime overrides.
  • Merge definitions by stable device ID with field-wise precedence, explicit
    disabled-ID reservation, strict validation, relative-path resolution, and
    explicit or isolated configuration modes.
  • Register and open devices by stable ID through C++, FoMaC, and Python. Fresh
    opens create independent sessions and apply per-call overrides without
    changing the configured client catalog.
  • Generate relocatable fragments for built-in devices and export neutral
    QDMI_DEVICE_ID, QDMI_DEVICE_PREFIX, and QDMI_MANIFEST_NAME CMake target
    metadata. Installed consumers can copy selected device runtimes without
    project-specific loader code.
  • Vendor the current toml++ single header used by the native TOML parser.
  • Document administration, project, environment, C++, Python, relocation, and
    static-consumer workflows.

Compatibility and impact

The public QDMI client C interface, MQT::CoreQDMIDriver, the FoMaC object
model, and the existing Qiskit and neutral-atom APIs remain available. The
unstable C++ Driver::addDynamicDeviceLibrary and Python
add_dynamic_device_library entry points are replaced by DeviceDefinition
registration and stable-ID opening; UPGRADING.md documents that migration.

Configuration discovery and registration do not load device code. A library is
loaded when a stable ID is explicitly opened or when the configured client
catalog is first materialized. Separately installed device wheels are not
scanned automatically; they can register a fallback definition or have their
runtime and generated fragment colocated by the consuming build.

Validation

  • Release configure and complete 471-step build with LLVM/MLIR 22.1.3
  • QDMI Driver suite: 109 passed
  • Registry suite: 12 passed
  • FoMaC suite: 174 passed
  • Neutral-atom FoMaC suite: 2 passed
  • Imported-device consumer tests: 2 passed
  • DDSIM suite: 45 passed
  • QIR JIT, runtime, and runner suites: 9, 63, and 5 passed
  • Python stub generation through the aggregate wheel target
  • uvx nox -s lint
  • git diff --check

Fixes #1362
Fixes #1363

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.53229% with 47 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/qdmi/driver/DeviceRegistry.cpp 93.0% 18 Missing ⚠️
src/qdmi/driver/Driver.cpp 91.6% 11 Missing ⚠️
include/mqt-core/fomac/FoMaC.hpp 72.7% 9 Missing ⚠️
src/fomac/FoMaC.cpp 60.8% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer burgholzer added refactor Anything related to code refactoring minor Minor version update QDMI Anything related to QDMI labels Jul 15, 2026
@burgholzer burgholzer added this to the QDMI Support milestone Jul 15, 2026

@MatthiasReumann MatthiasReumann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort 🙏

I've left one small remark, otherwise I think this one looks good 👍🏻

Comment thread include/mqt-core/qdmi/DeviceRegistry.hpp Outdated
@burgholzer burgholzer self-assigned this Jul 16, 2026
@mergify mergify Bot added the conflict label Jul 16, 2026
@burgholzer
burgholzer force-pushed the codex/qdmi-configuration-foundation branch from a7e64c8 to 1f751ea Compare July 16, 2026 14:03
@mergify mergify Bot added conflict and removed conflict labels Jul 16, 2026
@burgholzer
burgholzer force-pushed the codex/qdmi-configuration-foundation branch from 86a14a3 to ee76cdc Compare July 24, 2026 18:28
@mergify mergify Bot removed the conflict label Jul 24, 2026
Assisted-by: GPT-5.6 via Codex
Assisted-by: GPT-5.6 via Codex
@burgholzer
burgholzer force-pushed the codex/qdmi-configuration-foundation branch from ee76cdc to f517297 Compare July 24, 2026 22:55
Assisted-by: GPT-5.6 via Codex
Assisted-by: GPT-5.6 via Codex
Assisted-by: GPT-5.6-terra via Codex
Document that higher-precedence configuration must explicitly re-enable a device and cover both inherited-disable and explicit-enable behavior.

Assisted-by: GPT-5.6-sol via Codex
Use QDMI-owned target property names so independent device implementations can advertise their stable identifier and symbol prefix without coupling their exported CMake targets to MQT Core. Remove the source-tree discovery artifact ignore now that the underlying CMake behavior is being extracted separately.

Assisted-by: GPT-5.6 via Codex
Preserve the filesystem-path contract in the new Python device definition API so callers can pass os.PathLike values and receive pathlib.Path objects without lossy string conversions.

Assisted-by: GPT-5.6 via Codex
Describe disabled-ID fallback semantics consistently and remove stale
iteration details from the completed execution plan.

Assisted-by: GPT-5.6-sol via Codex
burgholzer added a commit that referenced this pull request Jul 27, 2026
🤖 *AI text below* 🤖

## Description

CMake 4.3 writes a `cmake_test_discovery_*.json` bookkeeping file to the
directory passed to `gtest_discover_tests(WORKING_DIRECTORY ...)`. Our
test helpers passed source directories there because the same argument
also controls the runtime working directory of each discovered test. As
a result, configuring and building tests could dirty the source tree.

Run GoogleTest discovery from the current binary directory so the
bookkeeping file remains a build artifact. Preserve the existing runtime
working directory by setting the discovered tests' `WORKING_DIRECTORY`
property separately. The property name is deferred through a generator
expression so CMake's argument parser does not interpret it as a second
discovery option.

This is extracted from #1912 because it is independent of the QDMI
configuration work.

## Validation

- Configured and built representative targets with CMake 4.3.2.
- Confirmed that no `cmake_test_discovery_*.json` files appear outside
`build/`.
- Confirmed that the ordinary helper still runs a FoMaC test from its
source directory.
- Confirmed that the custom-working-directory helper still runs an IR
test from its configured build directory.
- `uvx nox -s lint`
- `git diff --check`

## Checklist

- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] I have added appropriate tests that cover the new/changed
functionality. (Existing tests exercise both helper variants.)
- [x] I have updated the documentation to reflect these changes. (No
user-facing documentation change is needed.)
- [x] I have added entries to the changelog for any noteworthy
additions, changes, fixes, or removals. (Not user-facing.)
- [x] I have added migration instructions to the upgrade guide (if
needed). (No migration is needed.)
- [x] The changes follow the project's style guidelines and introduce no
new warnings.
- [x] The changes are fully tested and pass the CI checks. (Local checks
pass; CI is pending.)
- [x] I have reviewed my own code changes.

**If PR contains AI-assisted content:**

- [x] Any agent that created, edited, or submitted GitHub content was
explicitly authorized for that scope, as required by our [AI Usage
Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md).
- [x] Every agent-authored or agent-edited public text body begins with
the visible disclosure `🤖 *AI text below* 🤖` (titles are exempt).
- [x] AI-assisted commits include an `Assisted-by: [Model Name] via
[Tool Name]` footer.
- [x] I confirm that I have personally reviewed and understood all
AI-generated content, and accept full responsibility for it.
burgholzer added a commit that referenced this pull request Jul 29, 2026
🤖 *AI text below* 🤖

## Description

Complete the public `qdmi::toString` mappings for the child-device
session parameter and device property introduced with child-device
support. This keeps diagnostics and property-name formatting exhaustive
for the current QDMI enum surface.

This small fix was identified while reviewing #1912 and is extracted
because it has no dependency on configurable device discovery. The
existing child-device changelog entry now also attributes this follow-up
to #1952 and retains the original human author attribution.

## Validation

- Focused child-device string-conversion tests: 2 passed
- Complete FoMaC C++ test binary: 171 passed
- `uvx nox -s lint`
- `git diff --check`

## Checklist

- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] I have added appropriate tests that cover the changed
functionality.
- [x] Documentation and migration guidance are not needed for this
diagnostic-string completion.
- [x] The existing changelog entry includes this PR and all human
authors.
- [x] The change follows the project's style guidelines and introduces
no new warnings.
- [x] The changes are fully tested and pass the relevant local checks.
- [x] I have reviewed my own code changes.

**If PR contains AI-assisted content:**

- [x] Any agent that created, edited, or submitted GitHub content was
explicitly authorized for that scope, as required by our [AI Usage
Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md).
- [x] Every agent-authored or agent-edited public text body begins with
the visible disclosure `🤖 *AI text below* 🤖` (titles are exempt).
- [x] AI-assisted commits include an `Assisted-by: [Model Name] via
[Tool Name]` footer.
- [x] I confirm that I have personally reviewed and understood all
AI-generated content, and accept full responsibility for it.
Integrate the mandatory LLVM/MLIR and unconditional QIR build from #1953.

Assisted-by: GPT-5.6-sol via Codex
Build the mandatory MLIR Python binding through the aggregate wheel target and generate its stub without probing for availability.

Assisted-by: GPT-5.6-sol via Codex
@burgholzer
burgholzer marked this pull request as ready for review July 29, 2026 18:00
@burgholzer
burgholzer dismissed MatthiasReumann’s stale review July 29, 2026 18:01

Dismissing as stale.

This has been polished quite a bit. It should now be ready to go in.

@burgholzer
burgholzer enabled auto-merge (squash) July 29, 2026 18:53
@burgholzer
burgholzer merged commit 72c5f5f into main Jul 29, 2026
33 checks passed
@burgholzer
burgholzer deleted the codex/qdmi-configuration-foundation branch July 29, 2026 19:36
burgholzer added a commit that referenced this pull request Jul 29, 2026
🤖 *AI text below* 🤖

## Summary

- add exact-byte FoMaC submission and retrieval for binary QDMI programs
while preserving null-terminated text handling
- expose the complete standard QDMI program-format enum in Python and
enforce text/binary representation contracts
- let embedding projects reuse an existing `spdlog::spdlog` target when
adding MQT Core as a subdirectory
- exercise textual QASM and real QIR bitcode paths through the DDSIM
QDMI device

## Context

This is an independent prerequisite for the QDMI integration in
NVIDIA/cuda-quantum#4882. It does not depend on #1912 and can merge
separately. Stable-ID device registration and selective provider
composition remain part of #1912. QIR support is provided
unconditionally by MQT Core following #1953; this PR does not add
feature or capability negotiation.

## Validation

- release configure and focused build with LLVM/MLIR 22.1.3
- 172 native FoMaC tests
- 47 DDSIM QDMI device tests, including QIR string and binary profiles
- 178 focused Python FoMaC tests
- focused parent-provided `spdlog::spdlog` CMake configure test
- full repository lint
- warning-as-error documentation build

---------

Signed-off-by: Lukas Burgholzer <burgholzer@me.com>
burgholzer added a commit to Munich-Quantum-Software-Stack/QDMI that referenced this pull request Jul 29, 2026
🤖 *AI text below* 🤖

## Description

Add the QDMI-owned `configure_qdmi_device_target` CMake helper for
publishing a
device target's stable ID and symbol prefix through the neutral
`QDMI_DEVICE_ID` and `QDMI_DEVICE_PREFIX` target properties. The
properties are
preserved when the target is exported and installed.

Update the C++ example and generated device template to use the helper.
Newly
generated projects receive an overridable `<PREFIX>_QDMI_DEVICE_ID` with
the
default `<lowercase-prefix>.default`, and document why that identifier
should
remain stable.

This is the QDMI side of
[MQT Core
#1912](munich-quantum-toolkit/core#1912),
which is the first consumer of this metadata. Device implementations do
not
gain a build-time or runtime dependency on MQT Core.

## Checklist

- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] I have added appropriate tests that cover the new/changed
functionality.
- [x] I have updated the documentation to reflect these changes.
- [x] I have added entries to the changelog for any noteworthy
additions, changes, fixes, or removals.
- [x] I have added migration instructions to the upgrade guide (if
needed).
- [x] The changes follow the project's style guidelines and introduce no
new warnings.
- [x] The changes are fully tested and pass the CI checks.
- [x] I have reviewed my own code changes.

**If PR contains AI-assisted content:**

- [x] I have disclosed the use of AI tools in the PR description as per
our [AI Usage
Guidelines](https://munich-quantum-software-stack.github.io/QDMI/latest/md_docs_2ai__usage.html).
- [x] AI-assisted commits include an `Assisted-by: [Model Name] via
[Tool Name]` footer.
- [x] I confirm that I have personally reviewed and understood all
AI-generated content, and accept full responsibility for it.
burgholzer added a commit that referenced this pull request Jul 30, 2026
🤖 *AI text below* 🤖

## Description

Backport selected changes from `main` to the maintained `v3.x` branch in
preparation for MQT Core 3.8.0.

The commits are kept separate by upstream change wherever practical. The
series includes:

- configurable QDMI device discovery and stable-ID registration from
#1912
- binary-safe FoMaC/QDMI program handling from #1957
- CMake subproject composability and individually selectable bundled
QDMI devices from the current #1965 head
(`cdc740398e472c19b585cf6dbd7d41de053d84a6`)
- optional QIR support for the DDSIM QDMI device and the associated QIR
runtime improvements
- native RCCX support and the bottom-up DD construction path
- Python CI performance improvements from #1944
- template synchronization through #1964, agent/contributor guide
updates, dependency and pre-commit updates, and related maintenance

## v3 compatibility

This backport deliberately preserves the v3 architecture:

- LLVM/MLIR remains optional and continues to use LLVM/MLIR 21.
- QIR support is available behind the existing MLIR-dependent feature
flags.
- The mandatory LLVM/MLIR 22 transition from #1953 and
compiler-collection changes that depend on the v4 MLIR/QCO redesign are
not included.
- #1965 is adapted to retain optional MLIR and the v3 documentation
roles while preserving its CMake and QDMI behavior.

## Validation

- configured and built the complete non-MLIR library
- configured the MLIR build against LLVM/MLIR 21.1.8
- built and ran focused DD, FoMaC, QDMI driver/registry/device, and QIR
tests
- verified 435 #1965-affected C++ test cases, with two expected device
capability skips
- configured MQT Core as an embedded CMake subproject with all bundled
devices disabled by default
- configured an embedded build with only the DDSIM QDMI device enabled
- built and ran the device-free registry suite: 11 tests passed
- focused Python FoMaC suite: 181 passed, two expected non-MLIR skips
- regenerated Python stubs without a diff
- complete lint, lockfile validation, commit-signature audit, and `git
diff --check` passed

The pre-existing v3 test configuration still requires `llc` even when
MLIR is disabled. The non-MLIR library build itself succeeds; MLIR/QIR
validation used LLVM/MLIR 21.

## Checklist

- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] I have added appropriate tests that cover the new/changed
functionality.
- [x] I have updated the documentation to reflect these changes.
- [x] I have added entries to the changelog for any noteworthy
additions, changes, fixes, or removals.
- [x] I have added migration instructions to the upgrade guide (if
needed).
- [x] The changes follow the project's style guidelines and introduce no
new warnings.
- [x] The changes are fully tested and pass the CI checks.
- [x] I have reviewed my own code changes.

**If PR contains AI-assisted content:**

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

---------

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Lukas Burgholzer <burgholzer@me.com>
Signed-off-by: Roberto Turrado Camblor <rturrado@gmail.com>
Signed-off-by: rturrado <rturrado@gmail.com>
Co-authored-by: mqt-app[bot] <219534693+mqt-app[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
Co-authored-by: simon1hofmann <119581649+simon1hofmann@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Roberto Turrado Camblor <rturrado@gmail.com>
Co-authored-by: Yannick Stade <100073938+ystade@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Minor version update QDMI Anything related to QDMI refactor Anything related to code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BASEURL support through QDMI authentication ✨ Authentication per QDMI device

2 participants