-
Notifications
You must be signed in to change notification settings - Fork 983
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
2 Qubit ControlledOperations should be supported in convert_to_sycamore_gates #4152
Comments
I'm assuming the We have had these discussions about |
|
The protocol will also be doing a |
Upd: Similarly, |
Discussed in Cirq sync: Recent work on the circuit transformer APIs should fix this. |
…ers to support other operation types. (#4459) Proliferation of `isinstance(op, GateOperation)` checks results in many inconsistencies due to different available operation types like `ControlledOperations` and `TaggedOperations`. This PR fixes #4152 and is a first step towards fixing #3556 Note that `TaggedOperations` which were earlier ignored by the optimizers would now be considered, and hence this is potentially a breaking change if people were implicitly relying on TaggedOperations not getting compiled by the optimizers. Since the optimizer doesn't document / test this behavior, I consider it to be a bug rather than a feature and an explicit `NoCompile` tag should be implemented as part of #4253 This PR is blocked on submitting #4167 (tests will stop failing once the PR is submitted and this rebased). Update: This is now ready for review.
…ers to support other operation types. (quantumlib#4459) Proliferation of `isinstance(op, GateOperation)` checks results in many inconsistencies due to different available operation types like `ControlledOperations` and `TaggedOperations`. This PR fixes quantumlib#4152 and is a first step towards fixing quantumlib#3556 Note that `TaggedOperations` which were earlier ignored by the optimizers would now be considered, and hence this is potentially a breaking change if people were implicitly relying on TaggedOperations not getting compiled by the optimizers. Since the optimizer doesn't document / test this behavior, I consider it to be a bug rather than a feature and an explicit `NoCompile` tag should be implemented as part of quantumlib#4253 This PR is blocked on submitting quantumlib#4167 (tests will stop failing once the PR is submitted and this rebased). Update: This is now ready for review.
Description of the Issue
We check
isinstance(op, GateOperation)
while verifying that the given operation can be decomposed using analytical / tabulation methods. This leads to the problem that we don't recognize two qubit controlled operations as known gates and hence don't support them.Cirq/cirq-google/cirq_google/optimizers/convert_to_sycamore_gates.py
Line 111 in 12530f1
For example:
The above code fails with the following error:
The reason it fails is because
ControlledOperations
don't satisfy theisinstance(gate, GateOperation)
constraint.gives
However, the gate is actually just a two qubit controlled gate and should be decomposable into the native gateset via
known_two_q_operations_to_sycamore_operations
.gives the following decomposition
Proposed Solution
Cirq/cirq-google/cirq_google/optimizers/convert_to_sycamore_gates.py
Line 111 in 12530f1
should be modified to also recognize two qubit
ControlledOperations
.Cirq version
0.11.0.dev
Part of #3242
The text was updated successfully, but these errors were encountered: