Skip to content

♻️ Consolidate shared MLIR infrastructure - #2202

Merged
burgholzer merged 5 commits into
mainfrom
codex/mqt-shared-infrastructure
Aug 20, 2026
Merged

♻️ Consolidate shared MLIR infrastructure#2202
burgholzer merged 5 commits into
mainfrom
codex/mqt-shared-infrastructure

Conversation

@burgholzer

@burgholzer burgholzer commented Aug 20, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

This pull request follows #2150 and gives shared compiler infrastructure clear ownership:

  • Move the cross-dialect global-phase normalization and modifier-unrolling passes from Dialect/Utils to the MQT dialect.
  • Centralize shared global-phase, parameter, modifier, dense-unitary, and U-gate contracts under Dialect/MQT/Utils without introducing a shared QC/QCO unitary interface.
  • Move dialect-independent constant-folding helpers to mlir/Support.
  • Build the quantum-aware module equivalence checker as test support instead of production support.
  • Remove the remaining project-owned Dialect/Utils files and document the MQT passes.

The existing pass names and behavior remain unchanged. The new layout separates MQT-owned quantum semantics, generic MLIR support, and test-only infrastructure.

Validation completed after rebasing onto the merged #2150:

  • Release build
  • 4,301 configured CTest tests with 100% success; one QDMI test skipped by its own condition
  • Generated MLIR documentation
  • Strict Sphinx documentation build
  • Repository lint suite

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.

Move cross-dialect transforms and quantum helpers under the MQT dialect, split generic constant folding into support, and share phase and parameter validation across QC and QCO.

Assisted-by: Codex
Build the quantum-aware module equivalence checker only for unit tests and remove its dialect dependencies from the production support library.

Assisted-by: Codex
@burgholzer burgholzer added refactor Anything related to code refactoring code quality Code quality improvements MLIR Anything related to MLIR skip-changelog Changes that do not need to show up in the changelog labels Aug 20, 2026
@burgholzer burgholzer self-assigned this Aug 20, 2026
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

@burgholzer

Copy link
Copy Markdown
Member Author

@denialhaag @simon1hofmann could one of you cross check this? This feels like a pretty natural follow-up to the MQT introduction.

@denialhaag denialhaag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like this change a lot! Thanks, @burgholzer! 🙂

I have four nitpicks and one actual comment, all of which you can find below.

Comment thread mlir/include/mlir/Dialect/MQT/Utils/Modifier.h Outdated
Comment thread mlir/include/mlir/Dialect/MQT/Utils/Parameter.h Outdated
Comment thread mlir/include/mlir/Support/ConstantFolding.h Outdated
Comment thread mlir/include/mlir/Support/ConstantFolding.h Outdated
Comment thread mlir/lib/Dialect/MQT/Utils/ConstantFolding.cpp
Keep dialect-independent folding helpers in support infrastructure while making their MQT ownership explicit in the include path and C++ namespace.

Assisted-by: Codex
@simon1hofmann

Copy link
Copy Markdown
Contributor

I like this change a lot! Thanks, @burgholzer! 🙂

I have four nitpicks and one actual comment, all of which you can find below.

@denialhaag is too fast with reviews 😅

Use mutable MLIR handles consistently, document the folding contract, fix direct include dependencies, and root-qualify test-support namespace references.

Assisted-by: Codex
@burgholzer

Copy link
Copy Markdown
Member Author

@denialhaag I think the latest commit should address most of your concerns (hopefully all). Would you mind to take another look?

@coderabbitai

coderabbitai Bot commented Aug 20, 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.

@denialhaag denialhaag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll approve because the namespaces are good now. Two of the comments are technically still open, but I don't want to unnecessarily block this. Feel free to resolve and merge. 🙂

Place all IR-aware shared helpers under Dialect/MQT/Utils, split broad utility headers by contract, and move non-template implementations into MLIRMQTUtils.

Model direct consumer dependencies explicitly and keep support and dialect registration layers free of the helper target.

Assisted-by: Codex
@burgholzer burgholzer added this to the MLIR Support milestone Aug 20, 2026
@burgholzer burgholzer removed the skip-changelog Changes that do not need to show up in the changelog label Aug 20, 2026
@burgholzer
burgholzer marked this pull request as ready for review August 20, 2026 22:37
@burgholzer

Copy link
Copy Markdown
Member Author

Okay. Took this for another spin and I think this is now ready to be merged 🚀
I let codex scan the upstream MLIR repository for precedents of how this is typically structured and the changes here are the result of that.
In particular, it argued for putting as much in source files as possible (turning the Utils into a real library) and for putting this under MQT/Utils, which seems to be an established pattern.

I'll tag this for auto-merge now so that it hopefully goes through over night 😴

@denialhaag

Copy link
Copy Markdown
Member

Okay. Took this for another spin and I think this is now ready to be merged 🚀
I let codex scan the upstream MLIR repository for precedents of how this is typically structured and the changes here are the result of that.
In particular, it argued for putting as much in source files as possible (turning the Utils into a real library) and for putting this under MQT/Utils, which seems to be an established pattern.

I really like how this looks now! Thanks for addressing all of my comments! 🙂

@burgholzer
burgholzer merged commit 0c50dd3 into main Aug 20, 2026
26 checks passed
@burgholzer
burgholzer deleted the codex/mqt-shared-infrastructure branch August 20, 2026 22:56
@burgholzer

Copy link
Copy Markdown
Member Author

I really like how this looks now! Thanks for addressing all of my comments! 🙂

Thanks for the good feedback! 🙌🏼

DRovara added a commit that referenced this pull request Aug 27, 2026
main moved the contents of `mlir/Dialect/Utils/Utils.h` into the `MQT/Utils`
headers in #2202. This file uses none of those symbols, and the replacement
includes it does need are already in place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DRovara added a commit that referenced this pull request Aug 27, 2026
main moved `IRVerification` out of the library and into `mlir/unittests` in
#2202, where the tests include it by its unittest-relative path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Code quality improvements MLIR Anything related to MLIR refactor Anything related to code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants