✨ Preserve reusable gates across Qiskit import and export - #2342
Open
burgholzer wants to merge 1 commit into
Open
✨ Preserve reusable gates across Qiskit import and export#2342burgholzer 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 23:12
e784ed2 to
86f99a1
Compare
burgholzer
force-pushed
the
codex/qiskit-reusable-gates
branch
from
September 3, 2026 23:12
afd7d4c to
7fdb302
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Import custom Qiskit Gate definitions as private unitary QC functions and export supported QC calls back to Qiskit Gates. Preserve nested definitions, parameters, names, and supported modifiers while keeping generic Instructions flattened. Bound definition interning and validation keep large reusable-gate graphs compact and fail closed on unsupported inputs. Assisted-by: GPT-5.6 via Codex
burgholzer
force-pushed
the
codex/qiskit-reusable-gates
branch
from
September 4, 2026 21:59
7fdb302 to
6328d48
Compare
burgholzer
force-pushed
the
codex/openqasm-reusable-gates
branch
from
September 4, 2026 21:59
86f99a1 to
e16931c
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 custom Qiskit
Gatedefinitions as private unitary QC functions and export supported calls back to reusable Qiskit Gates. Retain nested calls, scalar parameters, external names, global phase, and supported inverse, control, and power modifiers. GenericInstructiondefinitions remain expanded because arbitrary Clbit calls require a classical-reference ABI.This PR is stacked on #2338. MLIR call-graph and SCC traversal provides callee-first export order. Definition interning uses source-name/parameter-hash buckets plus Qiskit circuit equality so copied but equivalent Gate objects share one function without a global quadratic scan. The 64-level import and export bounds fail closed on arbitrary mutable Python definition graphs and keep emitted circuits re-importable.
Codex implemented and tested the changes with independent Qiskit/MLIR specialist review. Regressions cover nested and parameterized gates, modifiers, unsupported boundaries, export/reimport, a 60-helper shared graph, and depth limits.
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).