From b0c02cb089a8ed9d3264b3f4555574cbc035b664 Mon Sep 17 00:00:00 2001 From: Jun Doi Date: Mon, 20 Nov 2023 13:51:58 +0900 Subject: [PATCH] add optimization_level=0 to transpiler for compiling dynamic circuits --- qiskit_aer/backends/aer_compiler.py | 4 +++- ...ranspiler_lvl_for_dynamic_circuit-4ead3b497bbcc632.yaml | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix_transpiler_lvl_for_dynamic_circuit-4ead3b497bbcc632.yaml diff --git a/qiskit_aer/backends/aer_compiler.py b/qiskit_aer/backends/aer_compiler.py index d89eca1e87..1ab2bc4315 100644 --- a/qiskit_aer/backends/aer_compiler.py +++ b/qiskit_aer/backends/aer_compiler.py @@ -99,7 +99,9 @@ def compile(self, circuits, basis_gates=None, optypes=None): circuit = self._inline_initialize(circuit, compiled_optypes[idx]) if self._is_dynamic(circuit, compiled_optypes[idx]): compiled_circ = transpile( - self._inline_circuit(circuit, None, None), basis_gates=basis_gates + self._inline_circuit(circuit, None, None), + basis_gates=basis_gates, + optimization_level=0, ) compiled_circuits.append(compiled_circ) # Recompute optype for compiled circuit diff --git a/releasenotes/notes/fix_transpiler_lvl_for_dynamic_circuit-4ead3b497bbcc632.yaml b/releasenotes/notes/fix_transpiler_lvl_for_dynamic_circuit-4ead3b497bbcc632.yaml new file mode 100644 index 0000000000..e42a2b33c1 --- /dev/null +++ b/releasenotes/notes/fix_transpiler_lvl_for_dynamic_circuit-4ead3b497bbcc632.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + For dynamic circuits, aer_compiler calls transpiler without optimizaiton + level. Because id gates are removed by transpiler, noise applied id gates + did not work correctly. This fix adds optimization_level=0 not to remove + id gates of dynamic circuits