Modern computing faces a fundamental imbalance: processors can perform arithmetic operations orders of magnitude faster than they can fetch data from main memory. This "memory wall" means that for most high-performance applications—from Large Language Models (LLMs) to genomic sequencing—the bottleneck is not the speed of the CPU or GPU, but the latency and bandwidth of the data path.
To solve this, researchers have converged on a shared strategy: Hierarchical Tiling. By recursively partitioning large datasets into nested blocks that match the physical layers of a hardware's memory hierarchy, algorithms can maximize "data reuse," ensuring that once a piece of data is fetched, it is used as many times as possible before being evicted.
The Intuition: Tiles within Tiles
The core idea of tiling (or blocking) is to break a large operation, like a matrix multiplication, into smaller chunks that fit into fast, local memory. However, modern hardware does not have just one "local memory." A typical system has a deep hierarchy: registers, multiple levels of cache (L1, L2, L3), shared memory (on GPUs), HBM or DRAM, and sometimes even SSDs.
Hierarchical tiling treats this memory stack as a set of nested containers. As Guillermo Alaejos demonstrates in the context of ARM processors, efficient matrix multiplication requires structuring memory access into a multi-layered hierarchy of blocks and panels. A large block might be sized to fit the L2 cache, while a smaller sub-block within it is sized for the L1 cache, and the smallest "micro-kernel" operates directly on registers.
This nested approach is critical because an optimization for one level can inadvertently starve another. For instance, Ryan Swann notes that in chiplet-based GPU architectures, optimizing for a single cache level can negatively impact performance at higher levels. His work on HipKittens uses "cache-aware swizzling" to coordinate data access across these layers simultaneously.
Bridging the Latency Gap
The effectiveness of hierarchical tiling scales across vastly different hardware domains:
- Deep Learning: To handle the quadratic bottleneck of Transformer attention, Sheng-Chun Kao and colleagues developed FLAT, which uses hierarchical tiling to decompose attention into blocks that fit in on-chip scratchpads. Similarly, Haoran Lin and Xianzhi Yu show that for low-resource GPUs, nested block sizes are essential to balance global memory bandwidth with the constraints of smaller on-chip caches.
- Large-Scale Analytics: When data is too large for RAM, the hierarchy extends to storage. Da Zheng and the FlashR team use two distinct scales of partitioning: large blocks for throughput from SSDs to memory, and smaller sub-blocks for CPU cache locality.
- Cryptographic Primitives: In Homomorphic Encryption, Shiyu Shen and Yu Liu utilize hierarchical stages to manage the Number Theoretic Transform, maximizing the use of fast on-chip storage for intermediate calculations to make encrypted processing practical.
Automating the Mapping
Manually determining the optimal tile size for every level of a specific chip is a daunting task. The research has shifted toward Analytical Performance Modeling to automate this mapping.
Frameworks like FLASH, developed by Gordon Euhyun Moon and others, use cost models to prune the astronomical search space of possible tiling configurations. By mathematically identifying the balance point between compute and data movement, these systems can find "mappings" that reduce energy consumption by over 90%.
In the compiler space, Guyue Huang and the ALCOP team have pushed this further by automating "multi-level pipelining." This technique doesn't just tile the data; it overlaps the movement of data between all levels of the hierarchy (Global $\to$ Shared $\to$ Register) with the actual computation, ensuring the processor never stalls while waiting for the next block.
Why It Works: Temporal and Spatial Locality
At its heart, hierarchical tiling works by exploiting two types of locality. Spatial locality is achieved by ensuring that data residing near each other in memory is processed together, which aligns with how hardware fetches "lines" or "blocks" of data. Temporal locality is achieved by keeping a tile in a high-speed cache and performing every possible operation on it before moving to the next tile.
As Jiyuan Zhang and Franz Franchetti demonstrate with direct convolutions, by reordering loops to fit the register and cache hierarchy, we can eliminate the need for memory-heavy data "packing" (like im2col). This proves that the most efficient way to process data is often to change the order of the work to match the physical shape of the machine.