What is Top-down analysis?

A method using performance counters to divide the CPU's pipeline slots into four categories (frontend bound, backend bound, bad speculation and retiring), narrowing down bottlenecks.

Field: Performance Analysis

Japanese name: トップダウン分析

The idea of slots

A superscalar CPU can send several instructions into processing in each cycle. These openings are called slots. In many designs, instructions are split internally into small operations called micro-operations, and one slot handles one operation. A CPU with 4 slots per cycle that runs for 1000 cycles has 4000 slots in total. Top-down analysis works out from performance counter values what each of these slots was used for. The number of slots per cycle depends on the CPU design.

The four categories

A slot used by an instruction that completed correctly counts as retiring. A slot used by an instruction that was later discarded, for example after a branch misprediction, counts as bad speculation. Slots left empty while the CPU recovers from the misprediction are counted here as well. Any other slot left empty is classified by its cause. It is frontend bound if fetching and decoding of instructions could not keep up. It is backend bound if the later stages could not accept work because they were waiting on computation or memory. If 1600 of 4000 slots are retiring, that is 40%. The four shares add up to 100%.

How the narrowing proceeds

Among the three categories other than retiring, the one with a large share is chosen and its breakdown is examined in finer detail. If backend bound is large, it is split into waiting on memory and a shortage of execution resources. Frontend bound and bad speculation are divided into lower levels in the same way. Categories with small shares need not be examined, which is more efficient than looking through many counters at random. The method was proposed for out-of-order processors, and the same four categories are used on CPUs with different instruction sets.

Try it: questions about Top-down analysis

In top-down microarchitecture analysis using performance counters, which are the major categories into which CPU issue slots are divided?

  1. AFast, slow and normal
  2. BFrontend bound, backend bound, bad speculation and retiring
  3. CDisk, network, display and keyboard
Show answer and explanation

Answer: B. Frontend bound, backend bound, bad speculation and retiring

Top-down analysis classifies each cycle's issue slots by whether they went empty because the front end (fetch and decode) could not keep up, stalled in the back end (waiting on execution units or memory), were spent on instructions discarded after misprediction, or were used by instructions that completed (retired). Drilling from the largest category into finer causes identifies bottlenecks efficiently.

FAQ

Is looking at IPC not enough?

IPC shows that performance is low but not why. Top-down analysis divides the slots that were not used effectively by cause, which decides where to look next.

If the retiring share is high, is there nothing left to improve?

There may still be room. A high retiring share means that most slots went to instructions that completed. The number of instructions executed can still be reduced, for example by revising the algorithm or by vectorization.

Books on Performance Analysis Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary