-
Notifications
You must be signed in to change notification settings - Fork 1.3k
All multi-circuit programs to be batched in the same request in Engine. #8036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dstrain115
merged 7 commits into
quantumlib:main
from
dstrain115:add_multi_programs_client
Apr 22, 2026
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b32a750
All multi-circuit programs to be batched in the same request in Engine.
dstrain115 72c9b87
Fix coverage and tests. Add support for mapping.
dstrain115 42883be
Fix type check
dstrain115 f9c66c7
Fix issue with cross-product of sweeps.
dstrain115 b752186
formatting
dstrain115 f18fc5c
Address maffoo comments.
dstrain115 2904720
return "Oops"
dstrain115 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our internal code when we do the equivalent of passing a
SequenceorMappinghere, we iterate over those in the "inner loop", e.g. the execution order would be something like:where the results would have to be flattened into a single list to conform to the specified return type.
On the other hand, for
run_batchas defined in theSamplerbase class, we expect to return a nested list where the loop over circuits is the outer loop, e.g.I think we need to define what the intended execution order is, in particular for the first case since that is not supported at all on the
Samplerbase class. If for the first case we align with internal code where the loop over circuits is the "inner" loop, then we would either need a way to communicate the ordering to the server since therun_batchcase instead runs over servers on the outer loop. Or if we don't actually care about the order things execute on hardware then we might need to "reshape" the output from quantum engine so that we return results in the appropriate order for both multi-circuit case and run_batch case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behavior is that the engine splits all the calls into separate requests, so I don't think it is currently possible to do the first proposal (circuits in the inner loop) externally. I believe that, even after this change, the internal version will still execute in circuit order, but this mode of batching at least opens the door for the other ordering.
What if we put a disclaimer in run_batch saying that the execution order is not guaranteed if you have jobs_per_batch > 1? That way, if you depend on the circuits executing in a certain order, you can disable proto-level batching. If you just want them to execute as fast as possible, then you knowingly forgo the strict ordering of the circuits.