Evaluating Spatial Accelerator Architectures with Tiled Matrix-Matrix Multiplication
TL;DR
Researchers have developed FLASH, a mapping explorer, and MAESTRO-BLAS, an analytical cost model, to automatically find the most efficient ways to run matrix multiplication on diverse spatial accelerators. Their framework prunes the astronomical search space of possible configurations by 99.7%, identifying "mappings" that reduce runtime by up to 94% and energy consumption by 96%.
What Problem Does This Paper Address?
The rise of Machine Learning (ML) has led to a "Cambrian explosion" of custom ASIC spatial accelerators like Google’s TPU, NVIDIA’s NVDLA, and research prototypes like Eyeriss. Unlike traditional CPUs or GPUs, these accelerators use a spatial array of Processing Elements (PEs) that communicate via custom networks-on-chip (NoC) and private scratchpad buffers.
The challenge is that every accelerator has a different dataflow—a specific strategy for how data is moved, reused, and partitioned across PEs. For a fundamental operation like General Matrix-Matrix Multiplication (GEMM), the number of ways to "tile" the matrices, order the loops, and parallelize the work is in the billions. Finding the optimal configuration (the "mapping") for a specific matrix shape on a specific piece of hardware is currently a manual, Herculean task for architects.
Methods
The authors introduce a two-part framework to automate this evaluation:
- FLASH (Flexible Linear Algebra dataflow via Spatio-temporal Hierarchical-mapping): This is the "explorer." Instead of brute-forcing billions of combinations, FLASH uses hardware constraints (like the size of S1/S2 buffers and NoC capabilities) to analytically derive a small set of candidate tile sizes. This prunes the search space by over 99%, making it feasible to find near-optimal mappings in seconds.
- MAESTRO-BLAS: This is the "judge." It is an analytical cost model that takes a mapping and a hardware description as input and predicts performance metrics like runtime, energy, and buffer activity. It extends the existing MAESTRO model to support native linear algebra operations.
The researchers used this framework to model five distinct accelerator "styles": Eyeriss (row-stationary), NVDLA (weight-stationary), TPU (systolic/weight-stationary), ShiDianNao (output-stationary), and MAERI (flexible dataflow).
Datasets
The framework was evaluated against:
- Six GEMM Workloads: Ranging from massive square matrices ($8192 \times 8192$) to "tall-skinny" and "short-fat" matrices typical in scientific computing and specific ML layers.
- Deep Neural Network (DNN) Layers: Specifically, four fully-connected (FC) layers from a Multi-Layer Perceptron (MLP) model used for MNIST digit recognition.
Key Insights and Ideas
- Loop Order is a Game Changer: On GPUs, one loop order is usually the "gold standard." On spatial accelerators, the best loop order depends heavily on the matrix shape and the specific hardware dataflow. For example, switching loop orders on a MAERI-style accelerator for a specific workload reduced energy usage by 76.5%.
- The "One Size Fits All" Myth: No single accelerator architecture dominated all workloads. While NVDLA-style mappings performed best for square matrices, flexible architectures like MAERI could outperform fixed-dataflow designs on irregular matrix shapes by adapting their mapping strategy.
- Analytical Pruning Works: By using the physical limits of the hardware (buffer sizes) as mathematical constraints, the authors proved you don't need to simulate every possibility to find the best one.
- Tiling is Mandatory: The study showed that "non-tiled" mappings (simply feeding data as it fits) are incredibly inefficient. Proper tiling is the primary driver of performance, often more impactful than the loop order itself.
Key Results
- Search Efficiency: FLASH reduced the search space for a $256^3$ GEMM by 99.7% and decreased the time required to find the best mapping by 99.9% compared to exhaustive search.
- Performance Gains: Mappings found by FLASH achieved up to 94% lower runtime and 96% lower energy compared to non-tiled baselines.
- Quality of Mapping: The framework consistently found mappings that were significantly better than average; a "bad" mapping in the same search space could be up to 4.02x slower than the one FLASH selected.
- Flexibility Pays Off: Flexible accelerators (like MAERI) provided up to 65.3% runtime improvement over fixed-dataflow accelerators when averaged across diverse workloads.
Limitations and Future Work
- Dense Focus: The current work focuses on dense GEMM. The authors note that extending this to sparse matrix-matrix multiplication (SpGEMM) is a vital next step, as many modern ML models rely on sparsity for efficiency.
- Kernel Variety: While GEMM is foundational, other kernels (like those found in scientific computing) have different data reuse patterns that the framework hasn't yet explored.
- Simulation vs. Silicon: The evaluations are based on analytical models and simulations. While these models are validated against existing chips like Eyeriss, real-world "tail" effects in hardware (like thermal throttling or complex NoC congestion) might introduce nuances not captured here.
Summary updated