Fix qiskit_to_ionq qubit inflation with qiskit>=2#1142
Fix qiskit_to_ionq qubit inflation with qiskit>=2#1142
Conversation
With qiskit 2.x + qiskit-ionq 1.0.x, qiskit.transpile() maps circuits onto the full backend topology (e.g. 1-qubit circuit -> 29 qubits targeting physical qubit 12). qiskit_to_ionq was using circuit.num_qubits directly, causing the IonQ API to receive inflated qubit counts and remapped targets, leading to simulator timeouts on trivial circuits. Now computes the set of actually-used qubit indices and remaps them to a compact 0-based range, matching the dense_widths approach used by qiskit-ionq's own serializer. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can get early access to new features in CodeRabbit.Enable the |
Summary
qiskit>=2.0+qiskit-ionq>=1.0,qiskit.transpile()maps circuits onto the full backend topology (e.g. a 1-qubit circuit becomes 29 qubits with the gate on physical qubit 12)qiskit_to_ionqwas usingcircuit.num_qubitsdirectly, causing the IonQ API to receive inflated qubit counts and remapped target indices, leading to simulator timeouts on trivial circuitsdense_widthsapproach used by qiskit-ionq's own serializer