You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
As pointed out in
PennyLaneAI/jeff-mlir#10 (comment),
a conversion only depends on a dialect if it _creates_ its operations.
This PR fixes the definition of all conversions accordingly.
## Checklist
- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] ~~I have added appropriate tests that cover the new/changed
functionality.~~
- [x] ~~I have updated the documentation to reflect these changes.~~
- [x] I have added entries to the changelog for any noteworthy
additions, changes, fixes, or removals.
- [x] ~~I have added migration instructions to the upgrade guide (if
needed).~~
- [x] The changes follow the project's style guidelines and introduce no
new warnings.
- [x] The changes are fully tested and pass the CI checks.
- [x] I have reviewed my own code changes.
---------
Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
let summary = "Convert QCO dialect to QC dialect.";
13
13
14
14
let description = [{
15
-
This pass converts all operations from the QCO dialect to their equivalent
16
-
operations in the QC dialect. It handles the transformation of qubit
17
-
values in QCO to qubit references in QC, ensuring that the semantics
18
-
of quantum operations are preserved during the conversion process.
19
-
}];
15
+
This pass converts all operations from the QCO dialect to their equivalent operations in the QC dialect.
16
+
It handles the transformation of qubit values in QCO to qubit references in QC, ensuring that the semantics of quantum operations are preserved during the conversion process.
let summary = "Convert QC dialect to QCO dialect.";
13
13
14
14
let description = [{
15
-
This pass converts all operations from the QC dialect to their equivalent
16
-
operations in the QCO dialect. It handles the transformation of qubit
17
-
references in QC to qubit values in QCO, ensuring that the semantics
18
-
of quantum operations are preserved during the conversion process.
19
-
}];
15
+
This pass converts all operations from the QC dialect to their equivalent operations in the QCO dialect.
16
+
It handles the transformation of qubit references in QC to qubit values in QCO, ensuring that the semantics of quantum operations are preserved during the conversion process.
This pass lowers all operations from the QC dialect to their equivalent operations in the LLVM dialect, ensuring compliance with the QIR 2.0 standard.
16
+
It translates quantum operations and types from QC to their corresponding representations in QIR, facilitating interoperability with quantum computing frameworks that utilize the QIR standard.
17
+
18
+
Requirements:
19
+
20
+
- Input is a valid module in the QC dialect.
21
+
- The entry function must be marked with the `entry_point` attribute.
22
+
- The input entry function must consist of a single block.
23
+
Multi-block input functions are currently not supported.
24
+
- The program must have straight-line control flow (i.e., Base Profile QIR).
25
+
26
+
Behavior:
27
+
28
+
- Each QC quantum operation is replaced by a call to the corresponding QIR function in the LLVM dialect.
29
+
- Required QIR module flags are attached as attributes to the entry function.
30
+
- The pass transforms the single-block entry function into four blocks to satisfy QIR Base Profile constraints:
31
+
0. Initialization block: Sets up the execution environment and performs required runtime initialization.
32
+
1. Reversible operations block: Contains only void-returning calls to reversible quantum operations.
33
+
2. Irreversible operations block: Contains only void-returning calls to operations marked irreversible (e.g., `__quantum__qis__mz__body` and `__quantum__qis__reset__body`).
34
+
3. Epilogue block: Records measurement results and returns from the entry function.
35
+
- Blocks are connected via unconditional branches in the order listed above.
36
+
- Non-quantum dialects are lowered via MLIR's built-in conversions.
37
+
38
+
Producing LLVM IR:
39
+
40
+
- After conversion to the LLVM dialect, produce LLVM IR with:
0 commit comments