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

Preparations to remove the proto field Program.language.gate_set #5709

Conversation

verult
Copy link
Collaborator

@verult verult commented Jul 11, 2022

  • Make CircuitSerializer the only 'gateset'
  • Remove gate_set_name from CircuitSerializer constructor. This is a breaking change, but server side never references the class directly. Instead, it uses the CIRCUIT_SERIALIZER singleton.

@dstrain115

@verult verult requested a review from dstrain115 July 11, 2022 00:59
@verult verult requested review from wcourtney, a team, vtomole and cduck as code owners July 11, 2022 00:59
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jul 11, 2022
"""
super().__init__(gate_set_name)
def __init__(self):
"""Construct the circuit serializer object."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can keep the Args in here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why do you prefer keeping it? I'm leaning towards removing it now because it's not currently useful, and it's easier to add a field later on than to remove one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nm, ignore the last comment. I thought you got rid of the doc string but not the argument. This is fine.

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 like some tests are failing.

@@ -619,4 +601,4 @@ def _deserialize_circuit_op(
)


CIRCUIT_SERIALIZER = CircuitSerializer('v2_5')
CIRCUIT_SERIALIZER = CircuitSerializer()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this barf server-side if the language is not present? I can't remember how we determine whether this is v2 or v2.5 protos currently.

Copy link
Collaborator Author

@verult verult Jul 11, 2022

Choose a reason for hiding this comment

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

Current it does. My plan is to update this logic on server side as well. @maffoo and I confirmed this should be the order of merging:

  1. Remove SerializableGateSet
  2. Change server side to only accept CircuitSerializer, and throw an error if the gate_set field doesn't match CircuitSerializer
  3. Update CircuitSerializer on Cirq side

We also agreed to not remove Program.language.gate_set in the end, so that users on old Cirq versions won't fail silently when using QCS. If we choose to remove it in the future, it would be safer to do it later after more users upgrade past Cirq 1.0.

So I'll hold off on merging this PR for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think #2 needs to happen first, since server side needs to support the new client. (maybe throw an error if gate_set is not empty and does not equal v2_5 for now).

@verult
Copy link
Collaborator Author

verult commented Jul 14, 2022

Synced with @dstrain115 and @maffoo offline. Will keep the gate_set field populated for some time because if we were to remove it, older Cirq clients would still populate the field when communicating with QCS.

This PR is being replaced by #5769. The EngineProgram change is done in #5762

@verult verult closed this Jul 14, 2022
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