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 Sycamore and Sycamore23 to GridDevice. #5544

Merged

Conversation

verult
Copy link
Collaborator

@verult verult commented Jun 17, 2022

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 wcourtney, a team, vtomole and cduck 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

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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, but we should use @deprecate for functions at least.

@@ -58,11 +60,9 @@ def create_device_proto_from_diagram(
durations_picos: Optional[Dict[str, int]] = None,
out: Optional[device_pb2.DeviceSpecification] = None,
) -> device_pb2.DeviceSpecification:
"""Parse ASCIIart device layout into DeviceSpecification proto.

"""[Deprecated] Parse ASCIIart device layout into DeviceSpecification proto.
Copy link
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
Collaborator 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
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.

@@ -71,7 +71,7 @@
" num_circuits=num_circuits,\n",
" 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
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
Collaborator 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!

@@ -52,17 +55,16 @@ def _parse_device(s: str) -> Tuple[List[cirq.GridQubit], Dict[str, Set[cirq.Grid
return qubits, measurement_lines


@_compat.deprecated(deadline='v0.16', fix='This function will no longer be available.')
Copy link
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.

None yet

3 participants