Circuit Depth
Circuit depth counts sequential gate time steps, and deeper circuits are more vulnerable to decoherence on real hardware
Source: mortalapps.com- Circuit width is the total number of qubits (wires) in the circuit.
- Gate count is the total number of individual gates applied in the circuit.
- Circuit depth is the minimum number of parallel time steps required to execute all gates.
- Gates acting on disjoint qubits can be executed in parallel in a single depth layer.
- The critical path is the longest sequence of dependent gates, determining the minimum depth.
- Adding helper qubits (ancillas) can reduce circuit depth by enabling parallel execution.
- Minimizing depth is crucial for running circuits within the physical coherence time of the hardware.
Why This Matters
When designing quantum circuits, we must consider not only whether they are mathematically correct, but also whether they can physically run on real hardware before the qubits decohere. This physical constraint is measured by two key metrics: circuit width (the number of qubits) and circuit depth (the number of sequential time steps required to execute the gates).
In this topic, we will study circuit depth and width. You will learn how to analyze a circuit diagram to calculate its depth by grouping gates into parallel layers. We will explore the critical path, the longest sequence of dependent operations that dictates the minimum execution time of the circuit.
By the end of this topic, you will be able to calculate the depth, width, and gate count of any quantum circuit, and you will understand how to parallelize independent operations to minimize depth and maximize the chance of a successful computation.
Core Intuition
Imagine you are cooking a complex multi-course meal. The 'width' of your kitchen is the number of chefs you have working simultaneously. The 'gate count' is the total number of individual tasks (chopping, boiling, baking) that must be done.
The 'depth' of the recipe is the total time it takes to complete the meal, assuming you parallelize as much as possible. For example, while the sauce is simmering (one chef), another chef can be chopping vegetables. However, you cannot bake the cake until the batter is mixed; these tasks are sequential.
The 'critical path' is the longest chain of dependent tasks (mix batter -> bake cake -> frost cake). No matter how many chefs you add, you cannot make the meal faster than this critical path. In quantum circuits, minimizing depth means finding independent gates that can be executed at the same time, reducing the overall exposure of our fragile qubits to environmental noise.
Visualization
Technical Explanation
A quantum circuit can be characterized by three primary metrics: 1. Width ($w$): The total number of qubits (wires) in the circuit. 2. Gate Count ($g$): The total number of individual gates applied in the circuit. 3. Depth ($d$): The minimum number of time steps required to execute all gates, assuming that gates acting on disjoint qubits can be executed in parallel.
To calculate circuit depth, we partition the circuit into discrete layers. Each layer consists of a set of gates that act on completely disjoint sets of qubits. The depth is the total number of these layers.
Let us look at a mathematical example. Suppose we have a 3-qubit circuit with the following gates:
- Layer 1: $H$ on $q_0$, $X$ on $q_1$ (can be run in parallel, depth = 1)
- Layer 2: $\text{CNOT}$ from $q_0$ to $q_1$ (depends on previous gates, depth = 2)
- Layer 3: $Z$ on $q_2$ (independent of CNOT, but if scheduled after, it can sometimes be parallelized. However, if it is run after the CNOT, the total depth is determined by the longest path of dependent gates).
The critical path is the longest path of dependent gates from input to output. The depth of the circuit is exactly equal to the length of this critical path.