diff --git a/crates/accelerate/src/basis/basis_translator/basis_search.rs b/crates/accelerate/src/basis/basis_translator/basis_search.rs index b8614eceb7d9..e99b34c0adb6 100644 --- a/crates/accelerate/src/basis/basis_translator/basis_search.rs +++ b/crates/accelerate/src/basis/basis_translator/basis_search.rs @@ -127,7 +127,8 @@ pub(crate) fn basis_search( let mut cost_tot = 0; let borrowed_cost = opt_cost_map.borrow(); for instruction in edge_data.rule.circuit.data.iter() { - cost_tot += borrowed_cost[&(instruction.op.name(), instruction.op.num_qubits())]; + let instruction_op = instruction.op.view(); + cost_tot += borrowed_cost[&(instruction_op.name(), instruction_op.num_qubits())]; } Ok(cost_tot - borrowed_cost[&(edge_data.source.name.as_str(), edge_data.source.num_qubits)]) diff --git a/qiskit/transpiler/passes/basis/basis_translator.py b/qiskit/transpiler/passes/basis/basis_translator.py index 9f677a5116fd..36bb27b5331b 100644 --- a/qiskit/transpiler/passes/basis/basis_translator.py +++ b/qiskit/transpiler/passes/basis/basis_translator.py @@ -36,6 +36,8 @@ from qiskit.transpiler.basepasses import TransformationPass from qiskit.transpiler.exceptions import TranspilerError from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES +from qiskit._accelerate.circuit import StandardGate +from qiskit._accelerate.basis.basis_translator import basis_search logger = logging.getLogger(__name__)