✨ Preserve reusable gates across Qiskit import and export - #2342
Open
burgholzer wants to merge 4 commits into
Open
✨ Preserve reusable gates across Qiskit import and export#2342burgholzer wants to merge 4 commits into
burgholzer wants to merge 4 commits into
Conversation
12 tasks
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
Fold reusable custom Gate round trips into the existing Qiskit compiler changelog entry and record final validation in the implementation plan. Assisted-by: GPT-5.6 via Codex
Convert enumeration indices explicitly at the checked-index boundary so platforms with a distinct size_t type select the unsigned overload consistently. Assisted-by: GPT-5.6 via Codex
Use native MLIR call-graph traversal for callee-first export ordering without recursive DenseMap references. Reuse public Qiskit Gate definitions for parameter-free calls instead of recursively copying their nested bodies, and cover graph reuse through export and reimport. Assisted-by: Codex
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! |
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. Native MLIR call-graph traversal replaces recursive export ordering. Cached Qiskit Gate objects preserve shared definitions without recursively copying the same subgraph at every call; parameter binding still uses Qiskit's public conversion API. Import retains exact-name/parameter-hash bucketing and circuit equality for distinct specializations.
Codex implemented and tested the changes with independent Qiskit/MLIR specialist review. Regressions cover export and reimport of shared gate graphs and a 60-helper repeated-call program.
Integrated-stack validation: release build; 3,857 registered CTest cases with one expected skip; 259 Qiskit translation tests; whole-file C++ lint and repository lint. Stub generation passed without changes. Hosted CI remains separate and has not been claimed as passed.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).