Skip to content

🐛 Harden MLIR conversion pass boundaries - #2282

Merged
burgholzer merged 4 commits into
mainfrom
codex/mlir-conversion-pass-contracts
Aug 30, 2026
Merged

🐛 Harden MLIR conversion pass boundaries#2282
burgholzer merged 4 commits into
mainfrom
codex/mlir-conversion-pass-contracts

Conversation

@burgholzer

@burgholzer burgholzer commented Aug 30, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Make the module-wide MLIR conversion contract explicit and fail closed at two unsafe conversion boundaries.

  • Anchor the CBit-to-MemRef, Jeff/QCO, QCO/QC, and QC/QIR passes on mlir::ModuleOp, then use the typed pass root directly.
  • Validate Jeff entry-point metadata and report malformed attributes as pass diagnostics instead of terminating the process.
  • Reject multi-block QIR Base entry functions before normalization can mutate unsupported input.
  • Inline the now-infallible, one-call Jeff cleanup path found by the Ponytail re-audit.

No new dependencies or public API changes are introduced.

Codex materially assisted with implementation, review, validation, and this pull-request text.

Validation:

  • uvx nox -s lint
  • uvx nox -s cpp-lint
  • cmake --build --preset release -j2
  • ctest --preset release --output-on-failure (4,033 passed; one expected skip)

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. (Not applicable: no user-facing contract changed.)
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals. (Not applicable: internal hardening only.)
  • I have added migration instructions to the upgrade guide (if needed). (Not 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.

Declare module-wide conversion passes on ModuleOp and use the typed pass root in their implementations. This prevents unsafe nested invocation and removes redundant runtime casts.

Assisted-by: Codex
Validate the jeff entry-point attributes before dialect conversion and report invalid metadata through the pass diagnostic instead of terminating the process.

Assisted-by: Codex
Check the QC entry function before normalization and type conversion. Unsupported multi-block input now fails through the pass diagnostic without mutating the module or terminating the process.

Assisted-by: Codex
Remove the one-call cleanup wrapper now that the module pass contract makes its failure path impossible.

Assisted-by: Codex
@burgholzer burgholzer added fix Fix for something that isn't working 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 Aug 30, 2026
@burgholzer burgholzer self-assigned this Aug 30, 2026
@burgholzer burgholzer added this to the MLIR Support milestone Aug 30, 2026
@burgholzer burgholzer removed the skip-changelog Changes that do not need to show up in the changelog label Aug 30, 2026
@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@burgholzer

Copy link
Copy Markdown
Member Author

FYI: @munich-quantum-toolkit/mqt-cc some genuinely useful simplifications found while working on #2077

@burgholzer
burgholzer enabled auto-merge (squash) August 30, 2026 13:03
@burgholzer
burgholzer merged commit d1c1998 into main Aug 30, 2026
25 checks passed
@burgholzer
burgholzer deleted the codex/mlir-conversion-pass-contracts branch August 30, 2026 13:23
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 fix Fix for something that isn't working MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant