Skip to content

Commit 527af77

Browse files
Add newly serializable gates to supported grid device gates (#6499)
1 parent 1a6c16a commit 527af77

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

cirq-google/cirq_google/devices/grid_device.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,24 @@ class _GateRepresentations:
112112
),
113113
_GateRepresentations(
114114
gate_spec_name='phased_xz',
115-
deserialized_forms=[cirq.PhasedXZGate, cirq.XPowGate, cirq.YPowGate, cirq.PhasedXPowGate],
115+
deserialized_forms=[
116+
cirq.PhasedXZGate,
117+
cirq.XPowGate,
118+
cirq.YPowGate,
119+
cirq.PhasedXPowGate,
120+
cirq.HPowGate,
121+
cirq.GateFamily(cirq.I),
122+
cirq.ops.SingleQubitCliffordGate,
123+
],
116124
serializable_forms=[
125+
# TODO: Extend support to cirq.IdentityGate.
126+
cirq.GateFamily(cirq.I),
117127
cirq.GateFamily(cirq.PhasedXZGate),
118128
cirq.GateFamily(cirq.XPowGate),
119129
cirq.GateFamily(cirq.YPowGate),
130+
cirq.GateFamily(cirq.HPowGate),
120131
cirq.GateFamily(cirq.PhasedXPowGate),
132+
cirq.GateFamily(cirq.ops.SingleQubitCliffordGate),
121133
],
122134
),
123135
_GateRepresentations(
@@ -263,7 +275,6 @@ def _deserialize_gateset_and_gate_durations(
263275
g = cirq.GateFamily(g)
264276
gate_durations[g] = cirq.Duration(picos=gate_spec.gate_duration_picos)
265277

266-
# TODO(#4833) Add identity gate support
267278
# TODO(#5050) Add GlobalPhaseGate support
268279

269280
return cirq.Gateset(*gates_list), gate_durations

cirq-google/cirq_google/devices/grid_device_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def _create_device_spec_with_horizontal_couplings():
9292
cirq.ops.phased_x_z_gate.PhasedXZGate,
9393
cirq.ops.common_gates.XPowGate,
9494
cirq.ops.common_gates.YPowGate,
95+
cirq.GateFamily(cirq.I),
96+
cirq.ops.SingleQubitCliffordGate,
97+
cirq.ops.HPowGate,
9598
cirq.ops.phased_x_gate.PhasedXPowGate,
9699
cirq.GateFamily(
97100
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
@@ -113,6 +116,9 @@ def _create_device_spec_with_horizontal_couplings():
113116
cirq.GateFamily(cirq.ops.phased_x_z_gate.PhasedXZGate): base_duration * 4,
114117
cirq.GateFamily(cirq.ops.common_gates.XPowGate): base_duration * 4,
115118
cirq.GateFamily(cirq.ops.common_gates.YPowGate): base_duration * 4,
119+
cirq.GateFamily(cirq.ops.common_gates.HPowGate): base_duration * 4,
120+
cirq.GateFamily(cirq.I): base_duration * 4,
121+
cirq.GateFamily(cirq.ops.SingleQubitCliffordGate): base_duration * 4,
116122
cirq.GateFamily(cirq.ops.phased_x_gate.PhasedXPowGate): base_duration * 4,
117123
cirq.GateFamily(
118124
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
@@ -135,6 +141,9 @@ def _create_device_spec_with_horizontal_couplings():
135141
cirq_google.FSimGateFamily(gates_to_accept=[cirq.SQRT_ISWAP_INV]),
136142
cirq.ops.common_gates.XPowGate,
137143
cirq.ops.common_gates.YPowGate,
144+
cirq.ops.common_gates.HPowGate,
145+
cirq.GateFamily(cirq.I),
146+
cirq.ops.SingleQubitCliffordGate,
138147
cirq.ops.phased_x_gate.PhasedXPowGate,
139148
cirq.GateFamily(
140149
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
@@ -154,6 +163,9 @@ def _create_device_spec_with_horizontal_couplings():
154163
cirq_google.FSimGateFamily(gates_to_accept=[cirq.CZ]),
155164
cirq.ops.common_gates.XPowGate,
156165
cirq.ops.common_gates.YPowGate,
166+
cirq.ops.common_gates.HPowGate,
167+
cirq.GateFamily(cirq.I),
168+
cirq.ops.SingleQubitCliffordGate,
157169
cirq.ops.phased_x_gate.PhasedXPowGate,
158170
cirq.GateFamily(
159171
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]

0 commit comments

Comments
 (0)