arXiv:2505.03988cs.DCcs.AI2025-05中稿 · AI4Sys Workshop at…被引 10

大模型能不靠硬件直接预测代码是算力还是带宽瓶颈。

Can Large Language Models Predict Parallel Code Performance?

  • 用大模型把GPU代码分类为算力或带宽瓶颈,基于源码和硬件参数。
  • 有实测数据时准确率100%,无数据时最强模型达64%准确率。
  • 适合无法运行测试的高性能计算场景,尤其缺硬件资源时。

准确评估并行GPU代码性能通常需在目标硬件上进行执行时分析,但高端GPU访问受限使其日益困难。本文探索大语言模型(LLMs)是否可替代硬件依赖,实现性能预测。将问题建模为屋顶模型(Roofline)分类任务:给定GPU内核源码与目标GPU硬件规格,能否预测其为算力瓶颈或带宽瓶颈?我们构建了一个包含340个来自HeCBench基准的CUDA和OpenMP代码的平衡数据集,标签通过实际GPU分析获得。在四种场景下评估:(1)使用内核的分析数据;(2)仅源码的零样本;(3)少量代码-标签对的少样本;(4)在小规模自定义数据集上的微调。结果表明,最先进的LLMs在有明确分析数据时达到100%分类准确率。推理能力强的LLMs在零样本和少样本设置中显著优于普通模型,无需分析数据时最高达64%准确率。最后发现,当前数据量不足以支撑有效微调。本工作是首批通过分类实现源码级屋顶模型性能预测的尝试,展示了其在无法运行分析时引导优化的潜力。未来结合更好数据集与提示策略,有望成为高性能计算性能分析与性能可移植性的实用工具。

原文摘要 · Abstract (English)

Accurate determination of the performance of parallel GPU code typically requires execution-time profiling on target hardware -- an increasingly prohibitive step due to limited access to high-end GPUs. This paper explores whether Large Language Models (LLMs) can offer an alternative approach for GPU performance prediction without relying on hardware. We frame the problem as a roofline classification task: given the source code of a GPU kernel and the hardware specifications of a target GPU, can an LLM predict whether the GPU kernel is compute-bound or bandwidth-bound? For this study, we build a balanced dataset of 340 GPU kernels, obtained from HeCBench benchmark and written in CUDA and OpenMP, along with their ground-truth labels obtained via empirical GPU profiling. We evaluate LLMs across four scenarios: (1) with access to profiling data of the kernel source, (2) zero-shot with source code only, (3) few-shot with code and label pairs, and (4) fine-tuned on a small custom dataset. Our results show that state-of-the-art LLMs have a strong understanding of the Roofline model, achieving 100% classification accuracy when provided with explicit profiling data. We also find that reasoning-capable LLMs significantly outperform standard LLMs in zero- and few-shot settings, achieving up to 64% accuracy on GPU source codes, without profiling information. Lastly, we find that LLM fine-tuning will require much more data than what we currently have available. This work is among the first to use LLMs for source-level roofline performance prediction via classification, and illustrates their potential to guide optimization efforts when runtime profiling is infeasible. Our findings suggest that with better datasets and prompt strategies, LLMs could become practical tools for HPC performance analysis and performance portability.

性能预测大模型并行计算HPC

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。