Deprecate 'id' instructions on IBM Quantum hardware backends.#976
Conversation
|
I am curious as to why we need this here? Shouldn't the transpiler know to convert an qc = QuantumCircuit(1)
qc.id(0)
transpile(qc, basis_gates=['reset'])fails If it did then there probably wouldn't need to be these gymnastics right? |
|
Agree that the transpiler is a better place for these kinds of transformations in general. However, the behavior that's being deprecated here ( We've floated the idea in the past of providers being able to supply transpiler passes to the transpiler to handle backend or provider specific transformations or optimizations. Having this done currently by the provider was chosen because it was more inline with the ownership of those designs than the alternative (a transpiler pass which gates on |
|
Yeah but isn't unrolling always a backend specific task? Here you just need a rule to map a |
|
This case is slightly more complicated than unrolling because the IBM backends have a unique definition of While we do have a standardized interface across providers to report which instructions the device natively supports, we don't have a standardized interface to describe deprecation, removal or change of behavior for instructions, so this is for now handled by the provider. |
|
While |
You're right, I had mistakenly thought
|
|
I vote for 1. |
5c40a18 to
0e2c588
Compare
Updated to 1 in 0e2c588. |
| if not delay_support: | ||
| return |
There was a problem hiding this comment.
The warnings on line 797 and 803 say id is being replaced by delay, but that's not true if delay is not reported as supported by the backend? And can people use delay if it's not reported?
There was a problem hiding this comment.
Good point, I moved the if not delay_support: early exit earlier in the function, so the warning and 'id' search aren't performed if the device doesn't support 'delay'.
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
Summary
Updates
IBMBackend.runto inspect submitted circuits for instructions containing'id'.'id'is still reported in the device'sbasis_gates, only aDeprecationWarningis raised.'id'nor'delay'are reported as supported by the device, aDeprecationWarningis raised.'id'is no longer reported in the device'sbasis_gatesand'delay'is reported in the device'ssupported_instruction, aDeprecationWarningis raised and any'id'instructions are replaced with their equivalent ('sx'-length)'delay'instructions.Details and comments
As an example, run a
'id'-based T1 experiment onibmq_16_melbourne(the only device active device different length'sx'gates on different qubits) frommainand PR branch (forcing'id'->'delay'conversion):For reference, compare PR and main branch performance of
backend.run(...)forid_qobj,id_tqcs(up to 15,920'id'gates) andx_qobj,x_tqcs(as above, but replace all'id'gates with'x'gates to isolate worst-case performance of 'scan-for-'id'). N.B. These are single-shot runtime readings.Runtime comparison of
backend.run(...):backend.run(qc)backend.run(qc)backend.run(Qobj)backend.run(Qobj)'id''x'Isolate overhead of
backend._deprecate_id_instructions(...):backend._deprecate_id_instructions(id_tqcs)backend._deprecate_id_instructions(x_tqcs)backend._deprecate_id_instructions(id_qobj)backend._deprecate_id_instructions(x_qobj)