What does Intel mean by "retired"?

merlin2011 picture merlin2011 · Mar 13, 2014 · Viewed 9.4k times · Source

In the Intel Manual, there is mention of a lot of performance events which have descriptions like "Mispredicted taken branch instructions retired.". What exactly does retired mean in this context?

Note that I have already looked at Intel's Performance Analysis Guide, which states that "retired" has a very precise meaning (on page 8), referring to the diagram on page 7, but I think I lack the background knowledge to understand exactly what is mean by Retirement / Writeback. What exactly is that process and what does it involve?

Answer

osgx picture osgx · Mar 13, 2014

In the context "retired" means: the instruction (microoperation, μop) leaves the "Retirement Unit". It means that in Out-of-order CPU pipeline the instruction is finally executed and its results are correct and visible in the architectural state as if they execute in-order. In performance context this is the number you should check to compute how many instructions were really executed (with useful output). If your context is energy saving, you may check how many instructions started their execution in OOO pipeline ("ISSUED" counter or "EXECUTED" counter) and compare the number with count of retired operation; high difference shows that CPU does a lot of useless work and uses excess power.

Short description of the Retirement unit is here: http://users.utcluj.ro/~baruch/book_ssce/SSCE-Intel-Pipeline.pdf

5.4.7.4. Retirement Unit

The retirement unit writes the results of speculatively executed microoperations into the user-visible registers and removes the microoperations from the reorder buffer. Like the reservation station, the retirement unit continuously checks the status of microoperations in the reorder buffer, looking for ones that have been executed and no longer have any dependencies with other microoperations in the instruction pool. It then retires completed microoperations in their original program order.

The retirement unit can retire three microoperations per clock cycle (/<-- this may be outdated/). In retiring a microoperation, it writes the results to the processor’s register file and/or memory. After the results have been written, the microoperation is removed from the re-order buffer.

More detailed information about unit is here (by Agner Fog) http://www.agner.org/optimize/microarchitecture.pdf chapter Retirement for your CPU