Skip to content

Commit ae2fe11

Browse files
sengthaidime10
andauthored
Rename ppr_to_ppm pass to merge_ppr_ppm (#1688)
**Context:** The `ppr_to_ppm` pass has been renamed to `merge_ppr_ppm` (same functionality). A new `ppr_to_ppm` will handle decomposition of non-Clifford PPRs into PPMs. --------- Co-authored-by: David Ittah <[email protected]>
1 parent 2bd942d commit ae2fe11

File tree

8 files changed

+21
-17
lines changed

8 files changed

+21
-17
lines changed

doc/releases/changelog-dev.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<h3>Breaking changes 💔</h3>
1717

1818
* Catalyst has removed the `experimental_capture` keyword from the `qjit` decorator in favour of
19-
unified behaviour with PennyLane.
19+
unified behaviour with PennyLane.
2020
[(#1657)](https://github.com/PennyLaneAI/catalyst/pull/1657)
2121

2222
Instead of enabling program capture with Catalyst via `qjit(experimental_capture=True)`, program capture
@@ -42,6 +42,9 @@
4242

4343
Disabling program capture can be done with `qml.capture.disable()`.
4444

45+
* The `ppr_to_ppm` pass has been renamed to `merge_ppr_ppm` (same functionality). A new `ppr_to_ppm` will handle direct decomposition of PPRs into PPMs.
46+
[(#1688)](https://github.com/PennyLaneAI/catalyst/pull/1688)
47+
4548
<h3>Deprecations 👋</h3>
4649

4750
<h3>Bug fixes 🐛</h3>
@@ -75,6 +78,7 @@
7578
This release contains contributions from (in alphabetical order):
7679

7780
Joey Carter,
81+
Sengthai Heng,
7882
David Ittah,
7983
Christina Lee,
8084
Erick Ochoa Lopez,

frontend/catalyst/passes/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
cancel_inverses,
3838
commute_ppr,
3939
ions_decomposition,
40+
merge_ppr_ppm,
4041
merge_rotations,
41-
ppr_to_ppm,
4242
to_ppr,
4343
)
4444
from catalyst.passes.pass_api import Pass, PassPlugin, apply_pass, apply_pass_plugin
@@ -53,5 +53,5 @@
5353
"PassPlugin",
5454
"apply_pass",
5555
"apply_pass_plugin",
56-
"ppr_to_ppm",
56+
"merge_ppr_ppm",
5757
)

frontend/catalyst/passes/builtin_passes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def circuit():
451451
return PassPipelineWrapper(qnode, "commute_ppr")
452452

453453

454-
def ppr_to_ppm(qnode):
454+
def merge_ppr_ppm(qnode):
455455
R"""
456456
Specify that the MLIR compiler pass for absorbing Clifford Pauli
457457
Product Rotation (PPR) operations, :math:`\exp{iP\tfrac{\pi}{4}}`,
@@ -477,7 +477,7 @@ def ppr_to_ppm(qnode):
477477
import pennylane as qml
478478
from catalyst import qjit, measure
479479
480-
ppm_passes = [("PPM",["to_ppr", "commute_ppr","ppr_to_ppm",])]
480+
ppm_passes = [("PPM",["to_ppr", "commute_ppr","merge_ppr_ppm",])]
481481
482482
@qjit(pipelines=ppm_passes, keep_intermediate=True, target="mlir")
483483
@qml.qnode(qml.device("lightning.qubit", wires=1))
@@ -498,4 +498,4 @@ def circuit():
498498
. . .
499499
500500
"""
501-
return PassPipelineWrapper(qnode, "ppr_to_ppm")
501+
return PassPipelineWrapper(qnode, "merge_ppr_ppm")

frontend/catalyst/passes/pass_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,5 +376,5 @@ def _API_name_to_pass_name():
376376
"ions_decomposition": "ions-decomposition",
377377
"to_ppr": "to_ppr",
378378
"commute_ppr": "commute_ppr",
379-
"ppr_to_ppm": "ppr_to_ppm",
379+
"merge_ppr_ppm": "merge_ppr_ppm",
380380
}

mlir/include/QEC/Transforms/Passes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def CommuteCliffordTPPRPass : Pass<"commute_ppr"> {
3737
let constructor = "catalyst::createCommuteCliffordTPPRPass()";
3838
}
3939

40-
def CommuteCliffordPastPPMPass : Pass<"ppr_to_ppm"> {
40+
def CommuteCliffordPastPPMPass : Pass<"merge_ppr_ppm"> {
4141
let summary = "Absorb Clifford operations into Pauli Product Measurement operations.";
4242

4343
let dependentDialects = [

mlir/lib/QEC/Transforms/CommuteCliffordPastPPM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#define DEBUG_TYPE "ppr_to_ppm"
15+
#define DEBUG_TYPE "merge_ppr_ppm"
1616
#include "llvm/Support/Casting.h"
1717
#include "llvm/Support/Debug.h"
1818

mlir/lib/QEC/Transforms/commute_clifford_past_ppm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#define DEBUG_TYPE "ppr_to_ppm"
15+
#define DEBUG_TYPE "merge_ppr_ppm"
1616

1717
#include "llvm/Support/Debug.h"
1818

mlir/test/QEC/CommuteCliffordPastPPMTest.mlir

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// RUN: quantum-opt --ppr_to_ppm --split-input-file -verify-diagnostics %s | FileCheck %s
15+
// RUN: quantum-opt --merge_ppr_ppm --split-input-file -verify-diagnostics %s | FileCheck %s
1616

17-
func.func public @ppr_to_ppm_test_1(%q1: !quantum.bit) -> tensor<i1> {
17+
func.func public @merge_ppr_ppm_test_1(%q1: !quantum.bit) -> tensor<i1> {
1818

1919
// CHECK-NOT: qec.ppr["X"](4)
2020
// CHECK: qec.ppm ["X"] %
@@ -25,7 +25,7 @@ func.func public @ppr_to_ppm_test_1(%q1: !quantum.bit) -> tensor<i1> {
2525
return %from_elements : tensor<i1>
2626
}
2727

28-
func.func public @ppr_to_ppm_test_2(%q1: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
28+
func.func public @merge_ppr_ppm_test_2(%q1: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
2929

3030
// CHECK-NOT: qec.ppr["X"](4)
3131
// CHECK: qec.ppm ["Z"](-1) %
@@ -36,7 +36,7 @@ func.func public @ppr_to_ppm_test_2(%q1: !quantum.bit) -> (tensor<i1>, !quantum.
3636
return %from_elements, %out_qubits : tensor<i1>, !quantum.bit
3737
}
3838

39-
func.func public @ppr_to_ppm_test_3(%q1: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
39+
func.func public @merge_ppr_ppm_test_3(%q1: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
4040

4141
// CHECK-NOT: qec.ppr["X"](4)
4242
// CHECK: qec.ppm ["Y"] %
@@ -47,7 +47,7 @@ func.func public @ppr_to_ppm_test_3(%q1: !quantum.bit) -> (tensor<i1>, !quantum.
4747
return %from_elements, %out_qubits : tensor<i1>, !quantum.bit
4848
}
4949

50-
func.func public @ppr_to_ppm_test_4(%q1: !quantum.bit, %q2: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
50+
func.func public @merge_ppr_ppm_test_4(%q1: !quantum.bit, %q2: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
5151

5252
// CHECK: [[q0:%.+]] = qec.ppr ["X"](8) %arg0 : !quantum.bit
5353
// CHECK-NOT: ["X"](4)
@@ -62,7 +62,7 @@ func.func public @ppr_to_ppm_test_4(%q1: !quantum.bit, %q2: !quantum.bit) -> (te
6262
return %from_elements, %out_qubits#0 : tensor<i1>, !quantum.bit
6363
}
6464

65-
func.func public @ppr_to_ppm_test_5(%q1: !quantum.bit, %q2: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
65+
func.func public @merge_ppr_ppm_test_5(%q1: !quantum.bit, %q2: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
6666

6767
// CHECK: [[q0:%.+]] = qec.ppr ["X"](8) %arg0 : !quantum.bit
6868
// CHECK-NOT: qec.ppr ["Y"](4)
@@ -77,7 +77,7 @@ func.func public @ppr_to_ppm_test_5(%q1: !quantum.bit, %q2: !quantum.bit) -> (te
7777
return %from_elements, %out_qubits#0 : tensor<i1>, !quantum.bit
7878
}
7979

80-
func.func public @ppr_to_ppm_test_6(%q1: !quantum.bit, %q2: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
80+
func.func public @merge_ppr_ppm_test_6(%q1: !quantum.bit, %q2: !quantum.bit) -> (tensor<i1>, !quantum.bit) {
8181

8282
// CHECK: [[q1:%.+]]:2 = qec.ppr ["X", "X"](8) %arg0, %arg1
8383
// CHECK: [[m1:%.+]], [[o1:%.+]]:2 = qec.ppm ["X", "Z"] [[q1]]#0, [[q1]]#1

0 commit comments

Comments
 (0)