-
Notifications
You must be signed in to change notification settings - Fork 983
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
CompilationTargetGateset support in GridDeviceMetadata #5195
CompilationTargetGateset support in GridDeviceMetadata #5195
Conversation
e1e5306
to
1f36aac
Compare
a00783e
to
620ac3f
Compare
@MichaelBroughton @verult One high level comment: Should this property exist on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Blocking to discuss the comment above on whether we should add this directly to DeviceMetadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take my previous comment back -- I agree we should add the compilation target gateset property to grid device metadata because DeviceMetadata doesn't even have a gateset property on it.
We can merge once the nits are resolved.
f45e9ae
to
3bb7336
Compare
3bb7336
to
d3d2252
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after adding original json deserialization test to make sure deserialization without compilation target gatesets property works as expected.
@@ -208,5 +272,18 @@ | |||
"row": 10, | |||
"col": 10 | |||
} | |||
], | |||
"compilation_target_gatesets": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change existing json test. Add a new test instead so that the existing json deserialization works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to at least set compilation_target_gatesets
to []
, otherwise the test will fail saying the JSON serialization of the instance from the repr file does not match the JSON file. So IIUC we can't deserialization backward compatibility anyway. I could perhaps add an _inward
file instead and keep the old entry there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, my bad. Let's add an _inward
file instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a json_inward
which is a copy of the old json
, and the corresponding repr_inward
.
c9747cf
to
7b44d4f
Compare
Automerge cancelled: There are merge conflicts. |
7b44d4f
to
598d290
Compare
Automerge cancelled: A required status check is not present. Missing statuses: ['Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)'] |
Co-authored-by: Cirq Bot <craiggidney+github+cirqbot@google.com>
Part of #5050
Adds a new property to represent a set of
CompilationTargetGateset
s, to provide users a convenient way to transform their invalid circuits to a valid one supported by the device, and to allow for a device to potentially include gates from different viableCompilationTargetGateset
s (e.g.SYC
andSQRT_ISWAP
).Other alternative approaches:
CompilationTargetGateset
. In cases where multipleCompilationTargetGatesets
are valid, the code selects only one of them to surface.CompilationTargetGatesets
is simple to implement and gives users a choice (because of different error characteristics for example)GridDeviceMetadata
, to avoid increasing the API surface ofGridDeviceMetadata
. IMO consideringCompilationTargetGatesets
as a piece of device metadata makes sense as every device could (and should in most cases) have a group of target gatesets. Keeping this inGridDeviceMetadata
makes the compilation feature more discoverable.The JSON diff came out gnarly due to indentations. Basically I added a new GridDeviceMetadata object that contains compilation_target_gatesets.
Part of device refactor (#5050)
cc @dstrain115 @maffoo @MichaelBroughton @mpharrigan @tanujkhattar @wcourtney