StreamTensor: Make Tensors Stream in Dataflow Accelerators for LLMs

Hanchen Ye, Deming Chen

Abstract

Efficient execution of deep learning workloads on dataflow architectures is crucial for overcoming memory bottlenecks and maximizing performance. While streaming intermediate results between computation kernels can significantly improve efficiency, existing approaches struggle with inter-kernel correlations, external memory access management, and buffer optimization. In this work, we propose StreamTensor, a compiler framework that automatically constructs and optimizes stream-based dataflow accelerators. StreamTensor introduces a novel iterative tensor type system to explicitly encode stream layouts, enabling seamless kernel fusion, buffer allocation, and memory optimization. By systematically exploring three hierarchical design spaces, including tensor tiling, kernel fusion, and resource allocation, StreamTensor balances computational intensity, memory efficiency, and data streaming to maximize performance. Based on FPGA evaluations on Large Language Models (LLM), StreamTensor achieves up to 0.76x and 0.64x lower latency compared to the state-of-the-art FPGA LLM accelerators and GPUs, and up to 1.99x higher energy efficiency compared to GPUs, making it a promising approach for scalable dataflow-based deep learning acceleration.

Introduction

Large Language Models (LLMs) are notoriously memory-bound, particularly during the token-by-token decoding phase. The "memory wall" problem arises because every generated word requires massive data transfers between main memory and the processor. Dataflow architectures, such as FPGAs or specialized AI chips, offer a potential solution by streaming intermediate results directly between computation kernels using on-chip buffers (FIFOs), thereby bypassing off-chip memory bottlenecks.

However, developing these accelerators is complex. Designers must manually manage data tiling, external memory access, and stream synchronization. Existing compilers often fail to address these hardware realities or require extensive manual tuning to avoid system deadlocks. StreamTensor addresses these challenges by providing an end-to-end automated compilation framework.

Methodology

StreamTensor is an MLIR-based compiler that translates PyTorch models into hardware-specific High-Level Synthesis (HLS) code and host runtime. Its architecture is built on two primary pillars: a specialized type system and automated design space exploration.

The itensor Type System

Traditional compilers track tensor shapes and data types but ignore the temporal order of data streaming. StreamTensor introduces the itensor (Iterative Tensor) type system, which explicitly encodes the stream layout, including element shape and iteration space. This allows the compiler to mathematically verify kernel compatibility and automatically generate "layout converters" when stream patterns do not match.

Stream-based kernel fusion and scheduling in StreamTensor.

Hierarchical Design Space Exploration

The framework systematically optimizes hardware through three hierarchical stages:

  1. Linalg Tiling Space: Optimizes computational intensity through tiling, unrolling, and vectorization.
  2. Kernel Fusion Space: Determines optimal kernel connectivity on-chip to minimize external memory access while ensuring the design fits within hardware resource constraints.
  3. Resource Allocation Space: Solves the FIFO sizing problem. By modeling token flow as piecewise linear functions, StreamTensor uses Linear Programming (LP) to calculate exact buffer sizes, preventing deadlocks without wasting on-chip memory.
The StreamTensor compilation pipeline, showing hierarchical design spaces and optimization passes.

Experimental Results

The authors evaluated StreamTensor using popular LLM architectures, including GPT-2, Qwen (0.5B), Llama (1B), and Gemma (1B), deployed on an AMD U55C FPGA. Comparisons were made against state-of-the-art FPGA frameworks (Allo, DFX) and NVIDIA GPUs (A100, 2080Ti).

  • Latency: On GPT-2, StreamTensor achieved 0.76x lower total latency and 0.40x shorter Time-To-First-Token (TTFT) compared to Allo. Against GPUs, it achieved 0.64x the latency of an A100 for decoding, effectively mitigating memory bottlenecks.
  • Energy Efficiency: StreamTensor demonstrated superior power efficiency, reaching up to 1.99x more tokens per Joule than an A100 on the Qwen model.
  • Memory Savings: By automatically inserting layout converters and streaming data on-chip, StreamTensor can fuse entire transformer blocks, reducing intermediate memory usage to approximately 15% of traditional designs.

Discussion and Future Work

A key insight of this work is that encoding stream order directly into the type system is essential for automated dataflow compilation. Furthermore, mathematical modeling of buffer requirements proves more efficient and reliable than traditional simulation-based methods.

Currently, StreamTensor focuses on single-FPGA execution. Future work will expand the framework to support multi-FPGA communication routing and target additional dataflow hardware, such as AMD Versal and specialized AI accelerators like SambaNova and Groq. The authors also plan to integrate support for hand-optimized custom kernels within the automated pipeline.

Summary updated

BibTeX
@misc{ye2025streamtensor,
  author = {Hanchen Ye and Deming Chen},
  title = {{StreamTensor: Make Tensors Stream in Dataflow Accelerators for LLMs}},
  year = {2025},
  eprint = {2509.13694},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.13694},
}
Figure