Circuit library modernization
Summary
Modernize the circuit library to improve compiler quality and construction speed. The library circuits are classified in two categories:
-
Abstract blocks Operations defined by an action they perform (e.g. mathematical transformation), but can be synthesized in different fashions. These will be
Instruction/Gateobjects with a detached synthesis, that the compiler can reason about. Examples: QFT, Pauli evolutions, arithmetic circuits, MCX gates. -
Structural circuits Circuit defined by their structure (the circuit is unique and cannot be built another way). These will be Python functions returning a
QuantumCircuit. Examples: n-local circuits, quantum volume
Changes are to be pending-deprecated for 1.3, deprecated for 1.4 and finalized for 2.0.
Examples
The move to abstract blocks allows the compiler to reason about the circuit building blocks, where previously there was an eager construction:
circuit = ...
circuit.append(MCXGate(n), range(n - 1), [n]) # compiler can now allocate auxiliary qubits for efficient synthesis
circuit.append(QFTGate(2 * n), range(2 * n)) # compiler can choose optimal method based on topology or following measurements
circuit.measure_all()
Python functions can be used as drop-in replacement,
circuit = two_local(num_qubits, ["rx", "ry"], "cx", entanglement="pairwise")
but can enable performance-improvements, e.g. by directly composing onto output circuits.
#### Abstract blocks
- [x] HLS with ancillas
- [x] `MCXGate`: synthesize via HLS & pending-deprecate MCX gate classes other than `MCXGate` (#12961)
- [x] `MCMTGate`: synthesize with HLS synthesis & pending-deprecate `MCMT` and `MCMTVChain` (#13150)
- [ ] Pending deprecate circuits with existing gates: `QFT`, `Permutation`, `Diagonal`, `GMS` (@Cryoris) (#13232)
- [ ] `PhaseOracle`: additionally needs a tweedledum-free synthesis method
- [ ] `library.boolean_logic`: straightforward porting to `Gate` (@alexanderivrii) #13333
- [ ] `library.arithmetic`: more involved, as there are many building blocks
- [ ] `GraphState`
#### Structural circuits
- [ ] `n_local` & friends @Cryoris (#13310)
- [x] `pauli_feature_map` & friends (#13045)
- [x] `quantum_volume` @mtreinish (#13238)
- [ ] `fourier_checking`
- [ ] `iqp` (#13241)
- [ ] `unitary_overlap`
- [ ] `hidden_linear_function`
- [ ] `phase_estimation`
- [ ] `grover_operator`
- [ ] `qaoa_ansatz`
#### Performance
- [x] Entanglement logic to Rust (#12950)
- [ ] Oxidize `n_local` & friends (@Cryoris) #13310
- [x] Oxidize `pauli_feature_map` & friends (#13045)
- [x] Oxidize MCMT v-chain synthesis (@Cryoris) (#13150)
- [ ] In-place composition of functions, e.g. `n_local(..., out=circuit)`
- [ ] https://github.com/Qiskit/qiskit/pull/13295
@Cryoris , am I allowed to start with "Structural Circuits"? and, are markings with '@Cryoris' like in 'n_local & friends' in performance, indicates you are working on it, right?
Hi @MozammilQ, it's great to see you're interested! We would like to have some PRs done by the dev team first to figure out the details and have some examples ready. Once that's done it you're very welcome to help 🙂
@Cryoris, I would be interested in implementing a multitude of quantum arithmetic circuits for synthesis. When the time is right please let me know.
Qiskit team should also decide if they really want these circuits as part of the core library or not.
Done! Thanks for @alexanderivrii @ShellyGarion @mtreinish and @gadial and everyone for the help!