Skip to content

Conversation

@Janak-Ruia
Copy link

Summary

Fixes #15378.
This PR refactors SabreDAG’s control-flow handling to avoid cloning DAGCircuit instances. Control-flow blocks now reference lightweight Block IDs instead of owning full circuit copies.

Details and comments

Changes

InteractionKind::ControlFlow stores Block IDs rather than DAGCircuit clones

from_control_flow links to existing parent blocks instead of creating new circuits

Routing resolves Block IDs from the parent block collection during recursion

Impact

This removes redundant circuit cloning, reduces memory usage, and improves Sabre swap mapping performance—especially for deeply nested control-flow circuits.

AI tool used: Google's Antigravity with Gemini 3

@Janak-Ruia Janak-Ruia requested a review from a team as a code owner December 25, 2025 17:28
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Dec 25, 2025
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@CLAassistant
Copy link

CLAassistant commented Dec 25, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Janak Ruia seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Janak-Ruia Janak-Ruia force-pushed the feat/blockID-in-controlFlow branch from 1dcd614 to fd2f181 Compare December 25, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PR PRs from contributors that are not 'members' of the Qiskit repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove extraneous DAGCircuit storage from SabreDAG

3 participants