Manuscript Offprint

arXiv:2610.32279

TranSAGE: Automating Spatial Accelerator Generation for Large-Scale Transformer Models

Chi Zhang, Yi Sun, Weichuang Zhang, Quan Chen, Jieru Zhao

Chi Zhang

Shanghai Jiao Tong University

Shanghai, China

zhang-chi@sjtu.edu.cn

Yi Sun

School of Microelectronics, South

China University of Technology

Guangzhou, China

misunyi@mail.scut.edu.cn

Weichuang Zhang

Shanghai Jiao Tong University

Shanghai, China

1064080006@sjtu.edu.cn

Quan Chen

Shanghai Jiao Tong University

Shanghai, China

chen-quan@cs.sjtu.edu.cn

Abstract

Large-scale Transformers have achieved remarkable success across NLP, computer vision, and robotics, but their growing computational and memory demands challenge efficient inference. Spatial accelerators offer advantages in on-chip bandwidth and energy efficiency, yet designing them for large models remains costly and time-consuming. Existing accelerator generators typically focus on single-operation support, overlooking the benefits of multi-operation pipelining, which limits throughput and energy efficiency.

We propose TranSAGE, a compiler-based framework that jointly optimizes scheduling for large-scale transformers under multi-operation pipelining and generates corresponding accelerator implementations. Our approach integrates a DSE engine with multi-operation dataflow optimization and a dynamic programming-based graph partitioning algorithm to efficiently identify pipeline-friendly operation clusters and their optimal dataflow parameters. We further design spatial architecture primitives and lowering passes to automatically generate efficient RTL implementations.

Evaluations on four representative LLMs demonstrate that TranSAGE achieves up to 2.41×2.41\times higher throughput and 13.04×13.04\times higher energy efficiency over commercial GPU/NPU baselines. Compared with state-of-the-art accelerator generators, TranSAGE achieves up to 11.33×11.33\times higher throughput and 6.07×6.07\times higher energy efficiency. Our code is available at https://github.com/sjtu-zhao-lab/TranSAGE.git.

Keywords: Transformer Accelerators, Spatial Architectures, Accelerator Generation, Compiler Optimization, Dataflow Optimization

1 Introduction

Large-scale transformers, including large language models (LLMs), Diffusion Transformers (DiTs), vision-language models (VLMs), and vision-language-action (VLA) models, have

Jieru Zhao ∗^{*}

Shanghai Jiao Tong University

Shanghai, China

zhao-jieru@sjtu.edu.cn

demonstrated remarkable capabilities across a broad spectrum of applications, such as conversational agents [10, 24, 41, 49], multimedia content generation [17, 18, 38, 42], multimodal understanding [27, 40], and robotics [6, 12]. However, the continued growth in model scale increases the computational and memory demands of these models, making low-latency and energy-efficient inference increasingly challenging. These challenges are further amplified by inference-time scaling techniques, such as Chain-of-Thought (CoT) reasoning [52] and agent-based methods [45, 56].

The challenges have driven the need for architectural innovations. Although GPUs remain the most widely adopted platform for deploying such models, they suffer from limited energy efficiency and suboptimal throughput. Recent research has increasingly focused on spatial accelerators to improve the efficiency of large-scale transformer inference [2, 9, 13, 23, 28, 50]. Unlike conventional architectures that heavily rely on deep memory hierarchies and temporal locality—often leading to bandwidth bottlenecks—spatial accelerators emphasize distributed memory and localized point-to-point communication. This design significantly enhances on-chip bandwidth and aligns well with the computational characteristics of transformer models. In particular, tensor operations in transformers exhibit high spatial data reuse with minimal need for global synchronization, making them especially well-suited for spatial execution paradigms.

However, maximizing the performance of large-scale transformer models on spatial accelerators requires substantial expertise in both hardware and software and is highly time-consuming, thereby hindering their broader adoption. Numerous mapping and compiler frameworks have been proposed to identify optimal mappings of large-scale neural networks onto spatial accelerators [5, 7, 15, 19, 25, 26, 30, 32, 37, 53, 57, 59, 60]. Although these frameworks report promising results, they primarily target predefined architectures with fixed or limited configurability, and thus lack the ability to jointly explore optimizations across both mapping strategies and architectural designs.

∗^{*}Corresponding author

Table 1. Comparison with representative spatial accelerator automation frameworks.

WorkProductivityDataflow SupportArchitecture Support
InputAuto-Tuning SupportAdaptive DataflowInter-Op DataflowPUIntra-PU TopologyInter-PU Topology
AutoSA [51]C Code✓✕SequentialSA2\mathrm{SA}^2 OnlyFixed/
TensorLib [22]STT 1\mathrm{STT}^{\ 1}✕✕SequentialSA2\mathrm{SA}^2 OnlyFixed/
Gemmini [14]C Code✕✕Limited FusionSA2+PPU3\mathrm{SA}^2+\mathrm{PPU}^3FixedFixed
LEGO [29]Relation Matrix✕✓Limited FusionSA2+PPU3\mathrm{SA}^2+\mathrm{PPU}^3ReconfigurableFixed
TranSAGE (Ours)PyTorch Code✓✓Tile-based PipelineReconf. PUReconfigurableFlexible

1^{1} Spatial-Temporal Transformation

2^{2} Systolic Array

3^{3} Post Processing Unit

In contrast, a growing body of automated frameworks has emerged to generate optimized architectures and scheduling strategies for target workloads. We summarize these approaches in Table 1. AutoSA [51] proposes a polyhedral-based framework that automatically transforms C code into optimized HLS implementations for constructing systolic arrays. TensorLib [22] introduces a novel mathematical representation of spatial-temporal transformations (STT), and generates input, output, and interconnect components based on analysis of the STT matrix using Chisel [4] templates. However, they are primarily designed for systolic arrays, which can limit their efficiency on diverse operations in large-scale transformer models.

Gemmini [14] proposes a system-integrated, template-based generator that employs a systolic array as the core matrix processing unit, augmented with post-processing units to support a broader range of operations. LEGO [29] further extends this architecture by introducing adaptive dataflows on systolic arrays to mitigate the low utilization caused by rigid dataflow mappings. Although they target compound workloads, the generated accelerators may still incur high memory access overhead and achieve limited throughput. This limitation primarily arises from their support for only fixed-pattern fusion (e.g., GEMM combined with simple element-wise operations), which restricts their ability to fully exploit cross-operator optimization opportunities—such as operation fusion and pipelining—that have been widely demonstrated to be effective [3, 7, 8, 46, 60, 61].

Main idea. The root cause of the inefficiency in the aforementioned generators is that they treat individual operations as the basic execution unit and generate architecture for supporting them. In contrast, our key idea is to elevate clusters to first-class citizens rather than individual operations. Specifically, we fuse operations that are well-suited for parallel execution into clusters, which are then generated as hardware pipelines. The execution of the entire model is thus decomposed into the sequential execution of multiple clusters. Meanwhile, all clusters share and reuse the same on-chip compute and memory resources.

Challenge. However, such a design is challenging due to two aspects. (1) Difficulty in identifying optimal dataflow: For large-scale transformer models, which typically consist of dozens of operations, determining which operations should be fused into a pipeline cluster is non-trivial. Furthermore, even after fusion, it remains challenging to assign dataflow parameters (e.g., tiling sizes, unrolling factors, and execution ordering) for each operation within a complex pipeline, making it difficult to identify the optimal dataflow. We elaborate on how these factors expand the design space and introduce potential pitfalls in Section 2.3. (2) Difficulty in generating flexible architectures: Even after determining the optimal dataflow for compound operations, generating corresponding hardware architectures remains challenging. It is impractical to implement architectures for every pipeline configuration, whether manually or using template-based methods. Moreover, all clusters must be mapped onto constrained hardware resources while minimizing overhead, further complicating the design.

Our solution. To address these challenges, we propose TranSAGE, an MLIR-based compiler framework that automatically extracts optimal operation clusters with corresponding dataflow parameters for large-scale transformer models, and generates the associated RTL implementations.

We introduce a design space exploration (DSE) engine that formulates multi-operation pipeline scheduling as two subproblems: graph partitioning and dataflow optimization. For graph partitioning, TranSAGE employs a dynamic programming-based method to determine the optimal operation fusion under a given topological order (Sec. 4.1). For each cluster, TranSAGE searches for the optimal dataflow parameters of its operators to form a pipelined cluster, using a decomposition-based approach (Sec. 4.2).

Furthermore, we propose a set of spatial architecture primitives (SAPs) that abstract arithmetic, data storage, and routing components commonly found in spatial accelerators. These primitives serve as a bridge between high-level representations (e.g., MLIR linalg) and RTL implementations. Based on dependency and data-sharing analysis, high-level linalg operations are lowered to SAPs and subsequently mapped to corresponding RTL implementations (Sec. 5).

Our main contributions are summarized as follows:

Figure

(a) Overview of spatial accelerator architecture

(b) Centralized topology

(c) Distributed topology

Figure 1. Spatial accelerator architecture.

  • We propose TranSAGE, an end-to-end framework that automatically generates RTL implementations of spatial accelerators from PyTorch programs.

  • We integrate a DSE engine that automatically extracts optimal operation fusion and dataflow parameters, enabling efficient mapping to hardware pipelines for maximum performance.

  • We propose a set of abstractions for spatial accelerator hardware components, along with corresponding lowering passes, which serve as a bridge between high-level IR and RTL implementations.

Evaluation shows that TranSAGE delivers up to 2.42×2.42\times higher throughput and 13.04×13.04\times greater energy efficiency than commercial GPU/NPU baselines. Against state-of-the-art accelerator generators, TranSAGE further improves throughput by up to 11.33×11.33\times and energy efficiency by up to 6.07×6.07\times.

References (19)