AI 充当编译器:无需 Triton 编译器即可将 Triton 算子直译为 PTX 代码
AI as a Compiler: Compiling Triton kernels without the Triton compiler
arXiv: 2609.36800 [cs.AI]
Authors: François Costa, Charly Castes, Thomas Bourgeat, Azalia Mirhoseini
Submitted: September 29, 2026
文章背景与核心概要
随着深度学习模型结构与新型 GPU 硬件加速器的快速演进,为新硬件手工构建与维护传统的编译器后端正变得极其昂贵且耗时。本研究提出了创新的 AI 降级直译 (AI lowering) 范式,直接借助大语言模型 (Large Language Model, LLM) 智能体取代繁琐的传统编译器优化与降级流水线,将高级的 Triton 算子端到端直译为底层的 NVIDIA PTX (Parallel Thread Execution) 汇编代码。在跨越 Ada、Hopper 以及最新的 Blackwell 架构 GPU 上对 22 个核心算子的全面实测中,AI 直译算子的性能达到了官方自动调优 (Auto-tuned) Triton 编译器的 0.83 倍至 3.34 倍。这一突破表明,AI 编译器能够有效加速新型计算芯片的基础软件栈落地,并在硬件微架构的极致优化中发挥超越传统编译器的关键作用。
执行摘要
Executive Summary
随着编程模型、计算工作负载以及底层硬件加速器的快速迭代演进,为每一种新芯片开发并维护传统的编译器后端已经变得代价高昂且难以维系。本篇研究论文深入探讨了 AI 降级直译 (AI lowering) ——一种彻底颠覆传统的技术范式:由大语言模型完全取代传统编译器中层层递进的代码优化与底层代码降级流水线。
As programming models, workloads, and hardware accelerators rapidly evolve, building and maintaining conventional compiler backends becomes prohibitively expensive. This research paper investigates "AI lowering"—a novel paradigm where large language models (LLMs) entirely replace the traditional optimizing and lowering pipeline.
具体而言,研究团队构建了一套专用的智能体框架 (Agentic Harness) ,驱动大语言模型智能体将高级的 Triton 算子直接直译为 NVIDIA 底层的 PTX (Parallel Thread Execution) 指令代码,完全绕开了官方的 Triton 编译器。在涵盖 12 个通用核心算子 (在 Ada、Hopper 以及 Blackwell GPU 上完成测试) 以及来自近期前沿机器学习文献的 10 个算子的全面基准评测中,经由 AI 直译生成的算子取得了官方自动调优 (Auto-tuned) Triton 性能的 0.83 倍至 3.34 倍。
Specifically, the authors build an agentic harness utilizing an LLM agent to translate Triton kernels directly into NVIDIA PTX (Parallel Thread Execution) code, bypassing the Triton compiler altogether. Evaluated across twelve common kernels (tested on Ada, Hopper, and Blackwell GPUs) and ten kernels from recent machine learning literature, the AI-lowered kernels achieved 0.83x to 3.34x the performance of autotuned Triton.
核心发现与性能亮点
Key Findings & Performance Highlights
AI 降级直译之所以能实现显著的性能加速,核心在于它能够自主发掘并应用一系列传统编译器流水线往往会遗漏的高级深度优化策略:
The performance gains achieved through AI lowering stem from advanced optimizations that standard compiler pipelines typically miss:
- BitDelta (实现 3.34 倍加速) : 直接将紧密打包的二进制权重在线解码为 Tensor Core 的计算操作数;
- FlashAttention (实现 1.37 倍加速) : 在 Tensor 内存中为每个线程分配一整行完整的 Softmax 数据;
- 卷积窗口 (Convolution Windows,实现高达 2.23 倍加速) : 高效复用相互重叠的卷积窗口,大幅削减冗余访存开销。
- BitDelta (3.34x speedup): Decoding packed binary weights directly into Tensor Core operands.
- FlashAttention (1.37x speedup): Assigning each thread a complete softmax row in tensor memory.
- Convolution Windows (up to 2.23x speedup): Reusing overlapping convolution windows efficiently.
正确性验证与新一代 GPU 架构支持
Verification & Modern GPU Architecture Support
为了从根本上确保生成代码的正确性,研究团队构建了一套稳健的评估测试套件,集成了端到端的全方位验证能力。他们扩展了现有的 PTX 静态验证工具 Volta (一款已有的 PTX 验证器) 以支持现代 GPU 架构,并专门针对 Blackwell 架构中的 tcgen05 Tensor Core 硬件接口引入了针对性建模支持。
To ensure correctness, the authors built a robust evaluation harness featuring comprehensive verification support. They expanded Volta (an existing PTX verifier) to support modern GPU architectures, introducing specific capabilities for the Blackwell
tcgen05Tensor Core interface.
这需要在验证工具中精确模拟并建模三项极其复杂的现代硬件微架构特性:
This required modeling three intricate architectural features:
- 统一托管的 Tensor 内存 (Managed Tensor Memory);
- 基于描述符的操作数内存布局 (Descriptor-based Operand Layouts);
- 由提交 (Commits)、等待 (Waits)、内存屏障 (Memory Barriers) 以及代理栅栏 (Proxy Fences) 严密协同的硬件级异步执行流。
- Managed tensor memory
- Descriptor-based operand layouts
- Asynchronous execution coordinated through commits, waits, memory barriers, and proxy fences
总结与未来展望
Conclusion & Future Outlook
上述研究成果清晰地预示着一个全新技术范式的到来:AI 编译器正在逐步取代人工专门编写的中间表示 (Intermediate Representation, IR) 以及静态检查器。通过这种端到端直译的方式,开发者能够大幅减少为新型通用 GPU 以及定制专用硬件加速器构建全套底层软件栈所需的时间与工程精力。
These results point toward an emerging paradigm where AI compilers replace custom-written intermediate representations (IRs) and static checkers. By doing so, they drastically reduce the time and engineering effort required to bring up software stacks for new general-purpose and custom hardware accelerators.
