Skip to content
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

[Frontend] Program verification #626

Merged
merged 183 commits into from
Jun 13, 2024
Merged

[Frontend] Program verification #626

merged 183 commits into from
Jun 13, 2024

Conversation

sergei-mironov
Copy link
Contributor

@sergei-mironov sergei-mironov commented Mar 22, 2024

Context: Having a proper encoding for the device capabilites, we implement the main part of program verification in this PR.

Description of the Change:
[sc-55558]
[sc-60607]
[sc-60648]

  • Verify that no MCM (measure op) is present in the call
  • Verify that no callbacks are present in the call tree (future: verify that callbacks have custom vjp or are io callbacks)
  • Verify that no state or variance is returned from the QNode. (Double check if Lightning Adjoint supports this!)
  • adjoint diff method: Does the Tape only contain operations deemed differentiable by the QJITDevice from the TOML spec?
  • parameter-shit method: Does the Tape only contain operations that support the 2-term parameter shift rule?

Benefits:

Possible Drawbacks:

Related GitHub Issues:

The following PRs need to be merged before this one:

Sergei Mironov added 30 commits March 14, 2024 10:00
lillian542 and others added 21 commits June 7, 2024 11:15
@lillian542 My proposal would be removing the (single-op) Adjoint class
in Catalyst entirely, which would get rid of the issues we faced.
Instead, we dispatch directly to PennyLane's Adjoint when a single op is
received by Catalyst.
It does requires that `Adjoint(gate)` can be lowered directly to a
single operator in MLIR, which I've added. I also updated the
verification to match.
It also relies on the addition of a `create_adjoint_op` function to
PennyLane similar to the existing `create_controlled_op` function.

If you think this is a good direction I would update to the latest main
branch to get the QCtrl changes in, and update them similarly to what
I've done with Adjoint.

[sc-65586]
frontend/catalyst/programs/verification.py Outdated Show resolved Hide resolved
frontend/catalyst/programs/verification.py Outdated Show resolved Hide resolved
@dime10 dime10 added the frontend Pull requests that update the frontend label Jun 13, 2024
@dime10 dime10 merged commit a36947d into main Jun 13, 2024
51 of 53 checks passed
@dime10 dime10 deleted the program-verification-2 branch June 13, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Pull requests that update the frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants