用大模型优化GPU核函数,无需完整编译,实现高效低耗调优。
GPU Kernel Optimization Beyond Full Builds: An LLM Framework with Minimal Executable Programs
- 从热点核函数中自动生成可执行程序,脱离全应用环境迭代优化。
- 在NVIDIA和华光DCU上平均提速5.05倍至7.77倍,超越直接大模型优化。
- 支持跨平台移植,适合大规模高性能计算中的核函数调优场景。
在高性能计算中,热点GPU核函数是主要性能瓶颈,而专家手动调优成本高且难以移植。现有大语言模型方法通常假设核函数可廉价编译执行,但在大型应用中全量构建与运行代价高昂。本文提出端到端的LLM框架,通过性能反馈机制,在不构建完整应用的前提下优化核函数。从独立提取的热点核函数出发,自动补全为最小可执行程序(MEP),并在外部进行多轮迭代优化与评估。框架融合自动错误修复与性能模式继承,可修复缺陷、保持正确性,并复用有效的分块/内存/同步策略,降低搜索开销。优化后版本重新集成至原应用验证。在NVIDIA GPU与华光深算单元(AMD授权架构)平台上,基于PolyBench、AMD APP SDK及超算应用中的热点核函数进行测试。该方法在NVIDIA上获得5.05倍平均加速,在DCU上达7.77倍,AMD APP SDK上1.77倍,三组热点核函数平均提升1.25倍,优于直接使用大模型优化。该方法无需全源码依赖,具备跨平台可移植性,实现实用且低成本的GPU核函数优化。
原文摘要 · Abstract (English)
In high-performance computing, hotspot GPU kernels are primary bottlenecks, and expert manual tuning is costly and hard to port. Large language model methods often assume kernels can be compiled and executed cheaply, which fails in large applications where full builds and runs are expensive. We present an end-to-end LLM framework with performance feedback that optimizes kernels without building the full application. From independently extracted hotspot kernels, it automatically completes code into a Minimal Executable Program (MEP), then performs multi-round iterative optimization and evaluation outside the full application. The framework integrates Automatic Error Repair and Performance Pattern Inheritance to fix faults, preserve correctness, reuse effective tiling/memory/synchronization strategies, and reduce search cost. Optimized variants are reintegrated into the original application for validation. We evaluate on NVIDIA GPUs and the Haiguang Deep Computing Unit (DCU) platform (AMD-licensed architecture) using PolyBench, the AMD APP SDK, and hotspot kernels from large-scale supercomputing applications. The method achieves average speedups of 5.05x (PolyBench on NVIDIA), 7.77x (PolyBench on DCU), 1.77x (AMD APP SDK), and 1.25x on three hotspot kernels, surpassing direct LLM optimization. The approach requires no full-source dependencies, offers cross-platform portability, and enables practical, low-cost GPU kernel optimization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。