arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.08247cs.PLcs.AI
收藏

编译器中间表示的大型语言模型翻译

LLM Translation of Compiler Intermediate Representation

Barcelona Supercomputing Center, Universitat Politècnica de Catalunya(巴塞罗那超级计算中心,加泰罗尼亚理工大学);Barcelona Supercomputing Center(巴塞罗那超级计算中心)

Andrea Valenzuela Ramirez, Cristian Gutierrez-Gomez, Marta Barroso, Dario Garcia-Gasulla, Sara Royuela

AI总结:

本文提出IRIS-14B模型,通过训练实现GIMPLE到LLVM IR的翻译,展示了大型语言模型在编译器中间表示转换中的高效性与准确性。

摘要:

GCC和LLVM是现代软件基础设施的基础,依赖于不同的中间表示(IR)来驱动优化和代码生成。然而,这些IR之间的语义和结构差异导致了跨工具链交互的显著障碍,限制了编译器前端、后端和优化管道在不同编程语言和编译生态系统中的重用。传统基于规则的翻译器试图弥合这一差距,但其复杂性和维护成本阻碍了实际应用。在此背景下,大型语言模型(LLMs)作为一种新兴技术,提供了一种数据驱动的替代方案,能够从足够代表性的示例中学习复杂映射,直接在异构编译器IR之间进行学习。为了探索这一方法,本文提出了IRIS-14B,一个经过微调的140亿参数transformer模型,用于将GIMPLE(由GCC生成)转换为LLVM IR(由LLVM生成)。该模型在C源代码中提取配对的IR进行训练,并在GIMPLE到LLVM IR的转换上评估了从真实世界C代码和竞赛编程问题中衍生的IR。据我们所知,IRIS-14B是第一个专门训练用于IR到IR转换的模型。它在准确性上优于广泛使用的模型,包括目前最先进的最大开放模型,参数范围从13到10000亿,最高可达44个百分点。所提出的转换支持将LLM作为互补组件整合到混合神经符号编译器架构中,其中如IRIS-14B这样的模型充当互操作性层,使跨工具链工作流程得以实现,而无需修改现有的编译器过程,同时传统编译器基础设施继续执行确定性的编译和优化。

英文摘要:

GCC and LLVM underpin much of modern software infrastructure, relying on distinct Intermediate Representations (IRs) to drive optimizations and code generation. However, the semantic and structural differences between these IRs create significant barriers for cross-toolchain interaction, limiting the reuse of compiler frontends, backends, and optimization pipelines across programming languages and compilation ecosystems. Traditional rule-based translators have attempted to bridge this gap, but their complexity and maintenance cost have hindered practical adoption. In this context, Large Language Models (LLMs) appear to be an emerging technology that offers a data-driven alternative, capable of learning complex mappings between heterogeneous compiler IRs directly from sufficiently representative examples. To explore this approach, this paper presents IRIS-14B, a 14-billion-parameter transformer model fine-tuned to translate GIMPLE (as emitted by GCC) to LLVM IR (as emitted by LLVM). The model is trained on paired IRs extracted from C sources and evaluated on the GIMPLE-to-LLVM IR transformation applied to IRs derived from real-world C code and competitive programming problems. To the best of our knowledge, IRIS-14B is the first model trained explicitly for IR-to-IR translation. It outperforms the accuracy of widely used models, including the largest state-of-the-art open models available today, ranging from 13 to 1,000 billion parameters, by up to 44 percentage points. The proposed transformation supports the integration of LLMs as complementary components within hybrid neuro-symbolic compiler architectures, where models such as IRIS-14B act as interoperability layers enabling cross-toolchain workflows without modifying existing compiler passes, while traditional compiler infrastructure continues to perform deterministic compilation and optimization.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑