Introduction: Overcoming the Memory Wall
Modern Deep Neural Networks (DNNs) are increasingly constrained by the "memory wall"—the energy and latency overhead associated with moving data between on-chip buffers and off-chip DRAM. While hardware accelerators like TPUs and GPUs provide massive computational throughput, standard layer-by-layer execution requires writing intermediate results to DRAM after every layer. This constant data movement is highly energy-intensive and limits overall system performance.
Layer fusion (inter-layer mapping) mitigates this by processing micro-batches of data across multiple layers simultaneously, keeping intermediate activations on-chip. However, determining the optimal fusion strategy—specifically the micro-batch size for each layer—is a complex combinatorial problem. For a network like ResNet50, the search space reaches approximately $10^{90}$ configurations. Existing search-based mappers, such as those using Genetic Algorithms or Reinforcement Learning, are computationally expensive and often take hours to find a solution for a single hardware configuration.
Methodology: Mapping as Sequence Modeling
DNNFuser redefines the mapping problem as a sequence-modeling task. Instead of iteratively searching for a solution, the model performs "one-shot" inference to generate a fusion strategy.
Transformer-Based Architecture
The authors utilize a Transformer architecture, leveraging its self-attention mechanism to capture long-range dependencies between layers. This is crucial because a memory allocation decision in an early layer directly impacts the available buffer space for subsequent layers. By treating the sequence of micro-batch sizes as a trajectory, the Transformer can optimize for global memory efficiency.
Imitation Learning and Conditional Rewards
To avoid the instability of standard Reinforcement Learning, DNNFuser is trained using imitation learning. A "Teacher Model" (G-Sampler), which uses an optimized search algorithm, generates high-quality mapping trajectories. DNNFuser learns to replicate these efficient patterns. Furthermore, the model is conditioned on hardware constraints (e.g., buffer size), allowing it to adapt its strategy to different hardware environments in a single inference pass without retraining.
Experimental Evaluation
The researchers evaluated DNNFuser across various industry-standard workloads, including VGG16, ResNet18/50, MobileNet-V2, and Mnasnet. The target hardware was a spatial accelerator featuring 1024 Processing Elements (PEs) and on-chip buffers ranging from 16MB to 64MB.
Key Results
- Search Efficiency: DNNFuser generates mapping strategies in approximately 0.01 minutes, representing a 66x–127x speedup over state-of-the-art search-based mappers.
- Performance and Latency: The strategies produced by DNNFuser achieve up to a 3.13x speedup in DNN execution latency compared to non-fused baselines, matching or exceeding the performance of exhaustive search methods.
- Generalization: The model demonstrates robust zero-shot generalization to unseen hardware constraints and can be quickly fine-tuned for entirely new DNN architectures, reaching optimal performance 10x faster than training from scratch.
Conclusion and Future Directions
DNNFuser demonstrates that generative models can effectively replace slow, iterative search processes in hardware mapping. By treating layer fusion as a sequence generation task, it provides a scalable and fast solution to the memory wall.
Future work includes developing a "unified" mapper that simultaneously optimizes both inter-layer (fusion) and intra-layer (dataflow) mapping. Additionally, improving the model's ability to extrapolate to hardware constraints significantly outside its training range remains an open challenge.
Summary updated