Open paul0403 opened 1 week ago
Hello. You may have forgotten to update the changelog!
Please edit doc/changelog.md
on your branch with:
Attention: Patch coverage is 58.82353%
with 14 lines
in your changes missing coverage. Please review.
Project coverage is 97.84%. Comparing base (
bb73aa2
) to head (a3c9a6a
).
Files | Patch % | Lines |
---|---|---|
frontend/catalyst/api_extensions/pipeline.py | 60.86% | 9 Missing :warning: |
frontend/catalyst/compiler.py | 50.00% | 4 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
As per @josh146 's UI suggestion, adding the quantum_circuit_transforms
option to qjit
directly might not be a good idea, since a jitted workflow might contain multiple circuits, and the user might only want to run a pass on a subset of these circuits.
UI options:
QUANTUM_CIRCUIT_TRANSFORMS
pipelineWe did not decide on a UI yet; at any rate, there should be some documentation of the pass pipeline in the docs.
#######
Update: an epic regarding UI is made: https://app.shortcut.com/xanaduai/epic/67492/p1-a-ui-is-available-for-users-to-specify-quantum-compilation-pipelines-from-python-4?group_by=none&vc_group_by=day&ct_workflow=all&cf_workflow=500000005
It would make more sense for the two items of work to be separated into two PRs (since they are two different stories):
1.Cancel more than just Hadamards in mlir
2.The frontend decorator UI
Actually, having them both here makes sense too. I'll just tag both story.
Self reminder to add tests and documentation
I don't know why codecov didn't bark when I hadn't added tests yet. Do not approve!
The tests should include that the functionality of the circuit does not change under the transformation pass.
Context: This is the first in a series of works that adds a series of automatic peephole optimization passes in the Catalyst pipeline.
Description of the Change: This particular PR augments the existing
-remove-chained-self-inverse
pass. Currently this pass only cancels two neighbouring Hadamards; in fact currently this is the only peephole optimization in Catalyst. This PR adds the following self-inverse gates for cancellation: Pauli{X,Y,Z}, controlled{X,Y,Z} (note that controlled X is just CNOT), SWAP, ToffoliThis PR also adds a frontend decorator
catalyst.cancel_inverses
. When the decorator is set on a qnode, a new pipeline that performs the inverse cancelling pass will be run on this qnode. This new pipeline is turned off by default and is located afterQUANTUM_COMPILATION_PASS
, beforeBUFFERIZATION_PASS
. This position is currently arbitrary and could use some discussion.Benefits: An automatic optimization pipeline is beneficial for any compiler (e.g. the
-O3
pipeline for gcc and clang). In particular, the goal of this new series of works is to reduce the number of gate counts. The lower the gate count in a circuit, the less damage loss and errors do.Possible Drawbacks:
Related GitHub Issues:
[sc-67659] [sc-67519]