Skip to content

QASM 3 exporter makes multiple definitions for same gate #9428

@nonhermitian

Description

@nonhermitian

Environment

  • Qiskit Terra version: lastest
  • Python version:
  • Operating system:

What is happening?

qc = QuantumCircuit(2)
qc.rzz(1,0,1)
qc.rzz(1,0,1)
qc.rzz(1,0,1)

gives a unique QASM3 gate definition for each gate above even though they are identical.

OPENQASM 3;
include "stdgates.inc";
gate rzz_4592196368(_gate_p_0) _gate_q_0, _gate_q_1 {
  cx _gate_q_0, _gate_q_1;
  rz(1) _gate_q_1;
  cx _gate_q_0, _gate_q_1;
}
gate rzz_4592194880(_gate_p_0) _gate_q_0, _gate_q_1 {
  cx _gate_q_0, _gate_q_1;
  rz(1) _gate_q_1;
  cx _gate_q_0, _gate_q_1;
}
gate rzz_4592190992(_gate_p_0) _gate_q_0, _gate_q_1 {
  cx _gate_q_0, _gate_q_1;
  rz(1) _gate_q_1;
  cx _gate_q_0, _gate_q_1;
}
qubit[2] _all_qubits;
let q = _all_qubits[0:1];
rzz_4592196368(1) q[0], q[1];
rzz_4592194880(1) q[0], q[1];
rzz_4592190992(1) q[0], q[1];

How can we reproduce the issue?

Run above

What should happen?

Ideally, every unique gate would have a single definition.

Any suggestions?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions