Skip to main content

Crate sirraya_qutub_transpiler

Crate sirraya_qutub_transpiler 

Source
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 Circuit to a specific backend’s native gate set, instead of only the trapped-ion-style {Rz, Ry, Rzz} target in crate::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, or crate::backend::BackendCircuit) – as a standard quantum circuit diagram, either as ASCII text (a String you can print) or as a standalone SVG document (a String of valid XML).
emit
Executes a NativeCircuit against the real sirraya_qutub::core::QuantumRegister, and emits it back out as sirraya_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’s apply_* surface) – the narrowing to a hardware-native set happens in crate::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, Rzzsirraya_qutub’s apply_rz / apply_ry / apply_rzz. This is the gate set the crate’s HardwareCalibration (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 fixed Cx/Swap/Rxx/Ryy identities in crate::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 – see crate::native’s module doc).
qasm
A subset OPENQASM 2.0 importer.
route
Inserts Swaps into a source-level Circuit so that every two-qubit gate ends up between physical qubits a CouplingMap actually allows to interact directly, before crate::native::decompose or crate::backend::lower ever sees it.