IntrinTrans: LLM-based Intrinsic Code Translator for RISC-V Vector

📅 2025-10-11
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Manual porting of ARM NEON intrinsics to RISC-V Vector (RVV) is time-consuming, error-prone, and suffers from low coverage and suboptimal performance under existing rule-based translation approaches. To address this, we propose a large language model (LLM)-driven multi-agent translation framework that integrates compiler-testing closed-loop feedback with static register liveness analysis. This enables semantically preserving code translation while optimizing for RVV-specific instructions. Compared to conventional methods, our approach significantly improves translation correctness and target-architecture execution efficiency. Evaluated on 34 open-source algorithmic kernels, the framework generates semantically correct RVV code in the majority of cases; in certain scenarios, it achieves up to 5.93× speedup over state-of-the-art community implementations. These results demonstrate the effectiveness and practicality of LLM-augmented compilation analysis for cross-architecture vectorized code migration.

Technology Category

Application Category

📝 Abstract
The use of intrinsic functions to exploit hardware-specific capabilities is an important approach for optimizing library performance. Many mainstream libraries implement a large number of vectorized algorithms on Arm or x86 SIMD intrinsic functions. With the rapid expansion of the RISC-V hardware-software ecosystem, there is a growing demand for support of the RISC-V Vector (RVV) extension. Translating existing vectorized intrinsic code onto RVV intrinsics is a practical and effective approach. However, current cross-architecture translation largely relies on manual rewriting, which is time-consuming and error-prone. Furthermore, while some rule-based methods can reduce the need for manual intervention, their translation success rate is limited by incomplete rule coverage and syntactic constraints, and the performance suffers from inadequate utilization of RVV-specific features. We present IntrinTrans, a LLM-based multi-agent approach that utilizes compile-and-test feedback to translate intrinsic code across architectures automatically, and further optimizes the generated RVV intrinsics using register-usage information derived from liveness analysis. To evaluate the effectiveness of our approach, we collected 34 vectorized algorithm cases from open-source libraries. Each case includes an Arm Neon intrinsics implementation and a RVV intrinsics implementation contributed by the open-source community, together with correctness and performance tests. Our experiments show that advanced LLMs produce semantically correct RISC-V Vector intrinsics in most cases within a limited number of iterations, and in some cases achieve up to 5.93x the performance of the native implementation from the open-source community.
Problem

Research questions and friction points this paper is trying to address.

Automating translation of SIMD intrinsic code to RISC-V Vector architecture
Overcoming limitations of manual rewriting and rule-based translation methods
Optimizing generated code performance using RISC-V specific features
Innovation

Methods, ideas, or system contributions that make the work stand out.

LLM-based multi-agent approach for code translation
Utilizes compile-and-test feedback for automatic translation
Optimizes RVV intrinsics using register-usage information
🔎 Similar Papers
No similar papers found.
L
Liutong Han
University of Chinese Academy of Sciences, Institute of Software, Chinese Academy of Sciences, Beijing, China
Z
Zhiyuan Tan
University of Chinese Academy of Sciences, Institute of Software, Chinese Academy of Sciences, Beijing, China
Hongbin Zhang
Hongbin Zhang
Institute of Materials Science, TU Darmstadt
DFT and beyondinverse design
P
Pengcheng Wang
ByteDance, Beijing, China
C
Chu Kang
University of Chinese Academy of Sciences, Institute of Software, Chinese Academy of Sciences, Beijing, China
M
Mingjie Xing
Institute of Software, Chinese Academy of Sciences, Beijing, China
Yanjun Wu
Yanjun Wu
Institute of Software, Chinese Academy of Sciences
Computer Science