All multi-circuit programs to be batched in the same request in Engine.#8036
All multi-circuit programs to be batched in the same request in Engine.#8036dstrain115 wants to merge 3 commits intoquantumlib:mainfrom
Conversation
dstrain115
commented
Apr 13, 2026
- Allow the client to accept a jobs_per_batch which batches multiple circuits within the same request.
- Adjusts the signature of the functions accordingly to match that this could include a mapping or sequence of circuits.
- Allow the client to accept a jobs_per_batch which batches multiple circuits within the same request.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8036 +/- ##
==========================================
- Coverage 99.63% 99.63% -0.01%
==========================================
Files 1110 1110
Lines 99755 99860 +105
==========================================
+ Hits 99394 99497 +103
- Misses 361 363 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Small point - if there is an internal bug for this consider adding a b/NNN link to the description. |
| program: ( | ||
| cirq.AbstractCircuit | ||
| | Sequence[cirq.AbstractCircuit] | ||
| | Mapping[str, cirq.AbstractCircuit] |
There was a problem hiding this comment.
In our internal code when we do the equivalent of passing a Sequence or Mapping here, we iterate over those in the "inner loop", e.g. the execution order would be something like:
results = [
self.run(circuit, params)
for params in sweep
for circuit in circuits
]
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_batch as defined in the Sampler base class, we expect to return a nested list where the loop over circuits is the outer loop, e.g.
results = [
[self.run(circuit, params) for params in sweep]
for circuit, sweep in zip(circuits, sweeps)
]
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 Sampler base 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 the run_batch case 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.