Skip to content

Conversation

@verult
Copy link
Collaborator

@verult verult commented Jun 19, 2022

Moves the various device-related functions in virtual_engine_processor.py to GridDevice. This is blocking SerializableDevice deprecation (#5522) because library code cannot call the deprecated SerializableDevice.

  • Rerouted functions in virtual_engine_processor.py to GridDevice
  • Deprecated the gate_sets parameter in virtual_engine_processor.py
  • Move create_device_from_processor_id() to GridDevice. @95-martin-orion
    • Made the return type more general by changing it to cirq.Device to allow for new device implementations in the future.
  • Created copies of existing rainbow and weber DeviceSpecifications and changed them to match the new DeviceSpecification format.
    • This update needs to happen now because create_noiseless_virtual_engine_from_templates() is updated to return a GridDevice, and the templates (rainbow and weber DeviceSpecifications) need to contain data in the new format in order to parse into GridDevice properly.
    • There are no publicly available devices since weber, so I chose to repurpose the existing rainbow and weber information. This was done manually since these devices are no longer available.
      • Gateset and gate_duration information should match previous versions. In particular, they both include the CZ gate with no duration information.

Reviewer Note: The first 3 commits are from another pending PR (#5558); please start with the commit "Move virtual engine functions to GridDevice". Don't be discouraged by the line count :) other than the 3 borrowed commits, ~600 lines are from the two new DeviceSpecification messages.

@mpharrigan
cc @MichaelBroughton @dstrain115

@verult verult requested review from a team, cduck, vtomole and wcourtney as code owners June 19, 2022 19:23
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jun 19, 2022
@verult verult force-pushed the cg-device-refactor/virtual-engine-grid-device branch from 1da5768 to e7f1d88 Compare June 19, 2022 23:15
@verult verult force-pushed the cg-device-refactor/virtual-engine-grid-device branch from e7f1d88 to a0aec4a Compare June 20, 2022 01:57
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

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

LGTM will leave to @dstrain115 for a quick check off.

This directory contains snapshots of `DeviceSpecification` proto messages
(defined in `cirq-google/cirq_google/api/v2/device.proto`) describing Google devices.

Files with the prefix `_for_grid_device` are equivalent representations of corresponding proto files
Copy link
Collaborator

Choose a reason for hiding this comment

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

suffix?



def test_get_device_specification():
# TODO(verult)
Copy link
Collaborator

Choose a reason for hiding this comment

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

???

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops added as a reminder to come back and update the test but forgot to remove it after that. Thanks!

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.

Looks fine to me besides the unfinished test.

def test_get_device_specification():
# TODO(verult)
processor = cg.EngineProcessor('a', 'p', EngineContext(), _processor=quantum.QuantumProcessor())
assert processor.get_device_specification() is None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this None? Is this an incomplete test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was here from the previous iteration of the test. I think this part just verifies that an unset DeviceSpecification doesn't break anything. The next section verifies an actual DeviceSpecification.

@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 21, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jun 21, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Build docs', 'Build protos', 'Coverage check', 'Misc check', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@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 21, 2022
@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 21, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jun 21, 2022

Automerge cancelled: A status check is failing.

@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 21, 2022
@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 21, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jun 21, 2022

Automerge cancelled: A status check is failing.

@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 21, 2022
@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 21, 2022
@CirqBot CirqBot merged commit f6bea2f into quantumlib:master Jun 21, 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 21, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Moves the various device-related functions in `virtual_engine_processor.py` to GridDevice. This is blocking SerializableDevice deprecation (quantumlib#5522) because library code cannot call the deprecated SerializableDevice.

* Rerouted functions in `virtual_engine_processor.py` to `GridDevice`
* Deprecated the `gate_sets` parameter in `virtual_engine_processor.py`
* Move `create_device_from_processor_id()` to GridDevice. @95-martin-orion 
  * Made the return type more general by changing it to `cirq.Device` to allow for new device implementations in the future. 
* Created copies of existing rainbow and weber DeviceSpecifications and changed them to match the new DeviceSpecification format.
  * This update needs to happen now because `create_noiseless_virtual_engine_from_templates()` is updated to return a `GridDevice`, and the templates (rainbow and weber DeviceSpecifications) need to contain data in the new format in order to parse into GridDevice properly.
  * There are no publicly available devices since weber, so I chose to repurpose the existing rainbow and weber information. This was done manually since these devices are no longer available.
    * Gateset and gate_duration information should match previous versions. In particular, they both include the CZ gate with no duration information.

**Reviewer Note**: The first 3 commits are from another pending PR (quantumlib#5558); please start with the commit "[Move virtual engine functions to GridDevice](quantumlib@2e9ef33)". Don't be discouraged by the line count :) other than the 3 borrowed commits, ~600 lines are from the two new DeviceSpecification messages.

@mpharrigan 
cc @MichaelBroughton @dstrain115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants