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

Create double_val in oneof for program #3140

Merged
merged 3 commits into from
Jul 17, 2020

Conversation

dstrain115
Copy link
Collaborator

  • Creates an option to store double as an ArgValue for serialization.
  • This is currently only one-way for backwards compatibility.
  • The conversion of python floats will still go to float_value.

- Creates an option to store double as an ArgValue for serialization.
- This is currently only one-way for backwards compatibility.
- The conversion of python floats will still go to float_value.
@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Jul 15, 2020
@balopat
Copy link
Contributor

balopat commented Jul 16, 2020

I assume this is to help with #3116 - but it doesn't really yet, right because we are not converting python floats to proto double? What's the plan/rationale for introducing this double field then?

@dstrain115
Copy link
Collaborator Author

I assume this is to help with #3116 - but it doesn't really yet, right because we are not converting python floats to proto double? What's the plan/rationale for introducing this double field then?

That's correct. We need to do this in two steps for backwards compatibility. We first introduce the field and the code to handle it.

Once this code is fully pushed out, then we can start converting python floats into the new double_val.

Make sense? I welcome alternatives if you have a different idea to preserve compatibility.

@balopat
Copy link
Contributor

balopat commented Jul 16, 2020

Yeah this is not possible with protobuf 3 gracefully. We are essentially changing the type of a field which is not backward compatible in this case.

Have we considered introducing a v3 api for this? Then we have the option to fully implement the full solution. Clients have the option to stay on v2 or switch over to v3 at their own leisure. I'm just worried about what "fully pushed out" means - how do we check with all clients that this has been updated?

@dstrain115
Copy link
Collaborator Author

Yeah this is not possible with protobuf 3 gracefully. We are essentially changing the type of a field which is not backward compatible in this case.

Upgrading to v3 is a way way way way bigger change. I don't think it is worth it for this change.
I mean, I think the plan would be to support deserializing here, then start serializing into this field in cirq 0.9.0.

The only thing we need to worry about is people deserializing programs with an old version, and I think that would be really unlikely, since clients would deserialize results, not programs. Only "servers" would need to deserialize programs, so we really only need to worry about QE and TFQ servers to upgrade here.

What do you think?

@balopat
Copy link
Contributor

balopat commented Jul 17, 2020

Yeah this is not possible with protobuf 3 gracefully. We are essentially changing the type of a field which is not backward compatible in this case.

Upgrading to v3 is a way way way way bigger change. I don't think it is worth it for this change.
I mean, I think the plan would be to support deserializing here, then start serializing into this field in cirq 0.9.0.

The only thing we need to worry about is people deserializing programs with an old version, and I think that would be really unlikely, since clients would deserialize results, not programs. Only "servers" would need to deserialize programs, so we really only need to worry about QE and TFQ servers to upgrade here.

What do you think?

That makes a lot of sense to me, thanks for explaining! LGTM!

@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 17, 2020
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 17, 2020
@CirqBot
Copy link
Collaborator

CirqBot commented Jul 17, 2020

Automerge cancelled: A status check is failing.

@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 Jul 17, 2020
@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 17, 2020
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 17, 2020
@CirqBot CirqBot merged commit 88779d4 into quantumlib:master Jul 17, 2020
@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 Jul 17, 2020
tonybruguier pushed a commit to tonybruguier/Cirq that referenced this pull request Aug 23, 2020
- Creates an option to store double as an ArgValue for serialization.
- This is currently only one-way for backwards compatibility.
- The conversion of python floats will still go to float_value.
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

4 participants