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.

@@ -0,0 +1,2 @@
Add a new ``merge_common_instructions`` input argument to :meth:`draw_circuit_schedule_timing` that
if set to ``True`` will merge instructions of the same type based on temporal continuity. No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that adding the example of how the merge works from the PR description would be really helpful for the release note, this would allow users to reference it in an easier way in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, added in c93dc47.

@RoyElkabetz RoyElkabetz requested a review from ElePT December 6, 2025 20:52
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