System and Environment Information
- OS: Linux (NixOS) - kernel 6.19.10-cachyos, x86_64
- Python: 3.13.12
- uv: 0.11.7
- mqt-bench: 2.2.2
- qiskit: 2.4.1
Bug Description
When using save_circuit(..., output_format=OutputFormat.QASM3) for the grover benchmark, the emitted QASM3 file contains a malformed gate definition that causes Qiskit to fail when loading the file.
- Defined (line 1139):
gate mcphase_0(_gate_p_0) _gate_q_0, _gate_q_1, ...
- Called without parameter (line 1955):
mcphase_0 _gate_q_0, _gate_q_1, ...
Steps to Reproduce
minimal script to reproduce:
from pathlib import Path
from mqt.bench import BenchmarkLevel, get_benchmark
from mqt.bench.output import OutputFormat, save_circuit
from qiskit.qasm3 import load
OUT = Path("grover_10.qasm")
# Step 1: generate the benchmark and export to QASM3
qc = get_benchmark(benchmark="grover", level=BenchmarkLevel.ALG, circuit_size=10)
save_circuit(
qc, str(OUT.with_suffix("")), BenchmarkLevel.ALG, output_format=OutputFormat.QASM3
)
# Step 2: attempt to load - this fails
try:
load(OUT)
except Exception as e:
print(f"Qiskit load fails:\n {type(e).__name__}: {e}")
System and Environment Information
Bug Description
When using
save_circuit(..., output_format=OutputFormat.QASM3)for thegroverbenchmark, the emitted QASM3 file contains a malformed gate definition that causes Qiskit to fail when loading the file.gate mcphase_0(_gate_p_0) _gate_q_0, _gate_q_1, ...mcphase_0 _gate_q_0, _gate_q_1, ...Steps to Reproduce
minimal script to reproduce: