Chapter 4 — Circuits, Compilation, and Real Hardware
1. Logical circuits versus physical execution
A circuit diagram expresses a logical algorithm. Real processors impose native gate sets, finite connectivity, calibration-dependent errors, and scheduling constraints. Compilation translates the logical description into operations that a selected target can execute.
2. Connectivity and routing
If two logical qubits that must interact are mapped to physical qubits without a direct supported interaction, the compiler may introduce routing operations such as SWAP decompositions. Added two-qubit operations often matter because they are typically more error-prone than simple single-qubit operations.
3. Depth and critical path
Gate count and circuit depth measure different things. Independent gates may execute in parallel, so a circuit with many gates can still have moderate depth. Under decoherence, the temporal critical path and the number/type of noisy operations both matter.
4. Transpilation is part of the experiment
Optimization can cancel gates, choose alternative decompositions, or remap qubits. When comparing hardware, students should preserve both the original logical circuit and the transpiled circuit, record compiler settings, and avoid attributing every performance difference directly to the processor.
5. Noise and readout
Observed counts combine algorithmic behavior with state-preparation, gate, decoherence, crosstalk, and measurement effects. A real-hardware histogram should therefore be interpreted relative to an ideal baseline and, when appropriate, a noise model rather than treated as the 'true' quantum answer.
Student exploration and activities
Use case: why the same circuit behaves differently on different processors
Real devices have connectivity, native-gate, calibration, and noise constraints. Compilation is therefore not a cosmetic software step; it mediates between an algorithm and a physical machine. This is the right place to connect computer-science concepts such as mapping and optimization to quantum hardware.
Problem: hardware comparisons can be unfair
A circuit may require extra routing on one topology and not another. Comparing raw output fidelity without recording the transpiled circuits can confuse compiler overhead with hardware quality. Device calibration also changes over time.
Suggested student activity
Students can sketch a three-node device topology and propose a route for a two-qubit interaction between its endpoints. Counting additional gates provides a way to discuss compilation overhead.
Questions for exploration
Students can make a prediction, explain the reasoning in plain language, and identify an observation that would challenge the prediction. The outcome can then be connected to the mathematical model introduced in this chapter.
Worked example
Imagine a three-qubit line 0—1—2 but the logical circuit requests an interaction between logical qubits mapped to physical 0 and 2. Routing is required. Record the transpiled two-qubit gate count and depth, then compare with a mapping that places the interacting logical pair on adjacent physical qubits.
How to reason about the result
Separate three layers: (1) the ideal mathematical prediction, (2) finite-shot sampling, and (3) implementation effects such as noise or compilation. A good laboratory report identifies which layer can plausibly explain an observed discrepancy.
Check your understanding
- Why can two compilations of the same logical circuit produce different hardware accuracy?
- Distinguish gate count from depth.
- List the metadata needed to reproduce a transpilation result.
Projects unlocked
Before moving on
You should be able to explain the central idea in your own words, perform the worked example without copying it, and make a falsifiable prediction for the first linked project.