Skip to content

♻️ Separate target placement from routing - #2316

Merged
burgholzer merged 2 commits into
mainfrom
codex/split-placement-pass
Sep 1, 2026
Merged

♻️ Separate target placement from routing#2316
burgholzer merged 2 commits into
mainfrom
codex/split-placement-pass

Conversation

@burgholzer

@burgholzer burgholzer commented Sep 1, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Separate deterministic qubit placement from topology-aware routing.

Target compilation now uses a compact placement pass for all-to-all targets and reserves the existing mapping pass for explicit coupling graphs. Both paths share the validated allocation discovery, capacity check, and dynamic-to-static rewrite, so the split does not duplicate the fragile part of the transformation.

This is the focused prerequisite for #2218. After this PR merges, #2218 can add its three-state connectivity policy without making the router handle an unknown topology: explicit connectivity uses mapping, all-to-all uses placement, and unknown connectivity rejects residual multi-site operations before placement.

Validated locally with:

  • 86 mapping tests
  • 139 compiler tests
  • the generated MLIR documentation build
  • the full repository lint suite
  • the canonical changed-file C++ lint suite with no clang-format or clang-tidy findings

No changelog or upgrade-guide entry is needed because this only restructures the unreleased MQT Core v4 target-compilation work.

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.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • 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.

Use compact deterministic placement for all-to-all target compilation and reserve the existing router for explicit coupling graphs. Share the validated dynamic-to-static rewrite between both passes.

Assisted-by: GPT-5.6 Sol via Codex
@burgholzer burgholzer added refactor Anything related to code refactoring c++ Anything related to C++ code MLIR Anything related to MLIR skip-changelog Changes that do not need to show up in the changelog labels Sep 1, 2026
@burgholzer burgholzer self-assigned this Sep 1, 2026
@burgholzer burgholzer added this to the v4.0.0 - IEEE Quantum Week milestone Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.18182% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...lir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp 98.1% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@simon1hofmann simon1hofmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Went through the changes and they look good to me 👍

I have one comment found by ponytail, where I'm not entirely sure if we should fix it that way:

[P2] The TableGen declaration creates an unsafe targetless public pass.

Passes.td generates createPlacementPass() and registerPlacementPass() with no CompilerTarget. That default-constructs PlacementPass, whose execution exits the process through reportFatalUsageError.

The canonical pipeline is safe because it calls the target-taking overload. The problem is the valid-looking public factory and generated place-qubits registration.

Ponytail fix: remove PlacementPass from TableGen and implement it as an explicitly target-bound PassWrapper, matching TargetNativeSynthesisPass.

Expose only:
createPlacementPass(const CompilerTarget&)

This removes code and an unusable API.

Comment thread mlir/include/mlir/Dialect/QCO/Transforms/Mapping/Mapping.h
Remove the generated targetless factory and CLI registration, and document the mapper topology precondition.

Assisted-by: GPT-5.6 Sol via Codex
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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.

Looks great! Pretty much the changes that I would expect.

Left some minor comments; otherwise let's get this merged!

Comment thread mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp
Comment thread mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp
Comment thread mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp
Comment thread mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp

@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.

LGTM now 👍🏻

@burgholzer
burgholzer merged commit b74fbb2 into main Sep 1, 2026
26 checks passed
@burgholzer
burgholzer deleted the codex/split-placement-pass branch September 1, 2026 14:45
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 MLIR Anything related to MLIR refactor Anything related to code refactoring skip-changelog Changes that do not need to show up in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants