Skip to content
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

Ensure support for new rx and rzz gates #413

Open
cqc-alec opened this issue Nov 7, 2024 · 3 comments
Open

Ensure support for new rx and rzz gates #413

cqc-alec opened this issue Nov 7, 2024 · 3 comments
Assignees

Comments

@cqc-alec
Copy link
Collaborator

cqc-alec commented Nov 7, 2024

No description provided.

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Nov 7, 2024

We could have an enum for the available gatesets

class GateSet(Enum):
    FALCON = {OpType.X, OpType.SX, OpType.Rz, OpType.CX} # No longer supported
    EAGLE = {OpType.X, OpType.SX, OpType.Rz, OpType.ECR}
    HERON = {OpType.Rx, OpType.ZZPhase, ...}
    ...

Also whatever the name for the ${X, CZ, SX, Rz}$ gateset is (although maybe thats being replaced)

@CalMacCQ
Copy link
Contributor

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Nov 27, 2024

Had a look into whether I could compile and run circuits with the new gates. Good news and bad news. The good news is that the backends already recognise that ZZPhase and Rx gates are part of the native gateset for ibm_torino. However at least for the example I tried the Rx gate isn't used in the compiled circuit indicating that we may need to update the rebasing. It also seems we have trouble running a circuit on the real ibm torino device although execution on the emulator seems to work fine.

from pytket.extensions.qiskit import IBMQEmulatorBackend

emulator = IBMQEmulatorBackend("ibm_torino")
print(emulator.backend_info.gate_set)

Output:

{<OpType.RangePredicate: 17>,
 <OpType.X: 23>,
 <OpType.SX: 31>,
 <OpType.Rx: 34>,
 <OpType.Rz: 36>,
 <OpType.CZ: 47>,
 <OpType.noop: 65>,
 <OpType.Measure: 66>,
 <OpType.Reset: 68>,
 <OpType.ZZPhase: 76>,
 <OpType.Conditional: 110>}

Lets test compilation with a simple three qubit circuit

from pytket import Circuit
from pytket.circuit.display import render_circuit_jupyter as draw

test_circ = Circuit(3).CX(0, 1).CX(0, 2).measure_all()

cc_emulator = emulator.get_compiled_circuit(test_circ)

print("Circuit valid?", emulator.valid_circuit(cc_emulator))
draw(c_emulator_circ)

Output

Circuit valid? True

Image

Note the presence of ZZPhase gates and absence of Rx gates. We may need to update the rebasing to reduce the number of single qubit gates (using Rx gates where its advantageous to do so).

Execution of this circuit on the emulator seems to work fine

emulator_result = emulator.run_circuit(cc_emulator, n_shots=100)
# executes successfully

What about the real device? i.e. IBMQBackend

from pytket.extensions.qiskit import IBMQBackend

torino_device = IBMQBackend("ibm_torino")
device_circ = cc_emulator.copy()
print("Circuit valid?", torino_device.valid_circuit(device_circ))

Output:

Circuit valid? True

Execution on the backend seems not to work though

torino_handle = torino_device.process_circuit(device_circ, n_shots=100)

gives

IBMInputValueError: 'The instruction rzz on qubits (79, 80) is not supported by the target system. Circuits that do not match the target hardware definition are no longer supported after March 4, 2024. See the transpilation documentation (https://docs.quantum.ibm.com/guides/transpile) for instructions to transform circuits and the primitive examples (https://docs.quantum.ibm.com/guides/primitives-examples) to see this coupled with operator transformations.'

This seems reminicant of the ECR directionality issue -> #312

Also weird as interactions between Nodes 79 and 80 are recognised as valid

from pytket._tket.unit_id import Node

print((Node(79), Node(80)) in torino_device.backend_info.architecture.coupling)

Output:

True

This also agrees with a direct check from ibm

print( (79, 80) in list(ibm_torino.coupling_map))

Output:

True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants