diff --git a/crates/accelerate/src/basis/basis_translator/basis_search.rs b/crates/accelerate/src/basis/basis_translator/basis_search.rs index e4982bb27c7b..1e1282c0c26f 100644 --- a/crates/accelerate/src/basis/basis_translator/basis_search.rs +++ b/crates/accelerate/src/basis/basis_translator/basis_search.rs @@ -126,7 +126,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 ba915189994f..de73f5a46c08 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__)