OpenACC lowers the barrier to GPU offloading, but writing high-performing pragma remains complex, requiring deep domain expertise in memory hierarchies, data movement, and parallelization strategies. Large Language Models (LLMs) present a promising potential solution for automated parallel code generation, but naive prompting often results in syntactically incorrect directives, uncompilable code, or performance that fails to exceed CPU baselines. We present a systematic prompt optimization approach to enhance OpenACC pragma generation without the prohibitive computational costs associated with model post-training. Leveraging the GEPA (GEnetic-PAreto) framework, we iteratively evolve prompts through a reflective feedback loop. This process utilizes crossover and mutation of instructions, guided by expert-curated gold examples and structured feedback based on clause- and clause parameter-level mismatches between the gold and predicted pragma. In our evaluation on the PolyBench suite, we observe an increase in compilation success rates for programs annotated with OpenACC pragma generated using the optimized prompts compared to those annotated using the simpler initial prompt, particularly for the "nano"-scale models. Specifically, with optimized prompts, the compilation success rate for GPT-4.1 Nano surged from 66.7% to 93.3%, and for GPT-5 Nano improved from 86.7% to 100%, matching or surpassing the capabilities of their significantly larger, more expensive versions. Beyond compilation, the optimized prompts resulted in a 21% increase in the number of programs that achieve functional GPU speedups over CPU baselines. These results demonstrate that prompt optimization effectively unlocks the potential of smaller, cheaper LLMs in writing stable and effective GPU-offloading directives, establishing a cost-effective pathway to automated directive-based parallelization in HPC workflows.


翻译:OpenACC降低了GPU卸载的门槛,但编写高性能的pragma仍然复杂,需要深厚的内存层次结构、数据移动和并行化策略领域专业知识。大型语言模型为自动化并行代码生成提供了一个有前景的潜在解决方案,但简单的提示通常会导致语法错误的指令、无法编译的代码或性能无法超越CPU基线。我们提出了一种系统化的提示优化方法,以增强OpenACC pragma的生成,同时避免了与模型后训练相关的过高计算成本。利用GEPA框架,我们通过一个反思性反馈循环迭代地进化提示。该过程利用指令的交叉和变异,并以专家策划的黄金示例以及基于黄金pragma与预测pragma之间子句级和子句参数级不匹配的结构化反馈为指导。在PolyBench套件的评估中,我们观察到,与使用较简单的初始提示生成的OpenACC pragma注释的程序相比,使用优化提示生成的pragma注释的程序编译成功率有所提高,特别是对于"纳米"级模型。具体而言,使用优化提示后,GPT-4.1 Nano的编译成功率从66.7%飙升至93.3%,GPT-5 Nano则从86.7%提升至100%,达到或超越了其规模显著更大、成本更高的版本的能力。除了编译之外,优化提示使得在功能上实现GPU加速超过CPU基线的程序数量增加了21%。这些结果表明,提示优化有效地释放了更小、更便宜的大型语言模型在编写稳定有效的GPU卸载指令方面的潜力,为HPC工作流中基于指令的自动化并行化建立了一条经济高效的路径。

0
下载
关闭预览

相关内容

大语言模型与小语言模型协同机制综述
专知会员服务
38+阅读 · 2025年5月15日
【NeurIPS2024】IPO: 面向视觉-语言模型的可解释提示优化
专知会员服务
22+阅读 · 2024年10月23日
大模型报告:模型能力决定下限,场景适配度决定上限
专知会员服务
57+阅读 · 2024年6月3日
使用 OpenLLM 构建和部署大模型应用
专知会员服务
55+阅读 · 2024年1月4日
100+前沿“拿来即用”开源深度学习模型汇总分享
深度学习与NLP
11+阅读 · 2019年8月29日
荐书丨OpenCV算法精解:基于Python与C++
程序人生
18+阅读 · 2017年11月18日
资源 | 清华大学开源OpenKE:知识表示学习平台
机器之心
10+阅读 · 2017年11月4日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员