Introduction: The Challenge of Spatial Dataflow
Spatial Dataflow Architectures (SDAs), exemplified by the Cerebras Wafer-Scale Engine (WSE), represent a paradigm shift in high-performance computing. By replacing traditional shared memory and cache hierarchies with hundreds of thousands of distributed processing elements (PEs) and ultra-fast local memory, SDAs offer unprecedented performance for AI and scientific simulations. However, this performance comes at the cost of extreme programming complexity. Developers must manually orchestrate data movement across circuit-switched networks-on-chip (NoC), explicitly assigning limited hardware routing channels (colors) to avoid collisions and managing asynchronous task execution.
SPADA is a new programming language and compiler intermediate representation (IR) designed to address these challenges. It provides high-level abstractions for data placement, routing, and asynchronous execution, significantly reducing the burden on the programmer while maintaining high hardware utilization.
The SPADA Programming Model
SPADA abstracts low-level hardware details by dividing programs into three distinct blocks: place, dataflow, and compute. This separation of concerns allows developers to focus on the logic of their algorithms without being overwhelmed by hardware trivia.
- Place: Allocates data structures to specific PEs or regions of the grid.
- Dataflow: Defines communication streams between PEs, abstracting the underlying NoC.
- Compute: Handles asynchronous mathematical operations, triggered by the arrival of data.
By formalizing these semantics, SPADA enables the compiler to catch data races and deadlocks at compile time, shifting the burden of correctness from the developer to the toolchain.
Automated Routing and Compilation
A central innovation in SPADA is its approach to the "routing nightmare." In traditional SDA programming, manual channel assignment is error-prone and leads to non-deterministic runtime bugs. SPADA introduces a Checkerboard Decomposition algorithm to automate this process. By splitting the PE grid based on coordinate parity (even/odd), the compiler guarantees that communication streams never share overlapping channels, eliminating routing conflicts by construction.
The SPADA compiler lowers high-level code to Cerebras CSL, handling task decomposition, automatic vectorization, and I/O mapping. It also serves as a robust "waistline" abstraction, acting as a target for domain-specific languages like GT4Py, which is used for weather forecasting simulations.
Evaluation and Performance
SPADA was evaluated using a variety of HPC kernels, including 1D reductions and complex 3D weather simulation stencils (e.g., Laplacian, UVBKE). The results demonstrate that SPADA achieves high performance with significantly less effort:
- Code Efficiency: SPADA kernels require 6–8x fewer lines of code than equivalent low-level CSL. When used as a target for GT4Py, the reduction in developer-written code is as high as 700x.
- Throughput: The compiler-generated code achieved over 150 TFlop/s on a full wafer-scale system for complex weather kernels.
- Scaling: Kernels exhibited near-ideal weak scaling across three orders of magnitude, proving that automated communication overhead is negligible even at the scale of hundreds of thousands of PEs.
- Memory Bandwidth: Baseline kernels utilized 75–85% of the WSE-2’s peak sustained memory bandwidth (6.3–7.24 GiB/s per PE).
Conclusion and Future Work
SPADA successfully tames the complexity of SDAs by providing a structured, safe, and high-performance programming environment. While current automated routing is restricted to single-hop communication, future work aims to extend these techniques to multi-hop patterns. This will enable efficient implementations of global communication algorithms like Fast Fourier Transforms (FFTs) and multi-grid solvers, further expanding the utility of wafer-scale architectures for general scientific computing.
Summary updated