Abstract
As neural network (NN) accelerators scale to hundreds of nodes and thousands of processing elements, the complexity of finding optimal dataflow schedules grows exponentially. Existing tools often struggle with the vast search space, particularly when considering multi-layer pipelining across nodes. This paper introduces KAPLA, a framework utilizing tensor-centric directives and a bottom-up solver to efficiently navigate this space. KAPLA achieves near-optimal schedules with up to a 518x speedup over traditional methods, enabling rapid optimization for large-scale AI hardware.
Introduction
In the domain of AI hardware, "dataflow" refers to the orchestration of data movement, storage, and computation across a chip’s hierarchy. Modern scalable architectures—comprising hundreds of nodes and thousands of processing elements (PEs)—present an astronomical number of scheduling possibilities. Traditional tools face significant hurdles: they often ignore multi-layer pipelining, rely on loop-based representations that are difficult for solvers to process quickly, and depend on exhaustive searches or heuristics that may fail to find valid solutions for specialized hardware.
The KAPLA Framework
KAPLA addresses these challenges through a "pragmatic" representation and a specialized solver designed for speed and validity.
Tensor-Centric Directives
Instead of traditional nested loops, KAPLA employs a representation focused on tensors. It utilizes three primary directives:
tensor: Defines data size and location within the memory hierarchy.stack: Describes spatial mapping—how data is sharded or replicated across parallel hardware units.update: Describes temporal mapping—how data moves over time.
By treating tensors as first-class citizens, the system can rapidly evaluate hardware constraints like buffer capacity and bandwidth, significantly accelerating validity checks.
The KAPLA Solver
The solver employs a "divide and conquer" strategy to navigate the massive search space:
- Inter-layer Pruning: Using dynamic programming and conservative pruning, the solver quickly discards suboptimal ways to partition the network across nodes.
- Bottom-up Intra-layer Solving: For individual layers, the solver starts at the smallest unit (the PE) and works outward. This ensures that every generated schedule is physically valid regarding memory constraints, avoiding the inefficiencies of "guess-and-check" top-down approaches.
Evaluation and Results
KAPLA was evaluated using diverse NN workloads, including CNNs (AlexNet, ResNet, etc.) and RNNs/MLPs, on large-scale hardware templates like a 16,384-PE "Eyeriss-like" architecture.
- Efficiency: KAPLA's schedules resulted in only a 2.2% energy overhead for training and 7.7% for inference compared to exhaustive searches.
- Speed: The framework achieved a 518x speedup in scheduling time compared to
nn-dataflow. For complex models like ResNet, KAPLA finds near-optimal solutions in under two minutes, whereas other tools may take hours or days.
Key Insights
A critical finding is that while inter-layer and intra-layer scheduling are coupled, they can be effectively decoupled for pruning. By estimating the "best-case" cost of a layer, KAPLA can prune 90% of the search space with minimal impact on accuracy. Furthermore, the bottom-up approach ensures "validity by construction," drastically reducing the time wasted on invalid schedules.
Limitations and Future Work
Currently, KAPLA is optimized for dense neural networks and does not yet account for the irregular data patterns of sparse networks. The use of a simplified "roofline" cost model, while enabling speed, may overlook some nuances of interconnect contention. Future work aims to support a broader range of operators and integrate KAPLA into automated Machine Learning as a Service (MLaaS) pipelines.
Summary updated