Expand description
sirraya-qutub-transpiler
A QASM 2.0 importer and multi-backend native-gate compiler for
circuits destined to run on sirraya_qutub::core::QuantumRegister.
Pipeline: qasm::parse (text -> ir::Circuit) ->
ir_optimize::optimize (source-level cancellation/reordering) ->
backend::lower (ir::Circuit -> a target backend::Backend’s
native gate set, routing through route::route first against a
coupling::CouplingMap for any backend that isn’t all-to-all) ->
optimize::optimize (native-level peephole cleanup) ->
fidelity::estimate_circuit_fidelity (quick sanity-check number)
-> emit::run / emit::run_backend (actually execute it on
sirraya_qutub). diagram::Diagram can render any of the three
circuit levels in this pipeline (source, native, or backend-lowered)
as an ASCII or SVG circuit diagram, independent of the rest of the
pipeline.
See each module’s doc comment for the reasoning behind its piece of
the pipeline, and tests/decompositions.rs for the correctness
checks against native/optimize (run against the real dependency,
not just asserted). ir_optimize and backend each carry their own
#[cfg(test)] unit tests in-module.
Re-exports§
pub use backend::lower;pub use backend::Backend;pub use backend::BackendCircuit;pub use backend::BackendGate;pub use coupling::CouplingMap;pub use diagram::Diagram;pub use diagram::DiagramInstr;pub use ir::Circuit;pub use ir::Gate;pub use ir_optimize::optimize as optimize_ir;pub use native::decompose;pub use native::NativeCircuit;pub use native::NativeGate;pub use optimize::optimize;pub use fidelity::estimate_circuit_fidelity;pub use fidelity::PublishedCalibration;pub use route::route;pub use ibm_export::to_ibm_qasm;pub use ibm_export::lower_ibm_native;pub use ibm_export::IbmInstr;
Modules§
- backend
- Lowers a
Circuitto a specific backend’s native gate set, instead of only the trapped-ion-style{Rz, Ry, Rzz}target incrate::native. - coupling
- Physical qubit connectivity for backends whose native two-qubit gate can only be applied directly between adjacent qubits.
- diagram
- Renders a circuit – at any of the three levels this crate’s
pipeline produces (
crate::ir::Circuit,crate::native::NativeCircuit, orcrate::backend::BackendCircuit) – as a standard quantum circuit diagram, either as ASCII text (aStringyou can print) or as a standalone SVG document (aStringof valid XML). - emit
- Executes a
NativeCircuitagainst the realsirraya_qutub::core::QuantumRegister, and emits it back out assirraya_qutub-dialect QASM text. This is the one module in the crate that actually touches the dependency. - fidelity
- A self-contained circuit-fidelity estimate.
- ibm_
export - Real IBM-hardware-native export for a lowered
crate::backend::BackendCircuit. - ir
- Source intermediate representation: the gate set a QASM 2.0 program
(or any other frontend) is parsed into, before native-gate
decomposition. This is deliberately a rich gate set (mirrors
sirraya_qutub::core::QuantumRegister’sapply_*surface) – the narrowing to a hardware-native set happens incrate::native. - ir_
optimize - Source-level (pre-decomposition) optimization passes over
Circuit, distinct from [crate::optimize]’s peephole pass over already-decomposed native gates. Two kinds of gate pair cancel here: literal self-inverses (H;H,Cx(a,b);Cx(a,b),Swap(a,b);Swap(a,b), …) and explicit inverse pairs (S;Sdg,T;Tdg). Both only fire on adjacent occurrences with identical qubit arguments, so the useful part of this module is the commuting-reorder pass that slides gates past each other to make non-adjacent cancellable pairs adjacent. - native
- Decomposition into a trapped-ion-style native gate set: arbitrary
single-qubit rotations built from
{Rz, Ry}(Euler ZYZ form) plus a single two-qubit entangler,Rzz–sirraya_qutub’sapply_rz/apply_ry/apply_rzz. This is the gate set the crate’sHardwareCalibration(Quantinuum Helios, a trapped-ion device) story is actually about: one single-qubit fidelity number and one two-qubit fidelity number, which only makes sense once every gate in the circuit is one of those two kinds. - optimize
- A small peephole optimizer over
NativeCircuits. Gate decomposition (especially the fixedCx/Swap/Rxx/Ryyidentities incrate::native) tends to emit adjacent same-axis rotations and occasional zero-angle rotations; this pass merges and drops those without changing the circuit’s action (up to global phase, which is never observable here – seecrate::native’s module doc). - qasm
- A subset OPENQASM 2.0 importer.
- route
- Inserts
Swaps into a source-levelCircuitso that every two-qubit gate ends up between physical qubits aCouplingMapactually allows to interact directly, beforecrate::native::decomposeorcrate::backend::lowerever sees it.