From 67011c9cbae1107e0cec03986dead66031846c58 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Mon, 22 Aug 2022 11:04:15 -0400 Subject: [PATCH 1/9] Default set to turn off approximation_degree --- qiskit/compiler/transpiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit/compiler/transpiler.py b/qiskit/compiler/transpiler.py index ac9ccc7c0db4..dde892e2f0bd 100644 --- a/qiskit/compiler/transpiler.py +++ b/qiskit/compiler/transpiler.py @@ -71,7 +71,7 @@ def transpile( scheduling_method: Optional[str] = None, instruction_durations: Optional[InstructionDurationsType] = None, dt: Optional[float] = None, - approximation_degree: Optional[float] = None, + approximation_degree: Optional[float] = 1.0, timing_constraints: Optional[Dict[str, int]] = None, seed_transpiler: Optional[int] = None, optimization_level: Optional[int] = None, From 87f1aaff7ddc741800eed0cb1be34070172d44a4 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Fri, 9 Sep 2022 10:45:14 -0400 Subject: [PATCH 2/9] Add a release note --- .../notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml new file mode 100644 index 000000000000..e75cfec1509c --- /dev/null +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -0,0 +1,10 @@ +--- +other: + - | + This PR turns off the implicit use of `approximation_degree!=1.0` by default + in the the Qiskit transpiler at `optimization_level=3`. The transpiler should, by default, + preserve unitarity of the input up to known transformations such as one-sided permutations + and similarity transformations. This was broken by the previous use of `approximation_degree=None` + leading to incorrect results in cases such as Trotterized evolution with many tine steps where the + unitaries were being overly approximated leading to incorrect results. It was decided that + transformations that break unitary equivilence should be explicitly activated by the user. From 1946cac554b9af66c01ec2a901d08415fb577c86 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Fri, 9 Sep 2022 10:46:31 -0400 Subject: [PATCH 3/9] spelling --- releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index e75cfec1509c..18c13e54345d 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -5,6 +5,6 @@ other: in the the Qiskit transpiler at `optimization_level=3`. The transpiler should, by default, preserve unitarity of the input up to known transformations such as one-sided permutations and similarity transformations. This was broken by the previous use of `approximation_degree=None` - leading to incorrect results in cases such as Trotterized evolution with many tine steps where the + leading to incorrect results in cases such as Trotterized evolution with many time steps where unitaries were being overly approximated leading to incorrect results. It was decided that transformations that break unitary equivilence should be explicitly activated by the user. From c25f593b5b7eed8ec29a757e9dd06e194cc90c6d Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Fri, 9 Sep 2022 12:15:55 -0400 Subject: [PATCH 4/9] convert to upgrade note --- releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index 18c13e54345d..3b290a54704b 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -1,5 +1,5 @@ --- -other: +upgrade: - | This PR turns off the implicit use of `approximation_degree!=1.0` by default in the the Qiskit transpiler at `optimization_level=3`. The transpiler should, by default, From bb8ce75f24e22537cf6d4d5ad9c563e3e2dd8d4e Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Thu, 15 Sep 2022 12:33:00 -0400 Subject: [PATCH 5/9] Update releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index 3b290a54704b..e6e9837a01c4 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -1,7 +1,7 @@ --- upgrade: - | - This PR turns off the implicit use of `approximation_degree!=1.0` by default + The implicit use of ``approximation_degree!=1.0`` by default in in the the Qiskit transpiler at `optimization_level=3`. The transpiler should, by default, preserve unitarity of the input up to known transformations such as one-sided permutations and similarity transformations. This was broken by the previous use of `approximation_degree=None` From cc93191a8a9c412326a9c12323b433bb3f10cf32 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Thu, 15 Sep 2022 12:33:06 -0400 Subject: [PATCH 6/9] Update releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index e6e9837a01c4..351d537fc7a6 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -2,7 +2,7 @@ upgrade: - | The implicit use of ``approximation_degree!=1.0`` by default in - in the the Qiskit transpiler at `optimization_level=3`. The transpiler should, by default, + in the :func:`~.transpile` function when ``optimization_level=3`` is set has been disabled. The transpiler should, by default, preserve unitarity of the input up to known transformations such as one-sided permutations and similarity transformations. This was broken by the previous use of `approximation_degree=None` leading to incorrect results in cases such as Trotterized evolution with many time steps where From c70ba29c88b929146718da6bd190b616bc68a8d6 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Thu, 15 Sep 2022 12:33:15 -0400 Subject: [PATCH 7/9] Update releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml Co-authored-by: Matthew Treinish --- .../notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index 351d537fc7a6..0eecc929a8c1 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -7,4 +7,10 @@ upgrade: and similarity transformations. This was broken by the previous use of `approximation_degree=None` leading to incorrect results in cases such as Trotterized evolution with many time steps where unitaries were being overly approximated leading to incorrect results. It was decided that - transformations that break unitary equivilence should be explicitly activated by the user. + transformations that break unitary equivalence should be explicitly activated by the user. + If you desire the previous default behavior where synthesized :class:`~UnitaryGate` instructions + are approximated up to the error rates of the target backend's native instructions you can explicitly + set ``approximation_degree=None` when calling :func:`~.transpile` with ``optimization_level=3`, for + example:: + + transpile(circuit, backend, approximation_degree=None, optimization_level=3) From 90b7eb0fbdbdd593a6f26f9b46378f7f17b8d133 Mon Sep 17 00:00:00 2001 From: Paul Nation Date: Thu, 15 Sep 2022 12:33:23 -0400 Subject: [PATCH 8/9] Update releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index 0eecc929a8c1..28ff8c1b3cc1 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -4,7 +4,7 @@ upgrade: The implicit use of ``approximation_degree!=1.0`` by default in in the :func:`~.transpile` function when ``optimization_level=3`` is set has been disabled. The transpiler should, by default, preserve unitarity of the input up to known transformations such as one-sided permutations - and similarity transformations. This was broken by the previous use of `approximation_degree=None` + and similarity transformations. This was broken by the previous use of ``approximation_degree=None`` leading to incorrect results in cases such as Trotterized evolution with many time steps where unitaries were being overly approximated leading to incorrect results. It was decided that transformations that break unitary equivalence should be explicitly activated by the user. From b13ad78813e39e88db448c1501cb340da02bd84b Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 16 Sep 2022 10:13:41 -0400 Subject: [PATCH 9/9] Update releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml --- releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml index 28ff8c1b3cc1..b5cf69942984 100644 --- a/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml +++ b/releasenotes/notes/turn-off-approx-degree-df3d39eb69f7f09f.yaml @@ -10,7 +10,7 @@ upgrade: transformations that break unitary equivalence should be explicitly activated by the user. If you desire the previous default behavior where synthesized :class:`~UnitaryGate` instructions are approximated up to the error rates of the target backend's native instructions you can explicitly - set ``approximation_degree=None` when calling :func:`~.transpile` with ``optimization_level=3`, for + set ``approximation_degree=None` when calling :func:`~.transpile` with ``optimization_level=3``, for example:: transpile(circuit, backend, approximation_degree=None, optimization_level=3)