catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Relax C(GlobalPhase) and CPhase validation for quantum devices

Open sergei-mironov opened this issue 1 year ago • 4 comments

Context: Transition to the quantum device config schema 2

Description of the Change: Relax the validation procedure for C(GlobalPhase) gate of lightning.kokkos device

Benefits:

  • We accept kokkos device with C(GloablPhase) in operations (PythonAPI). QJITDevice calculates its operations from the toml config where it is disabled to reflect the limitations of C++ API.
  • We ignore CPhase gate even if it exists in schema 1 configs.

Possible Drawbacks:

Related GitHub Issues: https://github.com/PennyLaneAI/pennylane-lightning/pull/642

sergei-mironov avatar May 06 '24 13:05 sergei-mironov

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.04%. Comparing base (2636257) to head (69a24ab). Report is 183 commits behind head on main.

Files Patch % Lines
frontend/catalyst/device/qjit_device.py 60.00% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #718      +/-   ##
==========================================
- Coverage   98.07%   98.04%   -0.03%     
==========================================
  Files          70       69       -1     
  Lines        9601     9536      -65     
  Branches      756      762       +6     
==========================================
- Hits         9416     9350      -66     
  Misses        151      151              
- Partials       34       35       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 06 '24 13:05 codecov[bot]

Hello. You may have forgotten to update the changelog! Please edit doc/changelog.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

github-actions[bot] avatar May 06 '24 13:05 github-actions[bot]

~~This can be closed right?~~ My bad I thought this was just about the CPhase gate.

dime10 avatar May 06 '24 15:05 dime10

~This can be closed right?~ My bad I thought this was just about the CPhase gate.

Even for CPhase, we need to remove it from tomls contained in the Catalyst repo too.

sergei-mironov avatar May 06 '24 15:05 sergei-mironov

After #745 is merged and this PR is updated, one should run latest/latest/latest on this branch. I expect it to succeed. On #745 latest/latest/latest fails with the error message:

FAILED frontend/test/pytest/test_transform.py::TestBroadcastExpand::test_expansion_qnode_no_cache[lightning.kokkos-obs1-params2] - catalyst.utils.exceptions.CompileError: Gates in qml.device.operations and specification file do not match.
Gates that present only in the device: {'C(GlobalPhase)'}
Gates that present only in spec: set()

I am not asking for this to fix latest/latest/latest but merely to report what the outcome is on the channel so that we can fix it if this is not the case.

@erick-xanadu I merged this PR with the recent main and solved the conflicts. The test you mentioned should pass now.

sergei-mironov avatar May 27 '24 12:05 sergei-mironov