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

Move Engine interfaces to GridDevice #5558

Merged

Conversation

verult
Copy link
Collaborator

@verult verult commented Jun 18, 2022

  • Migrate the different processor.get_device() methods and Engine.get_engine_device() to GridDevice
  • Deprecate the gate_sets parameter in various get_device() methods, and remove gate_sets usages.

A dedicated deprecation decorator was added in order to handle gate_sets parameter being passed in as a positional argument.

Originally I had planned to do this after the 0.15 release, but because library code is not allowed to rely on deprecated code within tests, this is blocking SerializableDevice deprecation (#5522).

@dstrain115 @MichaelBroughton

@verult verult requested review from wcourtney, a team, vtomole and cduck as code owners June 18, 2022 22:07
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jun 18, 2022
@verult verult force-pushed the cg-device-refactor/reroute-getdevice branch from 77c1d75 to 1e68ce6 Compare June 20, 2022 01:50
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

@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 20, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 20, 2022
@CirqBot CirqBot merged commit fb7b911 into quantumlib:master Jun 20, 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 20, 2022
CirqBot pushed a commit that referenced this pull request Jun 21, 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](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
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
* Migrate the different `processor.get_device()` methods and `Engine.get_engine_device()` to GridDevice
* Deprecate the `gate_sets` parameter in various `get_device()` methods, and remove `gate_sets` usages.

A dedicated deprecation decorator was added in order to handle `gate_sets` parameter being passed in as a positional argument.

Originally I had planned to do this after the 0.15 release, but because library code is not allowed to rely on deprecated code within tests, this is blocking SerializableDevice deprecation (quantumlib#5522).

@dstrain115 @MichaelBroughton
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: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants