Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
4.83k stars 2.29k forks source link

Rework heirarchy of `CircuitInstruction` and `PackedInstruction` #12622

Open mtreinish opened 1 week ago

mtreinish commented 1 week ago

What should we add?

Since #10827 we had a two level hierarchy for instructions in a circuit. There was CircuitInstruction which was a python space representation and PackedInstruction which was a rust space representation with a compressed qubit representation. At that point in time this was fine because we never were accessing any data in the circuit via rust and we were only using rust to store a compressed form at rest. However, since #12459 merged this has gotten a bit more muddled because we have frequent use of circuit data via rust. This has led the original abstractions to not holding up as well because the packed instruction is not as compact as it could be and the we're using the python space representation from rust. We should add a new middle representation for a rust native "unpacked instruction".