Source-linked AI summary
TranSAGE: Automating Spatial Accelerator Generation for Large-Scale Transformer Models
Chi Zhang, Yi Sun, Weichuang Zhang, Quan Chen, Jieru Zhao
TL;DR
Large-scale Transformer inference faces growing compute and memory demands, while existing spatial accelerator generators often lack efficient support for multi-operation dataflows. TranSAGE optimizes operation clustering and dataflows and generates RTL implementations. It reports throughput and energy-efficiency gains over commercial GPU/NPU baselines and state-of-the-art accelerator generators.
Problem
Large-scale Transformer inference is challenged by growing computational and memory demands, and existing spatial accelerator generators often lack efficient multi-operation dataflows for diverse operation compositions.
Source: §1 · p. 1, §2.3 · p. 4Method
TranSAGE treats operation clusters as pipeline execution units, optimizes their fusion and dataflows, and generates corresponding RTL implementations.
Source: §1 · p. 2, §4.2 · p. 6, §4.2.1 · p. 6Results
TranSAGE improves throughput and energy efficiency over GPUs, NPUs, and prior accelerator generators for both prefill and decoding; it reports up to 2.42× higher throughput and 13.04× greater energy efficiency than commercial GPU/NPU baselines.
Source: §1 · p. 3, §8 · p. 14Takeaways & Limitations
Treating operation clusters as execution units supports efficient pipelining and improves throughput and energy efficiency across prefill and decoding.
Source: §8 · p. 14Generated compute, storage, and interconnect resources are fixed, and the DSE targets single-chip architectures without exploring other inter-chip parallelism strategies.
Source: §7.2 · p. 14
Abstract
from arXiv · showhide
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 design space exploration (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.41x higher throughput and 13.04x higher energy efficiency than commercial GPU/NPU baselines. Compared with state-of-the-art accelerator generators, TranSAGE achieves up to 11.33x higher throughput and 6.07x higher energy efficiency. Our code is available at https://github.com/sjtu-zhao-lab/TranSAGE.
1 Introduction
Growing Transformer inference demands make low-latency, energy-efficient deployment challenging, while spatial-accelerator design requires substantial hardware and software expertise. TranSAGE jointly explores operation clusters and dataflows and generates RTL, reporting throughput and energy-efficiency gains over commercial and generated accelerator baselines.
1 Introduction
- Large-scale Transformer inference faces rising computational and memory demands, while optimizing spatial accelerators requires substantial hardware and software expertise.The introduction also notes that inference-time scaling techniques amplify these challenges.Source: §1 · p. 1
- Existing mapping frameworks largely target predefined, fixed or limited-configurability architectures rather than jointly exploring mapping strategies and architectural designs.Earlier generators also target systolic arrays or fixed fusion patterns, limiting opportunities for cross-operator optimization.Source: §1 · pp. 1–2
- TranSAGE elevates operation clusters to execution units, fusing parallel-suited operations into hardware pipelines that execute sequentially across clusters.Clusters share and reuse on-chip compute and memory resources.Source: §1 · p. 2
- Its DSE engine uses dynamic programming for fusion under a topological order and decomposed optimization to select each cluster’s dataflow parameters.Spatial architecture primitives and lowering passes bridge high-level operations to RTL implementations.Source: §1 · p. 2
- Up to 2.42× higher throughput and 13.04× greater energy efficiency than commercial GPU/NPU baselines; against state-of-the-art accelerator generators, up to 11.33× higher throughput and 6.07× higher energy efficiency.These are the reported evaluation results for TranSAGE.Source: §1 · p. 3
2 Background and Motivation
Spatial accelerators combine distributed compute and memory with asynchronous communication, while dataflow describes how operations map and execute across these resources. Multi-operation pipelines can reduce external-memory access and improve utilization, but fusion, dataflow search, and hardware generation each present design challenges.
2.1 Spatial Accelerators
- Spatial-accelerator design considers PE-array organization and PU interconnect, including centralized global SRAM or specialized topologies with restricted connectivity.The stated scope focuses on a single compute core with on-chip resources and hierarchical memory.Source: §2.1 · p. 3
2.2 Dataflow and Representation
- Dataflow specifies tensor operations’ temporal and spatial mapping, data movement across hierarchy levels, and parallel or sequential execution.Inter-operation representations capture transfers and scheduling across operations, including pipelined execution.Source: §2.2 · pp. 3–4
2.3 Issues and Motivation
- Existing generators often lack efficient multi-operation dataflows, instead supporting single operations or fixed fusion patterns that can leave operations sequential and increase PE underutilization and memory access.Grouping operations into pipelined clusters is proposed to improve throughput and reduce external-memory accesses.Source: §2.3 · p. 4
- Insufficient or excessive fusion can both hurt performance: pipelined operations may compete for compute and SRAM resources, reducing PE utilization and data reuse.The relative merits of fusion depend on workload; decoding may favor fusing memory-bound operations when prefill does not.Source: §2.3 · p. 4
- Dataflow optimization remains difficult because per-operation tiling, unrolling, and loop-order choices combine into an exponentially large search space.For a six-operation cluster in a sequence-length-1024 attention layer, the search space can reach 10^21 configurations.Source: §2.3 · pp. 4–5
- Diverse cluster topologies and varying PE and SRAM allocations complicate RTL generation and mapping clusters onto one architecture with shared resources.Source: §2.3 · p. 5
3 Framework Overview
TranSAGE takes PyTorch code through multi-operation pipeline scheduling and backend lowering to produce accelerator RTL. At runtime, a dispatch table selects binaries by input shape range.
3 Framework Overview
- TranSAGE takes PyTorch code, schedules operation clusters with optimized dataflows, and generates RTL for hardware implementation.Its two-stage workflow uses a generation stage followed by an inference stage.Source: §3 · p. 5
- The generation frontend canonicalizes Linalg IR, fuses memory-oriented operations, and uses DSE to select operation fusion and dataflow parameters.Backend lowering constructs a primitive graph that maps supported clusters onto shared hardware and generates binary and RTL code.Source: §3 · p. 5
- At inference, a host runtime selects a binary for each request using the input shape range associated with that binary.The runtime fills in loop bounds and memory addresses; shapes within the range are supported without architectural modification.Source: §3 · p. 5
4 Multi-Operation Pipeline Scheduling
TranSAGE jointly optimizes operation fusion and cluster dataflow to minimize energy-delay product. It uses dynamic programming for graph partitioning and decomposes intra-cluster dataflow search into coupled L2 and more independent L1 parameters.
4 Multi-Operation Pipeline Scheduling
- The scheduling problem jointly chooses operation clusters and each cluster’s tiling, unrolling, and loop-order parameters to optimize energy delay product (EDP).The graph partitioning stage searches fusion schemes, while dataflow optimization selects parameters within each cluster.Source: §4 · p. 5
4.1 Operation Fusion
- Dynamic programming evaluates connected clusters over topologically ordered operations and selects partitions minimizing overall EDP.It stores optimal EDP and cut points, then backtracks to reconstruct the partition and attach each cluster’s dataflow parameters.Source: §4.1 · pp. 5–6
4.2 Intra-Cluster Dataflow Optimization
- TranSAGE decomposes dataflow search by enumerating coupled L2 tiling and outer-order parameters before solving for L1 unroll factors and inner orders.The L1 parameters are optimized per operation under shared resource constraints; the solver formulation can be handled by linear programming tools such as GLPK.Source: §4.2 · p. 6, §4.2.2 · p. 8
- A dimension-relation network propagates tiling sizes across dependent operation dimensions, reducing enumeration to representative base dimensions.Equal, collapse, and constant relations capture producer-consumer dependencies, reshapes, and concat or slice constraints; collapse tiling also follows low-to-high dimension allocation for contiguous access.Source: §4.2.1 · pp. 6–7
- Valid outer orders require reuse distance one for directly forwarded tiles and matching producer-consumer access order.Tiling can change whether output accesses are consecutive, so valid outer-order vectors are generated for each tiling candidate.Source: §4.2.1 · p. 7
- An equivalence-based ordering cache reuses candidate outer-loop orders for tiling configurations sharing a dimension mask.The mask records whether each dimension is fully tiled; configurations in the same class have identical candidate order sets, avoiding repeated DFS enumeration.Source: §4.2.1 · p. 8
- Unrolling is limited to at most two dimensions to match the 2D PE array, prioritizing dimensions that preserve contiguous operand accesses.Selected unroll dimensions are placed at outer L1 loop levels to maximize data reuse across iterations.Source: §4.2.2 · p. 8
5 Hardware Generation
TranSAGE represents accelerator components as spatial architecture primitives and constructs a reconfigurable graph to support scheduled clusters. It then generates binary configuration and RTL from that graph.
5.1 Spatial Architecture Primitives
- Spatial architecture primitives model an accelerator as a directed cyclic graph whose nodes are storage, computation, or routing components and whose edges represent dataflow dependencies.The primitive classes include DataPath connections, FIFO- and SRAM-based storage, routing operations, and arithmetic components.Source: §5.1 · p. 9
5.2 SAP Graph Construction
- The backend constructs a shared SAP graph for scheduled clusters through resource allocation, datapath construction, and datapath reorganization.Resources are assigned using unrolling factors and tiling sizes; reorganization removes redundant primitives and inserts configurable Muxes to select among dataflow sources at runtime.Source: §5.2 · pp. 9–10
- Datapath construction routes data between SRAM, DataNodes, arithmetic primitives, and output SRAM to implement each operation’s dependencies.Routing handles incompatible storage and DataNode shapes, while arithmetic primitives are connected according to dependencies in the Linalg body.Source: §5.2 · pp. 9–10
5.3 Binary and RTL Code Generation
- TranSAGE generates a binary per cluster and RTL by replacing each SAP graph primitive with its RTL template or hardware macro.Binaries encode tiling, unrolling, loop orders, and Mux controls; runtime fields supply loop bounds and memory addresses.Source: §5.3 · p. 10
6 Evaluation
TranSAGE is evaluated against commercial devices and accelerator generators, with ablations examining search cost, pipelining, and reconfiguration overhead. Across these comparisons, the results show throughput and energy-efficiency gains, while cluster-size benefits eventually saturate.
6.1 Experimental Setup
- The evaluation uses five representative LLM workloads and compares TranSAGE with Orin NX, A100, Ascend 910B3, Gemmini, and LEGO.TranSAGE configurations run at 1 GHz using a 45 nm technology model, with energy estimates scaled to 8 nm for Orin NX and 7 nm for A100 and Ascend 910B3.Source: §6.1 · p. 10
6.2 Comparison with GPU and NPU
- For the memory-bound decode workload, TranSAGE achieves average throughput improvements of 2.41×, 1.62×, and 2.12× over the Orin NX, A100, and Ascend 910B3, respectively, demonstrating benefits of operation fusion.Figure 8 compares throughput and energy efficiency across GPUs and commercial accelerators.Source: §6.2 · p. 11, Figure 8 · p. 11
6.3 Comparison with SOTA Accelerator Generators
- For prefill, average throughput improves 1.58× over GEMMINI-OS, 2.22× over GEMMINI-WS, and 1.82× over LEGO under the edge configuration.Under the server configuration, improvements are 4.14×, 3.28×, and 5.50× over the same baselines; Figure 9 compares throughput and energy efficiency.Source: §6.3 · p. 11, Figure 9 · p. 12
- 11.33× higher decode throughput than GEMMINI-OS under the server configuration; decode energy-efficiency improvement reaches 6.07× over the baselines.The generator comparison also reports up to 96.15% prefill utilization under the edge configuration, but only 3.16% decode utilization there because of limited memory bandwidth.Source: §6.3 · pp. 11–12, Figure 9 · p. 12
6.4 Ablation Study
- Full-search execution time grows exponentially with maximum cluster size and becomes impractical above size 4, whereas TranSAGE’s search time grows almost linearly and finishes within tens of minutes at size 6.Figure 10 presents the maximum-cluster-size and reconfiguration-area ablation.Source: §6.4 · p. 12, Figure 10 · p. 12
- Increasing maximum cluster size rapidly lowers EDP before gains saturate as operations compete for shared PE and SRAM resources; reconfiguration area overhead remains at most 0.11%.The reported contention reduces utilization and data reuse; multiplexers and the limited number of distinct dataflow configurations keep reconfiguration overhead low.Source: §6.4 · pp. 12–13, Figure 10 · p. 12
7 Discussion
The discussion shows that fused clusters vary with workload and available resources, and that useful fusion depends on balanced resource demands. It also identifies fixed generated resources and limited multi-chip exploration as TranSAGE’s limitations.
7.1 Analysis of Fused Clusters
- Fusion patterns vary with workload and resources: edge and long-sequence configurations generally produce more clusters than server and short-sequence configurations.Operations such as Softmax, RoPE, and Gate projection may be split across clusters or fused across conventional stage boundaries.Source: §7.1 · p. 13
- Fusing data-dependent operations that use complementary compute resources can reduce memory accesses and improve utilization, as in Softmax and RoPE elementwise pipelines.Fusion is beneficial for resource-competing operations only when they form a balanced pipeline: Q and K/V projections split during prefill, while gate and up projections fuse under server-prefill configurations because their output shapes and computational demands are balanced.Source: §7.1 · pp. 13–14
7.2 Limitations and Future Directions
- Generated physical compute, storage, and interconnect resources are fixed, so evolving model structures may require hardware regeneration; multi-chip DSE does not explore communication-aware parallelism beyond data parallelism.The authors identify greater generated-architecture flexibility and communication-aware multi-chip DSE as future work.Source: §7.2 · p. 14
8 Conclusion
TranSAGE treats operation clusters as execution units for spatial accelerators, enabling pipelining and improving throughput and energy efficiency over GPUs, NPUs, and prior accelerator generators across prefill and decoding.
- TranSAGE treats operation clusters as execution units to enable efficient pipelining and improve throughput and energy efficiency over GPUs, NPUs, and prior accelerator generators for prefill and decoding.Source: §8 · p. 14
A Spatial Architecture Primitives
The appendix lists spatial architecture primitives for connections, storage, routing, reductions, data composition, and floating-point operations.
- Spatial architecture primitives include point-to-point links, FIFO and SRAM storage, routing and broadcast, reductions, composition and decomposition, and floating-point arithmetic operations.Source: A Spatial Architecture Primitives · p. 15
B System Configurations
The configurations match Edge with Orin NX and Server with A100/Ascend 910B3. All configurations run at 1 GHz, with device-matched PE organizations capped by target-device peak throughput.
B System Configurations
- Edge uses Orin NX, while Server uses A100/Ascend 910B3.Source: B System Configurations · p. 15
- All configurations operate at 1 GHz, and device-matched setups use the largest valid PE organization whose peak throughput does not exceed the target device.Each PE issues one operation per cycle; one multiplication and one addition count as two floating-point operations.Source: B System Configurations · p. 15
C LLaMA3-8B Results
The LLaMA3-8B results are organized by edge and server settings and report throughput and energy efficiency. The artifact supports inspection of compilation outputs, modeled metrics, and installation options.
C LLaMA3-8B Results
- The LLaMA3-8B results distinguish Edge (batch 1) and Server (batch 8), with prefill and decode reported as throughput and energy-efficiency metrics.TP denotes throughput in GFLOP/s; EE denotes energy efficiency in GFLOP/J.Source: C LLaMA3-8B Results · p. 15
D.1 Abstract
- The artifact workflow starts from PyTorch code and generates Linalg MLIR, schedules kernels, and lowers computation to an SAP graph for performance modeling.It also provides intermediate MLIR and metrics including latency, energy, FLOPs, throughput, and energy efficiency.Source: §D.1 · p. 16
D.2 Artifact Checklist
- The artifact exposes generated and optimized Linalg MLIR, scheduled clusters with dataflow parameters, an SAP graph, and a modeled performance report.Source: §D.2 · p. 16
D.3 Availability and Installation
- The artifact is archived on Zenodo, with a matching GitHub release, and offers prebuilt-Docker and local-Dockerfile installation methods.The repository clone command uses the ae branch.Source: §D.3 · p. 16
D.4 Experimental Workflow
The experimental workflow runs five dependent stages, which can be executed separately to inspect and reuse intermediate outputs. Rapid mode evaluates a block 0 FFN workload in Llama3-8B, while full mode runs the complete suite.
D.4 Experimental Workflow
- The workflow has five dependent stages whose intermediate outputs can be inspected and reused; rapid mode evaluates a block 0 FFN workload, while full mode runs the complete suite.Full evaluation can take substantially longer, particularly during kernel scheduling.Source: §D.4 · p. 16
- Stage 1 generates MLIR for selected model, action, block, layer, batch-size, and sequence-length combinations, then writes the files to mlir/.Source: §D.4 · p. 16
- Stage 2 applies mixed-precision resolution, operation generalization, generic marking, dead-operation elimination, fusion, and tensor-operation folding, writing optimized MLIR to generic/.Source: §D.4 · p. 16
- Stage 3 searches tiling, loop, unrolling, and cluster choices for the selected edge or server configuration, with at most six operations per cluster by default.Scheduled MLIR files are written to scheduled/.Source: §D.4 · p. 16
- Stage 4 lowers scheduled workloads to the hardware-facing DAP dialect and constructs a SAP graph with SRAM, data-path, arithmetic, and routing operations.The resulting MLIR files are written to dap/.Source: §D.4 · pp. 16–17
- Stage 5 estimates latency, energy, and FLOPs, emitting annotated MLIR and a performance log containing workload headers and metric records.Source: §D.4 · p. 17
Related papers
This paper cites
- Attention Is All You Need2017
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2018
- Learning Transferable Visual Models From Natural Language Supervision2021
- Scaling Laws for Neural Language Models2020
- BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models2023
- Video Diffusion Models2022