Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cirq-google/cirq_google/api/v2/device.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ message GateSpecification {
Measurement meas = 10;
Wait wait = 11;
FSimViaModel fsim_via_model = 12;
CZPowGate cz_pow_gate = 13;
}

// Gate types available to Google devices.
Expand All @@ -74,6 +75,7 @@ message GateSpecification {
message Measurement {}
message Wait {}
message FSimViaModel {}
message CZPowGate {}
}

message GateSet {
Expand Down
82 changes: 42 additions & 40 deletions cirq-google/cirq_google/api/v2/device_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions cirq-google/cirq_google/api/v2/device_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions cirq-google/cirq_google/devices/grid_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
_SQRT_ISWAP_GATE_FAMILY = cirq.GateFamily(cirq.SQRT_ISWAP)
_SQRT_ISWAP_INV_GATE_FAMILY = cirq.GateFamily(cirq.SQRT_ISWAP_INV)
_CZ_GATE_FAMILY = cirq.GateFamily(cirq.CZ)
Comment thread
eliottrosenberg marked this conversation as resolved.
_CZ_POW_GATE_FAMILY = cirq.GateFamily(cirq.CZPowGate)


# TODO(#5050) Add GlobalPhaseGate
Expand All @@ -63,6 +64,8 @@
_PHASED_XZ_GATE_FAMILY,
_MEASUREMENT_GATE_FAMILY,
]
# Target gates of cirq.CZTargetGateset with allow_partial_czs=True.
_CZ_POW_TARGET_GATES = [_CZ_POW_GATE_FAMILY, _PHASED_XZ_GATE_FAMILY, _MEASUREMENT_GATE_FAMILY]
# Target gates of `cirq_google.SycamoreTargetGateset`.
_SYC_TARGET_GATES = [
_SYC_FSIM_GATE_FAMILY,
Expand Down Expand Up @@ -127,6 +130,7 @@ class _GateRepresentations:
_GateRepresentations(
gate_spec_name='cz', supported_gates=[_CZ_FSIM_GATE_FAMILY, _CZ_GATE_FAMILY]
),
_GateRepresentations(gate_spec_name='cz_pow_gate', supported_gates=[_CZ_POW_GATE_FAMILY]),
_GateRepresentations(
gate_spec_name='phased_xz',
supported_gates=[
Expand Down Expand Up @@ -306,6 +310,13 @@ def _build_compilation_target_gatesets(
additional_gates=list(gateset.gates - set(_SQRT_ISWAP_TARGET_GATES))
)
)
if all(gate_family in gateset.gates for gate_family in _CZ_POW_TARGET_GATES):
target_gatesets.append(
cirq.CZTargetGateset(
allow_partial_czs=True,
additional_gates=list(gateset.gates - set(_CZ_POW_TARGET_GATES)),
)
)

return tuple(target_gatesets)

Expand Down
Loading