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] Implement quantum device capabilities as a data structure #609

Merged
merged 51 commits into from
Apr 29, 2024

Conversation

sergei-mironov
Copy link
Contributor

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

In this PR we implement a dedicated data structure representing quantum device capabilities. Previously we used toml document IR for this purpose. We see the following benefits in the new approach:

  • Data structure simplifies capability calculations we do for our QJITDevice. Now the capabilities of QJITDevice and of the third-party devices we support are represented in the same format.
  • We reduce the internal usage of C(Gate)/Adjoint(Gate) syntax to minimum. We still use it only to communicate with PennyLane's API

In subsequent PRs we will use it for program verification.

[sc-59478]

@sergei-mironov sergei-mironov changed the base branch from main to native-quantum-control-toml-fixup March 18, 2024 14:01
Base automatically changed from native-quantum-control-toml-fixup to main March 20, 2024 14:47
@sergei-mironov sergei-mironov changed the title Program verification [Frontend] Implement quantum device capabilities as a data structure Mar 21, 2024
@sergei-mironov sergei-mironov marked this pull request as ready for review March 21, 2024 17:55
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @grwlf nice clean up, I have left some questions 👍

frontend/catalyst/utils/toml.py Outdated Show resolved Hide resolved
frontend/catalyst/utils/toml.py Show resolved Hide resolved
frontend/catalyst/utils/toml.py Outdated Show resolved Hide resolved
frontend/catalyst/utils/toml.py Show resolved Hide resolved
frontend/catalyst/utils/toml.py Outdated Show resolved Hide resolved
frontend/catalyst/utils/toml.py Outdated Show resolved Hide resolved
frontend/catalyst/qjit_device.py Outdated Show resolved Hide resolved
frontend/catalyst/utils/toml.py Outdated Show resolved Hide resolved
frontend/catalyst/utils/toml.py Outdated Show resolved Hide resolved
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to approve after answering the two comments 💯

frontend/catalyst/qjit_device.py Outdated Show resolved Hide resolved
frontend/catalyst/qjit_device.py Outdated Show resolved Hide resolved
@rmoyard rmoyard self-requested a review April 29, 2024 13:15
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks it looks good to me now 💯

@sergei-mironov sergei-mironov merged commit 08e4917 into main Apr 29, 2024
40 checks passed
@sergei-mironov sergei-mironov deleted the program-verification branch April 29, 2024 13:17
rmoyard added a commit that referenced this pull request May 1, 2024
**Description of the Change:**
Add measurement processes to the device capabilities. It makes
compatible the RC PR #697
with the main PR #609.
dime10 added a commit that referenced this pull request Jun 13, 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]
* [x] 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)
* [x] Verify that no state or variance is returned from the QNode.
(Double check if Lightning Adjoint supports this!)
* [x] adjoint diff method: Does the Tape only contain operations deemed
differentiable by the QJITDevice from the TOML spec?
* [x] 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:
- #609 Introduces device
capabilities.
- #712 Makes
toml-independent tests possible.

---------

Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
Co-authored-by: Lillian <lillian542@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants