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

2Q gate synthesis with fractional gates #12311

Open
nkanazawa1989 opened this issue Apr 30, 2024 · 1 comment
Open

2Q gate synthesis with fractional gates #12311

nkanazawa1989 opened this issue Apr 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nkanazawa1989
Copy link
Contributor

nkanazawa1989 commented Apr 30, 2024

Environment

  • Qiskit version: main
  • Python version: doesn't matter
  • Operating system: doesn't matter

What is happening?

When I build a Qiskit Target that supports two qubit basis gates with arbitrary rotation angle, it cannot transpile the circuit if the added basis gate is other than RZXGate or RXXGate.

How can we reproduce the issue?

from qiskit.providers.fake_provider import GenericBackendV2
from qiskit import quantum_info as qi, transpile, QuantumCircuit

backend = GenericBackendV2(2, basis_gates=["rz", "rx", "rzz"])
qc = QuantumCircuit(2)
qc.unitary(qi.random_unitary(4), [0, 1])
isa = transpile(qc, target=backend.target)

this results in an error

TypeError: ParameterExpression with unbound parameters (dict_keys([Parameter(ϴ)])) cannot be cast to a float.

because it tries to get the unitary matrix of parameterized RZZGate(Parameter(ϴ)) instruction.

On the other hand, it transpiles circuit when I directly specify the basis gates.

isa = transpile(qc, basis_gates=["rz", "rx", "rzz"])

What should happen?

  • Qiskit transpiler should support arbitrary fractional two qubit basis gates, e.g. RZX, RXX, RYY, RZZ, RXY, ....
  • Transpiling with Target and giving basis_gates should behave identically.

This is related but might be a feature request; even if I give RZXGate(Parameter(ϴ)) in the target, current synthesis algorithm only picks pi/4 rotation. The synthesis pass should consider another angle if there is possibility of reducing the circuit depth.

Any suggestions?

No. I'm not familiar with synthesis passes.

@nkanazawa1989 nkanazawa1989 added the bug Something isn't working label Apr 30, 2024
@MozammilQ
Copy link
Contributor

MozammilQ commented May 14, 2024

Many components of transpiler is currently being ported to Rust.
Not, sure if the fix of this bug is supposed to be in the current python code base or the fix is planned in the future Rust code base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants