The Loop Buffer vs. The Uop Cache: Two Different Ways CPUs Skip the Front-End

2026-07-21

Modern x86 CPUs have two separate mechanisms that let hot code bypass the expensive decode pipeline, and programmers routinely confuse them. The uop cache (DSB on Intel, op cache on AMD) stores decoded micro-ops keyed by instruction-pointer, holding thousands of uops across many code regions. The loop buffer (LSD — Loop Stream Detector) is smaller, holds one specific loop, and works by locking uops in the micro-op queue itself so they replay from there without even hitting the uop cache.

The distinction matters because they have different capacity limits, different triggering conditions, and fail in different ways.

Concrete example: A tight AES-CTR encrypt loop of ~40 uops running 10 million iterations. On Skylake with LSD enabled, the front-end draws almost no power for those iterations — measurable as ~5% package power reduction versus running from the uop cache. But on Skylake specifically, Intel disabled the LSD via microcode after a hyperthreading errata (SKX-102). Suddenly the same binary runs from the uop cache instead: same throughput, higher power, and now sensitive to alignment because the uop cache is 32-byte-window addressed.

Rule of thumb for when each kicks in:

The failure mode that bites people: a loop that almost fits the LSD (say 68 uops) runs measurably slower than one at 60 uops — not because decode is slow, but because you lose the power-gated fetch and the guaranteed 6-wide delivery. Unrolling less can make loops faster. Similarly, adding a single AVX-512 instruction can push a loop past the LSD threshold and simultaneously trigger frequency throttling. Two invisible cliffs, one instruction.

The uop cache is the workhorse; the LSD is a specialized power/throughput optimization for the tightest inner loops. Knowing which one your hot code lives in tells you which knobs matter — alignment and window packing for the uop cache, uop count and instruction mix for the LSD.

Key Takeaway: The uop cache stores decoded ops across all hot code, while the LSD locks a single tiny loop in the micro-op queue and shuts off everything upstream — same goal, different scale, different failure modes.

All newsletters