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

PlacementPass on SquareGrid architecture causes RunTime Error when running on AerBackend #374

Open
IlanIwumbwe opened this issue Aug 15, 2024 · 0 comments

Comments

@IlanIwumbwe
Copy link

IlanIwumbwe commented Aug 15, 2024

Benny and I found this by running a randomly generated circuit through the compiler.

Recreate with:

from pytket import Circuit
from pytket.architecture import SquareGrid
from pytket.passes import NaivePlacementPass
from pytket.extensions.qiskit import AerBackend

backend = AerBackend()

subcirc_4 = Circuit(2, "subcirc_4")

a = SquareGrid(subcirc_4.n_qubits, 1)
NaivePlacementPass(a).apply(subcirc_4)

no_pass_circ = backend.get_compiled_circuit(subcirc_4, optimisation_level=0)
counts_no_pass = backend.run_circuit(no_pass_circ, 1).get_counts()

Results in:

[q[0], q[1]]
[gridNode[0, 0, 0], gridNode[1, 0, 0]]
NotImplementedError: Qiskit registers must use a single index

This is because routing on square grid creates indices with 3 dimensions, which won't work and throw a NotImplementedError as shown here.

This also limits users from using the feature where you can define qubit indices more than one dimension.

from pytket import Circuit, Qubit
from pytket.architecture import SquareGrid
from pytket.passes import NaivePlacementPass
from pytket.extensions.qiskit import AerBackend

backend = AerBackend()

subcirc_4 = Circuit(2, "subcirc_4")

subcirc_4.add_qubit(Qubit("qw", [0, 1]))
print(subcirc_4.qubits)

no_pass_circ = backend.get_compiled_circuit(subcirc_4, optimisation_level=0)
counts_no_pass = backend.run_circuit(no_pass_circ, 1).get_counts()

Although this isn't really a RunTime error, this limitation isn't stated in documentation as far as we can tell.

@cqc-alec cqc-alec transferred this issue from CQCL/tket Aug 15, 2024
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

1 participant