Manuscript Offprint

arXiv:2610.08688

A Framework for Accelerating Transformer Inference on RISC-V for Edge AI

Ajay Kumar M, Vishnu PS, Yike Li, Shreejith Shanker, Dimitrios S. Nikolopoulos, Bo Ji, Hans Vandierendonck, Deepu John

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Ajay Kumar M*, Vishnu PS*, Yike Li*, Shreejith Shanker†

Dimitrios S. Nikolopoulos†, Bo Ji†, Hans Vandierendonck§, Deepu John*

*University College Dublin, Ireland †Trinity College Dublin, Ireland

†Virginia Tech, USA §Queen's University Belfast, UK

Abstract—This work presents a framework for accelerating transformer-based language models (LMs) on resource-constrained IoT devices. The framework targets compact LMs: BERT-Tiny (B-Ty), MobileBERT (M-Bt), MiniLM (M-Lm), Electra (E-Lt) and DeBERTa (D-Bt) — selected for their architectural diversity and use in edge inference scenarios. The proposed flow derives lightweight instruction set extensions tailored to the non-obvious computational patterns of these models. In addition, a custom instruction is introduced to accelerate the address generation stage of batch matrix multiplication, achieving a performance improvement of 15.39–21.74% with modest ASIC overheads of 6.79% in area and 2.33% in power. To further enhance performance without incurring additional processor core hardware cost, an optional compiler-directed loop unrolling strategy is employed, trading increased code size for overall reduced execution time. Evaluation on the Synopsys trv32p3f RISC-V core demonstrates inference speedups of up to 2.19×, and FPGA implementation on the AMD Zynq UltraScale+ ZCU102 shows a 32.94% area overhead at 75 MHz, whereas the ASIC implementation using the TSMC 28 nm library incurs a 21.08% area overhead while operating at 250 MHz.

Index Terms—RISC-V, Language models, TVM, Hardware acceleration, FPGA

I. INTRODUCTION

Deploying deep neural networks (DNNs) on bare-metal IoT platforms remains difficult under tight energy, memory, and compute budgets. Many acceleration frameworks still depend on heavyweight stacks, or lack fine-grained architectural customisation, hindering practical deployment in deeply embedded settings. As modern edge workloads increasingly incorporate transformer-based architectures, particularly in vision[1] and language tasks[2], there is a growing need for model class-specific optimisations targeting these networks. Recent efficient edge Transformers and LMs[3–8] still present distinct computational characteristics. The higher reliance on attention patterns and more extensive use of matrix multiplications introduce new challenges in data movement for existing instruction-level optimizations designed for CNN workloads, which leads to inefficient performance on edge platforms.

Prior work in vision [9], NLP [10–12], and general DNN acceleration [13, 14] shows that pruning, quantization, ISA extensions, and dedicated acceleration units can enable efficient RISC-V deployment. [9] accelerates a pruned ViT via specialized sparse-load instructions. RISC-VTF [10] adds custom matrix and activation ops. VEXP [11] couples ISA extensions with arithmetic blocks for fast, accurate softmax. However, existing works do not address the limited compiler support for the proposed extensions, often requiring users to generate manual assembly implementations to extract performance gains. V-SEEK [12] emphasizes quantization and toolchains, but primarily evaluates throughput/latency, without discussion of power consumption, despite its importance as a key metric in resource-constrained edge devices. [15] further points out that the effectiveness of front-end optimizations like quantization is highly dependent on the underlying architecture, motivating the need for an end-to-end profiling and optimization framework through HW/SW co-design and co-optimization.

In this work, instead of targeting vector extensions on dedicated compute components, we focus on scalar extensions that can execute solely on a standalone RISC-V core. By avoiding the area and power-intensive overhead of vector units, our approach reduces hardware cost, preserves ease of compiler integration and programmability, and enables practical acceleration of LMs under strict edge constraints. The key contributions of this work are as follows:

  1. A framework for model-class-aware RISC-V ISA extension generation targeting compact transformer LMs.

  2. A custom fused instruction accelerating batch matrix multiplication with minimal area/power overhead.

  3. An optional compiler-directed loop-unrolling strategy that improves inference throughput without incurring additional hardware resources.

References (39)