用大模型自动优化RISC-V内核,速度提升1.27倍。
Evolution of Kernels: Automated RISC-V Kernel Optimization with Large Language Models
- 从成熟库的历史中提炼优化思路,指导大模型并行探索。
- 在80个任务中平均提速1.27倍,超越人工专家。
- 适合缺乏参考代码的新兴硬件平台开发者。
自动化内核设计对克服RISC-V等新兴硬件平台的软件生态障碍至关重要。尽管大语言模型(LLMs)在拥有丰富技术文档和成熟代码库的CUDA领域展现出潜力,但在参考材料稀缺的RISC-V领域其有效性尚未验证。本文提出基于大模型的进化程序搜索框架Evolution of Kernels(EoK),通过挖掘并形式化成熟内核库开发历史中的可复用优化思想(通用设计原则+可操作建议),缓解参考稀缺问题;再结合检索增强生成(RAG)引入RISC-V特定上下文,引导并行的LLM探索,优先采用历史上有效的技术。实验表明,EoK在80个评估的内核设计任务中实现1.27倍的中位加速,全面超越人类专家,并比以往基于LLM的自动化内核设计方法提升20%。结果证明将人类经验融入新兴领域是可行的,也凸显了基于大模型的自动化内核优化的巨大潜力。
原文摘要 · Abstract (English)
Automated kernel design is critical for overcoming software ecosystem barriers in emerging hardware platforms like RISC-V. While large language models (LLMs) have shown promise for automated kernel optimization, demonstrating success in CUDA domains with comprehensive technical documents and mature codebases, their effectiveness remains unproven for reference-scarce domains like RISC-V. We present Evolution of Kernels (EoK), a novel LLM-based evolutionary program search framework that automates kernel design for domains with limited reference material. EoK mitigates reference scarcity by mining and formalizing reusable optimization ideas (general design principles + actionable thoughts) from established kernel libraries' development histories; it then guides parallel LLM explorations using these ideas, enriched via Retrieval-Augmented Generation (RAG) with RISC-V-specific context, prioritizing historically effective techniques. Empirically, EoK achieves a median 1.27x speedup, surpassing human experts on all 80 evaluated kernel design tasks and improving upon prior LLM-based automated kernel design methods by 20%. These results underscore the viability of incorporating human experience into emerging domains and highlight the immense potential of LLM-based automated kernel optimization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。