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

Removing GateSpecification.valid_targets and deprecating some target types #5376

Merged

Conversation

verult
Copy link
Collaborator

@verult verult commented May 19, 2022

The original DeviceSpecification was designed to be somewhat future-proof, so it contains fields which do not pertain to hardware at the time. Some assumptions remain overly general for our hardware today and in the near future. Specifically, we can make the following assumptions about our devices:

  • All valid qubit pairs work for all two-qubit gates.
  • All valid qubits work for all single-qubit gates.
  • Measurement gate can always be applied to all subset of qubits.

Based on these assumptions, SUBSET_PERMUTATION target type and the newly introduced GateSpecification.valid_targets are no longer necessary.

This change also removes the unused ASYMMETRIC target type.

As device requirements change, new fields can be added in the future and existing fields deprecated, and this can be done in a backward-compatible way as long as the server fills both deprecated and new fields until deprecated fields are removed. This provides the flexibility to keep our proto surface small, which makes serialization/deserialization logic simpler to maintain.

Notes for reviewers:

  • GateSpecification was recently introduced and has never been sent over the wires, so it's OK to change its fields directly.
  • The description of assumptions about 1q, 2q, and measurement targets are moved to the proto.
  • The proto can be made simpler by replacing TargetSet with a less general qubit_pairs, which is sufficient to satisfy the requirements today. I would prefer this route as we have the flexibility to generalize later on if we'd like. WDYT?

@dstrain115 @maffoo

@verult verult requested review from maffoo and dstrain115 May 19, 2022 00:08
@verult verult requested review from wcourtney, a team, vtomole and cduck as code owners May 19, 2022 00:08
@CirqBot CirqBot added the size: M 50< lines changed <250 label May 19, 2022
… which are no longer necessary.

The original DeviceSpecification was designed to be somewhat future-proof, so it contains fields which do not pertain to hardware at the time. Some assumptions remain overly general for our hardware today and in the near future. Specifically, we can make the following assumptions about our devices:

* All valid qubit pairs work for all two-qubit gates.
* All valid qubits work for all single-qubit gates.
* Measurement gate can always be applied to all subset of qubits.

Based on these assumptions, SUBSET_PERMUTATION target type and the newly introduced `GateSpecification.valid_targets` are no longer necessary.

This change also removes the unused ASYMMETRIC target type.
@verult verult force-pushed the cg-device-refactor/deprecate-proto branch from d9694c7 to 59afd41 Compare May 19, 2022 00:12
Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for addressing comments.

@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 1, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 1, 2022
@CirqBot CirqBot merged commit 60d39ab into quantumlib:master Jun 1, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 1, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…types (quantumlib#5376)

The original DeviceSpecification was designed to be somewhat future-proof, so it contains fields which do not pertain to hardware at the time. Some assumptions remain overly general for our hardware today and in the near future. Specifically, we can make the following assumptions about our devices:

* All valid qubit pairs work for all two-qubit gates.
* All valid qubits work for all single-qubit gates.
* Measurement gate can always be applied to all subset of qubits.

Based on these assumptions, `SUBSET_PERMUTATION` target type and the newly introduced `GateSpecification.valid_targets` are no longer necessary.

This change also removes the unused ASYMMETRIC target type.

As device requirements change, new fields can be added in the future and existing fields deprecated, and this can be done in a backward-compatible way as long as the server fills both deprecated and new fields until deprecated fields are removed. This provides the flexibility to keep our proto surface small, which makes serialization/deserialization logic simpler to maintain.

**Notes for reviewers**:
* `GateSpecification` was recently introduced and has never been sent over the wires, so it's OK to change its fields directly.
* The description of assumptions about 1q, 2q, and measurement targets are moved to the proto.
* The proto can be made simpler by replacing `TargetSet` with a less general `qubit_pairs`, which is sufficient to satisfy the requirements today. I would prefer this route as we have the flexibility to generalize later on if we'd like. WDYT?

@dstrain115 @maffoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants