✨ Preserve reusable gates across OpenQASM import and export - #2338
Open
burgholzer wants to merge 1 commit into
Open
✨ Preserve reusable gates across OpenQASM import and export#2338burgholzer wants to merge 1 commit into
burgholzer wants to merge 1 commit into
Conversation
12 tasks
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 3, 2026 03:52
a09bfa7 to
73cf929
Compare
burgholzer
changed the base branch from
codex/qco-function-model
to
codex/qir-reusable-functions
September 3, 2026 03:52
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
burgholzer
force-pushed
the
codex/qir-reusable-functions
branch
from
September 3, 2026 05:07
7debc7d to
763fafc
Compare
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 3, 2026 05:07
73cf929 to
e784ed2
Compare
12 tasks
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 3, 2026 23:12
e784ed2 to
86f99a1
Compare
burgholzer
force-pushed
the
codex/qir-reusable-functions
branch
2 times, most recently
from
September 4, 2026 21:59
6b1d409 to
01dce46
Compare
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 4, 2026 21:59
86f99a1 to
e16931c
Compare
burgholzer
force-pushed
the
codex/qir-reusable-functions
branch
from
September 5, 2026 13:09
01dce46 to
d0936e5
Compare
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 5, 2026 13:09
e16931c to
6bc8251
Compare
Keep custom gate definitions as private QC functions and applications as calls across import and export. Use source-order semantics and standard MLIR call-graph traversal to keep deep nonrecursive programs compact without a duplicate recursive validator. Assisted-by: Codex
burgholzer
force-pushed
the
codex/qir-reusable-functions
branch
from
September 5, 2026 15:00
d0936e5 to
0d4f103
Compare
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 5, 2026 15:00
6bc8251 to
8f02f58
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Description
Preserve OpenQASM gate definitions as reusable QC functions and emit supported helpers as dependency-ordered OpenQASM gate declarations. Straight-line gates use the unitary-function contract; structured gate bodies remain private generic functions.
This PR is stacked on #2340. MLIR call-graph and SCC traversal provides callee-first export order, while the OpenQASM semantic analyzer rejects recursion before emission. Gate-expression export retains integer-to-float promotion, so expressions such as a converted loop index divided by two preserve floating-point semantics.
The exporter retains the current classical-register safeguards. Gate bodies cannot use mutable classical state; generic OpenQASM subroutines and a classical-reference call ABI are outside this change.
Codex implemented and tested the changes with independent OpenQASM/MLIR specialist review. Regressions cover a 100-function program, numeric loop expressions, strict reparsing, and QC ↔ QCO round trips.
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
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).