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

Add WaitGate proto serialization #2437

Merged
merged 7 commits into from
Oct 30, 2019
Merged

Add WaitGate proto serialization #2437

merged 7 commits into from
Oct 30, 2019

Conversation

Strilanc
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Oct 29, 2019
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.

Can server side support this gate?

@@ -280,3 +280,24 @@ def _near_mod_2(e, t, atol=1e-8):
gate_constructor=lambda: ops.FSimGate(theta=-np.pi / 4, phi=0),
args=[]),
]
"""Measurement serializer."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix comments. Also, Matthew suggested in a different PR that we use comments instead of string literals to improve formatting (I'll fix the other ones)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

SINGLE_QUBIT_HALF_PI_SERIALIZERS, SINGLE_QUBIT_HALF_PI_DESERIALIZERS,
MEASUREMENT_SERIALIZER, MEASUREMENT_DESERIALIZER, SYC_SERIALIZER,
SYC_DESERIALIZER, SQRT_ISWAP_SERIALIZERS, SQRT_ISWAP_DESERIALIZERS,
WAIT_GATE_SERIALIZER, WAIT_GATE_DESERIALIZER)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add trailing comma so that the formatting remains the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -36,12 +30,14 @@
*SINGLE_QUBIT_SERIALIZERS,
*SINGLE_QUBIT_HALF_PI_SERIALIZERS,
MEASUREMENT_SERIALIZER,
WAIT_GATE_SERIALIZER,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not add this to the gate set until it is supported at the server

Copy link
Collaborator

Choose a reason for hiding this comment

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

i.e. add the serializer first but not to the gate set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't the server using this same gate set object, though? How can I add it to one before the other if they're the same thing?

I suppose I could add it to the deserializers first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Strilanc Strilanc changed the title Add WaitGate to Syc/SqrtISwap gate sets Add WaitGate proto serialization Oct 30, 2019
@Strilanc
Copy link
Contributor Author

Refactored this to only define the serializer and deserializer, without adding it to the gate sets.

op_serializer.SerializingArg(
serialized_name='nanos',
serialized_type=float,
gate_getter=lambda e: e.duration.total_nanos()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should put a limit here, like don't allow waits of more than 10 milliseconds (or should this be on the pyle side)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that'd be a good idea.

Copy link
Collaborator

Choose a reason for hiding this comment

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

At least maybe yell if this is negative for now.

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, besides one concern (that may not belong in this PR anyway)

@Strilanc Strilanc added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Oct 30, 2019
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Oct 30, 2019
@CirqBot CirqBot merged commit dffd4ea into master Oct 30, 2019
@CirqBot CirqBot deleted the wait_gate8 branch October 30, 2019 21:42
@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 Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants