-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Schedule with V2 backend fails #9488
Comments
I had offline discussion with @taalexander @wshanks .
This makes me think current Qiskit transpiler underestimates the importance of lowering of measurement instruction, and it just ignores For example, from qiskit_ibm_provider import IBMProvider
v2_provider = IBMProvider()
backend_v2 = v2_provider.get_backend("ibmq_quito")
>>> backend_v2.meas_map
[[0, 1, 2, 3, 4]] this implies all qubit measurement must be synchronized together. For this circuit
one may expect measure for q_0 is delayed by 160 dt from one for q_1 (indeed current circuit scheduler returns such schedule). However, this is the consequence of careless consideration of the backend Note that this introduces a critical timing error in the dynamical decoupling pass (especially in the context of mid-circuit measurement) and IBM prover implements own scheduler. To avoid this issue and respect This also fixes the issue of missing multi-qubit measurement in the Target. |
After discussion with @mtreinish we came up with following conclusion.
According to @mtreinish
This indicates we should be able to generate parallel measurement calibration on the fly on the front end. If backend applies some alignment constraints (e.g. some trigger buffer for each acquire channel), this request must come with more rich We can assume when the This makes me think:
The new pulse measure scheduler would look like def measure(
qubits: List[int],
backend=None,
target: Optional[Target] = None,
meas_map: Optional[MeasMap] = None,
qubit_mem_slots: Optional[Dict[int, int]] = None,
measure_name: str = "measure",
) -> ScheduleBlock: then we can fix scheduling failure with V2 backend without modifying any of target / provider / measure class. (Note) |
I would relax this a bit because Also, is there a better name than |
That's fair point. I think we can return individual measurement configuration if backend doesn't provide any setting. Regarding the naming, (I think I suck at naming) something like (edit) In this sense I prefer something like |
Environment
What is happening?
Scheduling quantum circuit with V2 backend will fail. This is caused by the complicated mechanism I describe in the following. Current Qiskit scheduler is designed based off of the old IBM devices, where the measurement instruction trigger must be synchronized among all channels. Thus there must be a special instruction
measure(q_0, q_1, q_2, ..., q_N)
for an N qubit device. This (old) IBM specific behavior is hard-coded in this function.https://github.com/Qiskit/qiskit-terra/blob/a3b359b899d5d963272a7b424c8a283bc6bd4c0d/qiskit/pulse/macros.py#L22-L29
In current IBM device
meas_map
is somewhat outdated, because we can measure arbitrary combination of qubits simultaneously and at arbitrary time (but they are scheduled at the same t0 in current architecture). So this function can be simplified.On the other hand, we are now migrating from transpile arguments to a
backend.target
(which is a collection of transpile arguments) and theInstructionScheduleMap
that provides above measure instruction is absorbed in the target. This is a nested dictionary keyed on instruction name and qubits, and a pulse schedule is stored as a part of InstructionProperties class. Target can dump an instruction schedule map by consuming itself for backward compatibility, and the generated instruction schedule map contains all entries in the Target.However,
Target.add_instructions
method validates qubit number agains instruction num_qubits. In case ofMeasure
, this is single qubit instruction by definition, and thus special pulse schedulemeasure(q_0, q_1, q_2, ..., q_N)
is not accepted by the Target while it is still provided by IBM backends.https://github.com/Qiskit/qiskit-terra/blob/a3b359b899d5d963272a7b424c8a283bc6bd4c0d/qiskit/transpiler/target.py#L374-L377
In current implementation, the all qubit measure schedule is missing in the Target.
How can we reproduce the issue?
This results in
What should happen?
Circuit scheduling must work with V2 backend.
Any suggestions?
There are several approaches.
[1] We can relax target validation to accept the all qubit measure instruction. But this means we need to accept an instruction that doesn't fit in with Qiskit object representation. Thus this approach is sort of hard-coding IBM specific behavior in Qiskit and I don't prefer this approach.
[2] We can update the behavior of pulse measure macro instead. Since measure map is no longer practical, I think this is reasonable approach. However, this might be a breaking API change.
The text was updated successfully, but these errors were encountered: