-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
- Qiskit Terra version: 0.25.0 (but also earlier releases and main)
- Python version: 3.11
- Operating system: Linux
What is happening?
If a target has ideal gates with all error rates of 0 reported the output from the pass will translate from one gate to another unecessarily.
How can we reproduce the issue?
from qiskit.transpiler import Target, InstructionProperties
from qiskit.circuit import QuantumCircuit, Parameter
from qiskit.circuit.library import UGate, HGate
from qiskit.compiler import transpile
target = Target(num_qubits=1)
target.add_instruction(HGate(), {(0,): InstructionProperties(error=0)})
target.add_instruction(
UGate(Parameter("a"), Parameter("b"), Parameter("c")), {(0,): InstructionProperties(error=0)}
)
qc = QuantumCircuit(1)
qc.h(0)
print(transpile(qc, target=target))
What should happen?
The output should remain as h
because it's in the target and has the same error rate and gate count as UGate
. While both outputs are valid and the transpiler is doing it's job, in this situation it's a bit unexpected for the pass to translate the gate when the input was still valid and by the error heuristics no better or worse than the translated output.
Any suggestions?
I think we probably need to add a condition to fallback to the input in the substitution checks if the output of all the synthesis routines are of equal weight.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working