Skip to content

Move Sycamore and Sycamore23 to GridDevice. - #5544

Merged
CirqBot merged 9 commits into
quantumlib:masterfrom
verult:cg-device-refactor/replace-sycamore-device
Jun 17, 2022
Merged

CirqBot merged 9 commits into
quantumlib:masterfrom
verult:cg-device-refactor/replace-sycamore-device

Conversation

@verult

@verult verult commented Jun 17, 2022

Copy link
Copy Markdown
Contributor

Blocking SerializableDevice deprecation (#5522)

Recirq needs to be updated to use Sycamore.metadata.qubit_set in a follow-up.

I put deprecation warnings as docstrings/comments since I don't expect them to have much usage outside Cirq (one exception being _SYCAMORE_DURATION_PICOS is used on server side to serialize DeviceSpecification the old way). Let me know if you'd prefer a full deprecation warning.

@dstrain115
cc @MichaelBroughton @mpharrigan

@verult
verult requested a review from dstrain115 June 17, 2022 00:09
@verult
verult requested review from a team, cduck, vtomole and wcourtney as code owners June 17, 2022 00:09
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jun 17, 2022
@verult
verult marked this pull request as draft June 17, 2022 02:13
@verult
verult force-pushed the cg-device-refactor/replace-sycamore-device branch from 42cba3e to f8767be Compare June 17, 2022 02:32
@verult
verult marked this pull request as ready for review June 17, 2022 02:33
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@dstrain115 dstrain115 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, but we should use @deprecate for functions at least.

) -> device_pb2.DeviceSpecification:
"""Parse ASCIIart device layout into DeviceSpecification proto.

"""[Deprecated] Parse ASCIIart device layout into DeviceSpecification proto.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't understand why we don't have a @_compat.deprecated decorator on this function. It should just be one line, so I don't think it will be burdensome at all, and it is much more obvious than a docstring.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Tests need to include assert_deprecation() contexts but there aren't many of them. Will update

_SYCAMORE_DURATIONS would be trickier to deprecate, though, since it's a constant. Might need something similar to examples in PEP 562 and probably not worth the effort.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's fine. My comment was mainly about the function. _SYCAMORE_DURATIONS is a constant and it is already designated as private from the underscore, so I do not think we need a deprecation warning for it.

" depth=depth,\n",
" num_qubits=depth,\n",
" device_graph=routing.gridqubits_to_graph_device(device.qubits),\n",
" device_graph=routing.gridqubits_to_graph_device(device.metadata.qubit_set),\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Optional: I wonder if it would be worth having a deprecated qubits() function in GridDevice to point to metadata.qubit_set? This would help people know how to upgrade this everywhere. This would be a separate PR of course. Just an idea.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, will do!

return qubits, measurement_lines


@_compat.deprecated(deadline='v0.16', fix='This function will no longer be available.')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should the fix be to use def create_device_proto_for_qubits?

@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 17, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 17, 2022
@CirqBot
CirqBot merged commit 70487fd into quantumlib:master Jun 17, 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 17, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Blocking SerializableDevice deprecation (quantumlib#5522)

Recirq needs to be updated to use `Sycamore.metadata.qubit_set` in a follow-up.

I put deprecation warnings as docstrings/comments since I don't expect them to have much usage outside Cirq (one exception being `_SYCAMORE_DURATION_PICOS` is used on server side to serialize DeviceSpecification the old way). Let me know if you'd prefer a full deprecation warning.

@dstrain115 
cc @MichaelBroughton @mpharrigan
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.

3 participants