Skip to content

Conversation

@RoyElkabetz
Copy link
Contributor

@RoyElkabetz RoyElkabetz commented Dec 3, 2025

Summary

This PR adds an input flag to the circuit schedule draw_ method which will force instructions merging according the following conditions:

  1. instructions must take place on the same channel, same branch and being part of the same instruction group (i.e. measurement, reset, etc')
  2. instructions must be temporally continuous

If those two conditions are met, then the instructions will be merged into a single instruction.

This new behavior is set to false by default. For enabling, set merge_common_instructions = True.

Details

Here is a concrete example. Consider the following schedule,

"main,reset_4,Qubit 4,7,64,play\n"
"main,reset_4,Qubit 4,71,108,play\n"
"main,reset_4,AWGR1_0,118,325,capture\n"
"main,reset_4,Qubit 4,179,64,play\n"
"main,reset_4,Qubit 4,243,64,play\n"
"main,reset_4,Qubit 4,577,8,play\n"

in the case where merge_common_instructions = True, the above schedule will become

"main,reset_4,Qubit 4,7,300,play\n"
"main,reset_4,AWGR1_0,118,325,capture\n"
"main,reset_4,Qubit 4,577,8,play\n"

because

"main,reset_4,Qubit 4,7,64,play\n"    ---> t0: 7,   tf = t0 +  64 =  71
"main,reset_4,Qubit 4,71,108,play\n"  ---> t0: 71,  tf = t0 + 108 =  179
"main,reset_4,Qubit 4,179,64,play\n"  ---> t0: 179, tf = t0 +  64 =  243
"main,reset_4,Qubit 4,243,64,play\n"  ---> t0: 243, tf = t0 +  64 =  307

@RoyElkabetz
Copy link
Contributor Author

With this flag enabled, the following schedule

image

would become

image

Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Overall, LGTM, I only left a small comment in the reno, and you will need to fix the merge conflict before being able to merge the PR.

@RoyElkabetz RoyElkabetz requested a review from ElePT December 6, 2025 20:52
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM

@ElePT ElePT enabled auto-merge December 8, 2025 07:08
@ElePT ElePT added this pull request to the merge queue Dec 8, 2025
Merged via the queue into Qiskit:main with commit 7c6c552 Dec 8, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants