-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MLIR] Remove scheduling at FunctionOpInterfaces (#1407)
**Context:** The `apply_pass` function from the frontend is capable of scheduling any MLIR pass from the frontend for a specific qnode. However, in order for the pass to succeed in its compilation, it must allow itself to be scheduled to transform a module. **Description of the Change:** There is another branch that I worked on where I moved the bulk of the transformation to Patterns; however, the pattern applicators that are upstream in MLIR do not support running a single iteration of the worklist. I would like at some point to add a custom pattern applicator that doesn't fold and only does a single pass through the worklist (or take a variable). The passes as written represent a single iteration through the worklist. Running a single iteration through the worklist may not yield all full optimizations, but that's how it is currently coded. I think this is acceptable as we don't yet do a cost benefit analysis for any transformation. **Benefits:** Can write the following: ```python import jax import pennylane as qml import catalyst @qml.qjit(keep_intermediate=True) @catalyst.passes.apply_pass("disentangle-CNOT") @qml.qnode(qml.device("lightning.qubit", wires=2)) def foo(): qml.Hadamard(0) qml.Hadamard(0) qml.Hadamard(1) qml.Hadamard(1) qml.CNOT(wires=[0, 1]) return qml.state() foo() print(foo.mlir) ```
- Loading branch information
1 parent
00a9f8a
commit d08502e
Showing
5 changed files
with
175 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.