-
Notifications
You must be signed in to change notification settings - Fork 84
Support new discrete qp.PPR in to_ppr pass.
#3185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dwierichs
wants to merge
31
commits into
main
Choose a base branch
from
lower-ppr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
4b5d10f
docs: design PennyLane PPR lowering
dwierichs 0b3833e
docs: plan PennyLane PPR lowering
dwierichs ec5ef4d
feat: lower PennyLane PPR in to-ppr
dwierichs 702d8ba
feat: preserve PPR during device preprocessing
dwierichs a9d6071
test: cover PennyLane PPR frontend lowering
dwierichs 64b3482
fix: harden to-ppr PPR-operator lowering and address final review fin…
dwierichs ec13245
test: require PennyLane PPR support
dwierichs b87dca7
tiny comment on angle convention
dwierichs 2de9ff9
remove excessive validation
dwierichs 216ae91
test: remove obsolete PPR validation cases
dwierichs 37fe90c
test: cover PPR Pauli word validation
dwierichs a608b1d
better ordering in message.
dwierichs 0cbce94
Update doc/releases/changelog-dev.md
dwierichs 6e88763
Merge branch 'main' into lower-ppr
dwierichs b0baf11
test: skip PPR tests before PennyLane support
dwierichs 37bbec3
Revert "test: skip PPR tests before PennyLane support"
dwierichs 11f7488
docs: design adjoint PPR lowering
dwierichs ba7f7cd
docs: plan adjoint PPR lowering
dwierichs e2b7543
Merge branch 'main' of github.com:PennyLaneAI/catalyst
dwierichs 90cb543
Merge branch 'main' into lower-ppr
dwierichs 6af8a39
tiny
dwierichs a8f598b
new angle convention
dwierichs 642684b
test as well
dwierichs becba4d
update passes docs
dwierichs 3f6aa57
remove helper files
dwierichs 037dd82
fix error test
dwierichs 67d67ad
reduce validation
dwierichs d1e8ac7
remove validation tests
dwierichs d22d47a
Merge branch 'main' into lower-ppr
dwierichs 1d6fa1e
bump PL version
dwierichs f64c99f
Merge branch 'main' into lower-ppr
dwierichs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the responsibility of this pass to check that the PPR op is malformed? 🤔
I would say no, because if it was does that mean we check such properties over and over again in any pass that interacts with an op? The line is not 100% clear to me, but generally assumptions the pass uses concretely uses could be added as assertions, but general verification should the responsibility of a different piece of code (normally the verifier, but this is where having opaque ops is a disadvantage, as we don't have any op-specific verifiers for them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhm yeah, that is a fair point. I am not so experienced with contributing at this level, so I was not aware that this is a bit out of place.
What would be your preference here? Drop all of the validation? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would maybe keep the validation that there is no dynamic parameter, similar to how the other ops are checked for having the right number (usually 1) of dynamic parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah not so easy. I guess a good location for verification is the PPR operator in the PBC dialect itself. It already checks that rotation kind attribute, so that's superfluous. It doesn't currently check the Pauli letters, which we could add there (it's actually supposed to be a enum attribute which have verified this intrinsically, but right now it's just strings). It does verify the length of the pauli matches the qubits though.
So I think you're right, the one that couldn't be verified there is the dynamic params since those would be silently dropped at this stage. It still irks me a bit to have that here because it has nothing to do with the pass: a PPR op with dynamic params is intrinsically malformed, no matter where it appears. Compare that to control qubits which are legal but not supported by this pass, so those should be verified.
If we look into the design philosophy in mlir, passes should generally assume that any input IR is legal, and the invariant they must fulfil is that any legal IR is transformed into legal IR at the output, otherwise the pass has a bug. The legality can be enforced by the verifier, but it can also be turned off for performance if desired. I think the goal of this philosophy is to not pay the cost of legality verification repeatedly or excessively, and to have it centralized such that it can be controlled.
Imo this means that checking dynamic args in this pass is not the right place, but I'd be happy with an assertion about it (shows that this is an assumption we make, but we are not error checking it here (with a plan on what to do if didn't hold)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that makes a lot of sense to me 👌 From my side, we can even skip the assertion about the dynamic args, unless you'd prefer it be added? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to add :)