Cache-oblivious algorithms omit cache parameters from the code and analyze block transfers under an explicit memory model.
Parameters in code and analysis
A cache-oblivious algorithm does not take cache size M or block size B as inputs. Its analysis still uses both variables. Omitting parameters from code does not make performance independent of hardware.
Frigo, Leiserson, Prokop, and Ramachandran introduced the model at FOCS 1999. Their TALG 2012 extended paper analyzes transfers for sorting, matrix transposition, FFT, and other operations in an ideal-cache model. The work received an IEEE FOCS Test of Time Award for its influence on theoretical and systems research.
| Model element | Role in the analysis |
|---|---|
| Cache size M | Number of elements in fast memory |
| Block size B | Number of elements transferred together |
| Full associativity | Any block can occupy any cache location |
| Optimal replacement | An ideal policy with knowledge of future accesses |
| Tall-cache condition | The relation between M and B required by a theorem |
A common condition is M = Ω(B²). M and B must use the same element units. Comparing a byte count directly with a squared byte count is not a valid check. Nor can every model assumption be assumed to hold on a particular CPU.
Recursive layout
Repeated division eventually makes a subproblem fit in cache. The algorithm need not identify that recursion level. Its data must still be placed close together for the structure to produce block reuse.
The van Emde Boas (vEB) layout for a static search tree divides the tree by height and recursively stores each subtree contiguously. Demaine's research survey describes a search bound of O(1 + log_B N) block transfers for this layout.
Divide the tree by height.
Recursively lay out the upper subtree.
Recursively lay out each lower subtree.This describes a static layout. Dynamic insertion and deletion require additional movement and free-space management. A static search bound is not a bound for dynamic updates.
Conditions for Funnelsort
Funnelsort divides N elements into about N^(1/3) groups. Each group contains about N^(2/3) elements. It recursively sorts these groups and merges them with a recursive buffer structure called a funnel.
Under the ideal-cache and tall-cache assumptions, it achieves an optimal I/O bound for comparison sorting. Its merging buffers support subproblems at different sizes and reuse blocks. Swapping the group count and the group size does not describe the same construction.
| Evidence | What to check |
|---|---|
| Proof | Block-transfer bound and memory assumptions |
| Implementation | Recursion, buffer management, and comparison costs |
| Measurement | Actual cache misses, elapsed time, and auxiliary memory |
Optimal transfers do not imply optimal running time on every CPU. Associativity, prefetching, vectorization, and recursion overhead need separate measurements. This post gives no speedup claim for a particular implementation.
Summary
Cache-oblivious design avoids fixing M and B in code while using both variables to analyze transfers. The vEB layout and Funnelsort show how recursive layout creates reuse at different memory sizes. Their guarantees apply under the stated model and algorithm conditions, while running time must be checked on the implementation and hardware.