Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
for the qec dialect.
[(#2189)](https://github.com/PennyLaneAI/catalyst/pull/2189)

* A new `PauliFrame` dialect has been added. This dialect includes a set of abstractions and
operations for interacting with an external Pauli frame tracking library.
[(#2188)](https://github.com/PennyLaneAI/catalyst/pull/2188)

<h3>Documentation 📝</h3>

* A typo in the code example for :func:`~.passes.ppr_to_ppm` has been corrected.
Expand All @@ -154,6 +158,7 @@
This release contains contributions from (in alphabetical order):

Ali Asadi,
Joey Carter,
Jeffrey Kam,
Christina Lee,
River McCubbin,
Expand Down
1 change: 1 addition & 0 deletions mlir/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_subdirectory(hlo-extensions)
add_subdirectory(Ion)
add_subdirectory(MBQC)
add_subdirectory(Mitigation)
add_subdirectory(PauliFrame)
add_subdirectory(QEC)
add_subdirectory(Quantum)
add_subdirectory(Test)
2 changes: 2 additions & 0 deletions mlir/include/PauliFrame/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(IR)
# add_subdirectory(Transforms)
5 changes: 5 additions & 0 deletions mlir/include/PauliFrame/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_mlir_dialect(PauliFrameOps pauli_frame)
add_mlir_doc(PauliFrameDialect PauliFrameDialect PauliFrame/ -gen-dialect-doc -gen-op-doc)
add_mlir_doc(PauliFrameOps PauliFrameOps PauliFrame/ -gen-op-doc)

set(LLVM_TARGET_DEFINITIONS PauliFrameOps.td)
31 changes: 31 additions & 0 deletions mlir/include/PauliFrame/IR/PauliFrameDialect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2025 Xanadu Quantum Technologies Inc.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "mlir/IR/Dialect.h"

//===----------------------------------------------------------------------===//
// PauliFrame dialect declarations.
//===----------------------------------------------------------------------===//

#include "PauliFrame/IR/PauliFrameOpsDialect.h.inc"

//===----------------------------------------------------------------------===//
// PauliFrame type declarations.
//===----------------------------------------------------------------------===//

/// Uncomment the lines below if defining types for the PauliFrame dialect
// #define GET_TYPEDEF_CLASSES
// #include "PauliFrame/IR/PauliFrameOpsTypes.h.inc"
115 changes: 115 additions & 0 deletions mlir/include/PauliFrame/IR/PauliFrameDialect.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Copyright 2025 Xanadu Quantum Technologies Inc.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef PAULI_FRAME_DIALECT
#define PAULI_FRAME_DIALECT

include "mlir/IR/DialectBase.td"
include "mlir/IR/OpBase.td"

//===----------------------------------------------------------------------===//
// PauliFrame dialect definition.
//===----------------------------------------------------------------------===//

def PauliFrame_Dialect : Dialect {
let summary = "A dialect for Pauli frame tracking.";
let description = [{
The Pauli frame tracking dialect includes a set of abstractions and operations for
interacting with an external Pauli frame tracking library. A *Pauli frame tracker* [1] is a
system that tracks gates from the Pauli group in classical electronics instead of applying
them to qubits on the device. Doing so reduces the number of quantum operations applied to
the system, thus reducing the probability of errors.

A single Pauli record *Rq* tracks all the Pauli gates that are applied on qubit *q*. Every
set of tracked Pauli gates can be reduced to one of the elements in the set {I, X, Z, XZ},
hence a single Pauli record can be stored using two bits, encoded as X- and Z-parity bits:

I = (0, 0), X = (1, 0), Z = (0, 1), XZ = (1, 1)

The operations in this dialect aim to represent the Pauli frame tracking components of the
following five quantum processes required to maintain a system of universal quantum
computation, as described in Ref. [2]:

1. Initialization of a qubit to |0>:
a. Set Pauli record of target qubit to I.
b. Initialize target qubit to |0>.
2. Measurement:
a. Measure target qubit.
b. Correct measurement result based on Pauli record.
3. Pauli gates:
a. Update Pauli record of target qubit accordingly (the Pauli gates themselves are
not physically applied to the qubit).
4. Clifford gates:
a. Update Pauli record(s) of target qubit(s).
b. Apply Clifford gate on target qubit(s).
5. Non-Clifford gates:
a. Flush Pauli record(s) of target qubit(s). *Flushing* the Pauli record of a qubit
refers to physically applying the Pauli gates stored in the record on that qubit
and then resetting its record to I.
b. Apply non-Clifford gate on target qubit(s).

References
----------

[1] Knill, E. Quantum computing with realistically noisy devices. Nature 434, 39-44 (2005).
https://doi.org/10.1038/nature03350.

[2] Riesebos, L., et al. Pauli Frames for Quantum Computer Architectures.
DAC '17: Proceedings of the 54th Annual Design Automation Conference 76, 1-6 (2017).
https://doi.org/10.1145/3061639.3062300.

> [!IMPORTANT]
> The pauli_frame dialect is experimental and will not maintain API stability between releases.
> Use at your own risk.
}];

/// This is the namespace of the dialect in MLIR, which is used as a prefix for types and ops.
let name = "pauli_frame";

/// This is the C++ namespace in which the dialect and all of its sub-components are placed.
let cppNamespace = "::catalyst::pauli_frame";

let dependentDialects = [
"quantum::QuantumDialect"
];

/// Use the default type printing/parsing hooks, otherwise we would have to explicitly define them.
/// Uncomment the line below if defining attributes for the PauliFrame dialect
// let useDefaultAttributePrinterParser = 1;

/// Uncomment the line below if defining types for the PauliFrame dialect
// let useDefaultTypePrinterParser = 1;
}


//===----------------------------------------------------------------------===//
// PauliFrame dialect types.
//===----------------------------------------------------------------------===//

/// Uncomment the lines below if defining types for the PauliFrame dialect
// class PauliFrame_Type<string name, string typeMnemonic, list<Trait> traits = []>
// : TypeDef<PauliFrame_Dialect, name, traits> {
// let mnemonic = typeMnemonic;
// }


//===----------------------------------------------------------------------===//
// PauliFrame dialect base operation.
//===----------------------------------------------------------------------===//

class PauliFrame_Op<string mnemonic, list<Trait> traits = []> :
Op<PauliFrame_Dialect, mnemonic, traits>;


#endif // PAULI_FRAME_DIALECT
30 changes: 30 additions & 0 deletions mlir/include/PauliFrame/IR/PauliFrameOps.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2025 Xanadu Quantum Technologies Inc.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "Quantum/IR/QuantumDialect.h"

#include "PauliFrame/IR/PauliFrameDialect.h"

//===----------------------------------------------------------------------===//
// PauliFrame ops declarations.
//===----------------------------------------------------------------------===//

/// Uncomment the lines below if defining attributes for the PauliFrame dialect
// #define GET_ATTRDEF_CLASSES
// #include "PauliFrame/IR/PauliFrameAttributes.h.inc"

#define GET_OP_CLASSES
#include "PauliFrame/IR/PauliFrameOps.h.inc"
Loading