Skip to content

Commit cdd3f8c

Browse files
authored
DeviceSpecification proto updates (#5056)
Part of #5050 Since each gate has its own message now, target specification could potentially be moved inside gate messages (e.g. for 2-qubit gates) or disappear entirely and embed the target set in Cirq (e.g. measurement). This is lower priority since there are no major problems with the existing setup, so deferring this for now and get back to it before Cirq 1.0 if there's time. Micro-optimization: Leaving `GateSpecification` field numbers < 16 empty to allow for potential future common fields. @dstrain115 @maffoo
1 parent 091582e commit cdd3f8c

File tree

3 files changed

+736
-35
lines changed

3 files changed

+736
-35
lines changed

cirq-google/cirq_google/api/v2/device.proto

+58-12
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ option java_multiple_files = true;
1111
// This message specifies information that is needed when sending a
1212
// Program message to the device.
1313
message DeviceSpecification {
14-
1514
// A list of allowed gatesets for programs submitted to this processor
1615
// Language.gate_set should be one of these values to be valid.
17-
repeated GateSet valid_gate_sets = 1;
16+
repeated GateSet valid_gate_sets = 1 [deprecated = true];
17+
18+
// The device gateset.
19+
// Contains the list of gates allowed in programs submitted to this processor.
20+
repeated GateSpecification valid_gates = 5;
1821

1922
// A list of allowed ids for qubits within the Program.
2023
// Any programs with ids not in this list will be rejected.
@@ -30,12 +33,56 @@ message DeviceSpecification {
3033
string developer_recommendations = 4;
3134
}
3235

36+
// This contains information about a single device gate.
37+
// Replaces `GateDefinition`.
38+
message GateSpecification {
39+
// This defines the approximate duration to run the gate on the device,
40+
// specified as an integer number of picoseconds.
41+
int64 gate_duration_picos = 1;
42+
43+
// Valid targets that this gate can use.
44+
// Values in this list correspond to the name of the TargetSet
45+
// If unset, all combinations of `DeviceSpecification.valid_qubits` are
46+
// allowed.
47+
repeated string valid_targets = 2;
48+
49+
// This specifies the gate type and gate parameter constraints for this
50+
// device gate.
51+
oneof gate {
52+
Sycamore syc = 3;
53+
SqrtISwap sqrt_iswap = 4;
54+
SqrtISwapInv sqrt_iswap_inv = 5;
55+
CZ cz = 6;
56+
PhasedXZ phased_xz = 7;
57+
VirtualZPow virtual_zpow = 8;
58+
PhysicalZPow physical_zpow = 9;
59+
CouplerPulse coupler_pulse = 10;
60+
Measurement meas = 11;
61+
Wait wait = 12;
62+
}
63+
64+
// Gate types available to Google devices.
65+
// Future gates may have parameter constraints that are frequently updated.
66+
// In such cases, the gate message will contain additional fields to specify
67+
// those constraints.
68+
message Sycamore {}
69+
message SqrtISwap {}
70+
message SqrtISwapInv {}
71+
message CZ {}
72+
message PhasedXZ {}
73+
message VirtualZPow {}
74+
message PhysicalZPow {}
75+
message CouplerPulse {}
76+
message Measurement {}
77+
message Wait {}
78+
}
79+
3380
message GateSet {
34-
// The name of the gate set corresponding to Language.gate_set
35-
string name = 1;
81+
// The name of the gate set corresponding to Language.gate_set
82+
string name = 1;
3683

37-
// A list of valid gates permitted by this gate set
38-
repeated GateDefinition valid_gates = 2;
84+
// A list of valid gates permitted by this gate set
85+
repeated GateDefinition valid_gates = 2;
3986
}
4087

4188
message GateDefinition {
@@ -61,13 +108,12 @@ message GateDefinition {
61108

62109
// A description of an argument to an operation.
63110
message ArgDefinition {
64-
65111
// Note: This should be kept in sync with the ArgValue proto
66112
enum ArgType {
67-
UNSPECIFIED = 0;
68-
FLOAT = 1;
69-
REPEATED_BOOLEAN = 2;
70-
STRING = 3;
113+
UNSPECIFIED = 0;
114+
FLOAT = 1;
115+
REPEATED_BOOLEAN = 2;
116+
STRING = 3;
71117
}
72118

73119
// The name of the argument
@@ -82,7 +128,7 @@ message ArgDefinition {
82128

83129
// This should only be populated for type FLOAT.
84130
// If not set, all float values are allowed.
85-
repeated ArgumentRange allowed_ranges =3;
131+
repeated ArgumentRange allowed_ranges = 3;
86132
}
87133

88134
// Minimum value is inclusive and maximum value is exclusive.

0 commit comments

Comments
 (0)