Skip to content

Commit 6c9db55

Browse files
authored
Move moment index into circuit message (#7008)
* Move moment index into circuit message - This addresses design review comments that the moment_index should be outside the Moment message to be consistent and avoid a message construction. - This PR also simplifies the code to deserialize all the constants first, which removes the need for lookup tables and logic later. - In addition, this puts the deserialization of a moment into its own function. * types * typo]]]] * Fix build protos to whatever version thing I was missing. * Address review comments.
1 parent 5c198ce commit 6c9db55

File tree

5 files changed

+224
-180
lines changed

5 files changed

+224
-180
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,20 @@ message Circuit {
7070
// The moments of the circuit, with the first element corresponding to the
7171
// first set of operations to apply, etc.
7272
repeated Moment moments = 2;
73+
74+
75+
// The index of the moment in the top-level constant table.
76+
// In order to preserve ordering, either this field should be populated
77+
// or the moments field, but not both.
78+
// This field is used to reduce size of circuits that contain many
79+
// repeated moments.
80+
repeated int32 moment_indices = 3;
7381
}
7482

7583
// A moment is a collection of operations and circuit operations that operate
7684
// on a disjoint set of qubits. Conceptually, a moment represents operations
7785
// that all occur in the same finite period of time.
7886
message Moment {
79-
// The index of the moment in the top-level constant table.
80-
// If this field is populated, the other fields should be ignored
81-
// in favor using the constant table lookup.
82-
// This field is used to reduce size of circuits that contain many
83-
// repeated moments.
84-
optional int32 moment_constant_index = 3;
85-
8687
// All of the gate operations in the moment. Each operation and circuit
8788
// operation must act on different qubits.
8889
repeated Operation operations = 1;
@@ -97,6 +98,9 @@ message Moment {
9798
// table should be preferred for circuits with repeated operations
9899
// for improved serialization size.
99100
repeated int32 operation_indices = 4;
101+
102+
// Deprecated field id, do not use.
103+
reserved 3;
100104
}
101105

102106
// The quantum circuit, specified as a series of operations at specific

0 commit comments

Comments
 (0)