Instruction-Level Parallelism & Out-of-Order Execution

register renaming

Suppose a hotel has only ten room numbers on the doors (rooms 1 to 10) but actually owns a hundred rooms behind them, and a clever desk clerk who, each time someone asks for 'room 3', quietly assigns a different real room and remembers the mapping. Two guests can both be told they are in 'room 3' yet never collide, because behind the scenes they are in different physical rooms. Register renaming is this clerk: the program names a small set of architectural registers, but the hardware maps each one to a much larger pool of physical registers, picking a fresh physical register for every new write.

Mechanically, the core keeps a register alias table (RAT) mapping each architectural register name (x0…x31) to the physical register currently holding its value. When an instruction writes, say, x5, the renamer allocates an unused physical register p42, points x5 to p42 in the table, and rewrites later readers of x5 to read p42. Because every write gets its own physical register, the write-after-read and write-after-write (false) dependences that came from reusing the name x5 simply cannot occur — only true read-after-write dependences (a reader pointed at the producer's physical register) survive. Free physical registers come from a free list; one is returned when an old value is no longer needed.

Renaming is the unsung enabler of out-of-order execution. Without it, the handful of architectural register names would constantly collide and serialize independent instructions; with it, the machine exposes far more parallelism than the ISA's register count suggests. The honest cost is the renaming hardware itself — large physical register files, the alias table, allocation and free-list logic — which consumes area and power, and which must be carefully unwound on a branch misprediction or exception so the visible register state stays exactly correct.

Two unrolled loop iterations both write x10. Renaming maps the first write to p20 and the second to p21, so the iterations no longer share a name and can execute in parallel instead of serializing on x10.

Many physical registers behind a few architectural names — false dependences dissolve.

Renaming removes false (WAR/WAW) dependences but never true (RAW) ones — you cannot rename your way past a value that genuinely must be produced before it is read. It also must be rolled back precisely on mispredictions.

Also called
renamingregister alias table重新命名