-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a frontend UI for users to specify quantum compilation pipelin…
…es (#1131) **Context:** We wish to create a frontend `pipeline` function for users to specify what circuit transformation passes to run in the dictionary form: https://app.shortcut.com/xanaduai/epic/67492/p1-a-ui-is-available-for-users-to-specify-quantum-compilation-pipelines-from-python **Description of the Change:** A new API decorator function `catalyst.passes.pipeline` can be applied to qnodes. The decorator takes in a dictionary specifying what circuit transformation passes to run on the qnode with what options, and adds the passes to the `transform_named_sequence`. In addition, `qjit` now takes in a kwarg `circuit_transform_pipeline` which expects the same pipeline dictionary. This will apply the pipeline to all qnodes in the qjit. To test the pipeline, we added the boilerplate for a merge_rotation pass with a pass option. The pass is currently empty and does nothing. The merge_rotation boilerplate pass is not exposed as a user-facing API, and only exists for the purpose of testing the pipeline. **Benefits:** User can specify pass pipelines. **Possible Drawbacks:** There are two items of improvements possible: 1. The target qnode of the pass is recorded by name. This is not optimal. The quantum scope work will likely put each qnode into a module instead of a `func.func ... attributes {qnode}` in mlir. When that is in place, the qnode's module can have a proper attribute (as opposed to discardable) that records its transform schedule, i.e. ``` module_with_transform @name_of_module { // transform schedule } { // contents of the module } ``` This eliminates the need for matching target functions by name. 2. The number of `qjit` kwargs is maybe too many. As of now we implement the syntax specified by the epic, but there could be an alternate design. [sc-67520]
- Loading branch information
Showing
12 changed files
with
664 additions
and
32 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
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
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
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
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.