Domain-Specific Architectures & Accelerators

a scratchpad memory

A cache is like a smart assistant who quietly keeps copies of whatever books you have used recently on a nearby shelf, guessing what you will want next — convenient, but you do not control it. A scratchpad memory is the opposite arrangement: it is your own small, fast desk where you explicitly decide which books to place and when to put them back. There is no guessing and no automatic behavior — the software places data into the scratchpad and removes it on purpose. It is fast on-chip memory under direct program control.

Concretely, a scratchpad is a block of fast SRAM on the chip, just like a cache, but with one crucial difference: it has no tags, no automatic fill, no replacement policy, no coherence machinery. A cache transparently mirrors main memory and decides for itself what to keep; a scratchpad is simply a small private memory at its own fixed addresses, and the program (or compiler) issues explicit instructions to copy data in from main memory, compute on it, and copy results back out. Because it does none of the guessing a cache does, a scratchpad of the same size uses less area and energy, and — most importantly — its timing is perfectly predictable: an access always hits, with no surprise cache misses.

Why accelerators love this: for a domain with a known, regular data pattern (like the matrices flowing through a deep-learning accelerator), the compiler already knows exactly which data is needed when, so a cache's clever guessing is wasted overhead and its unpredictable misses are a liability. A scratchpad lets the software stage data perfectly, keeps the arithmetic units fed on a known schedule, and spends no transistors on cache logic. The honest cost is that this burden now falls on the programmer or compiler — managing a scratchpad by hand is harder than relying on an automatic cache, which is exactly why caches dominate general-purpose CPUs where access patterns are unpredictable.

A deep-learning accelerator copies a tile of weights and a tile of inputs from main memory into its scratchpad once, then reuses them across many multiply-adds before writing the results back. Because the program placed that data deliberately, the arithmetic array never stalls on a surprise miss — every access to the scratchpad is a guaranteed hit.

Scratchpad vs cache: explicit, predictable, software-managed — no tags, no guessing, no surprise misses.

A scratchpad is not a cache with the magic turned off — it has none of a cache's automatic machinery, which is both its strength (predictable, cheap) and its burden (the software must manage every transfer by hand).

Also called
scratchpadsoftware-managed on-chip memorylocal store便箋記憶體