Skip to content

✨ Support reusable QC functions in QIR output - #2340

Merged
burgholzer merged 1 commit into
mainfrom
codex/qir-reusable-functions
Sep 6, 2026
Merged

✨ Support reusable QC functions in QIR output#2340
burgholzer merged 1 commit into
mainfrom
codex/qir-reusable-functions

Conversation

@burgholzer

@burgholzer burgholzer commented Sep 3, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Prepare reusable functions for Base and Adaptive QIR with the stock MLIR inliner. Coordinated QIR output inlines before QCO optimization so existing synthesis can reduce compound helpers, then normalizes global phases, unrolls modifiers, and canonicalizes before QIR conversion.

This PR is stacked on #2339 and follows the current Programs/Pipeline library split. QC, QCO, and jeff routes retain ordinary reusable calls. Unsynthesized shared-wire compound powers remain unsupported; no unsafe power distribution or call-specific QIR lowering is added.

Compiler-created and caller-owned typed-program contexts receive the standard Func/LLVM inliner extensions. Regressions cover the public textual inline pipeline and the controlled-power numeric relative phase.

Codex implemented and tested the changes with independent QIR/MLIR specialist review.

Integrated-stack validation: release build; all 3,916 registered CTest cases with one expected skip; all 294 Qiskit translation tests; whole-file C++ lint and repository lint. Stub generation passed without tracked changes. Hosted CI is separate evidence and has not been claimed as passed.

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

@burgholzer burgholzer added feature New feature or request Core Anything related to the Core library and IR c++ Anything related to C++ code MLIR Anything related to MLIR QIR Anything related to QIR labels Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mlir/lib/Compiler/Pipeline.cpp 83.3% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer
burgholzer force-pushed the codex/qir-reusable-functions branch 2 times, most recently from ba4e07d to 7debc7d Compare September 3, 2026 03:49
@burgholzer
burgholzer force-pushed the codex/jeff-reusable-functions branch from c2f0894 to f6c4ccc Compare September 3, 2026 05:07
@burgholzer
burgholzer force-pushed the codex/qir-reusable-functions branch from 7debc7d to 763fafc Compare September 3, 2026 05:07
@burgholzer
burgholzer force-pushed the codex/jeff-reusable-functions branch from f6c4ccc to aa96714 Compare September 3, 2026 23:12
@burgholzer
burgholzer force-pushed the codex/qir-reusable-functions branch from 763fafc to 6b1d409 Compare September 3, 2026 23:12
@burgholzer
burgholzer force-pushed the codex/jeff-reusable-functions branch from aa96714 to 212d319 Compare September 4, 2026 21:59
@burgholzer
burgholzer force-pushed the codex/qir-reusable-functions branch 2 times, most recently from 01dce46 to d0936e5 Compare September 5, 2026 13:09
@burgholzer
burgholzer force-pushed the codex/jeff-reusable-functions branch 2 times, most recently from 29543df to b74fd6a Compare September 5, 2026 15:00
@burgholzer
burgholzer force-pushed the codex/qir-reusable-functions branch from d0936e5 to 0d4f103 Compare September 5, 2026 15:00
Base automatically changed from codex/jeff-reusable-functions to main September 6, 2026 10:25
@burgholzer burgholzer added this to the v4.0.0 - IEEE Quantum Week milestone Sep 6, 2026
@mergify mergify Bot added the conflict label Sep 6, 2026
Flatten reusable calls only at QIR output boundaries using MLIR's stock inliner and the existing phase, modifier, and canonicalization passes.

Register promised inliner interfaces for compiler-owned and adopted contexts, and expose QCO helpers before QIR-bound optimization.

Assisted-by: Codex
@burgholzer
burgholzer force-pushed the codex/qir-reusable-functions branch from 0d4f103 to a05c17f Compare September 6, 2026 10:39
@mergify mergify Bot removed the conflict label Sep 6, 2026

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This also feels very clean. Getting this in :shipit:

@burgholzer burgholzer self-assigned this Sep 6, 2026
@burgholzer
burgholzer enabled auto-merge (squash) September 6, 2026 10:54
@burgholzer
burgholzer merged commit ff351f4 into main Sep 6, 2026
26 checks passed
@burgholzer
burgholzer deleted the codex/qir-reusable-functions branch September 6, 2026 11:12
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 Core Anything related to the Core library and IR feature New feature or request MLIR Anything related to MLIR QIR Anything related to QIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant