自动生成高效GPU并行代码,显著提升性能且保证正确性
ParaCodex: A Profiling-Guided Autonomous Coding Agent for Reliable Parallel Code Generation and Translation
- 基于热点分析与数据规划,分阶段优化代码生成
- 在31个测试用例中成功生成代码,平均提速3至5倍
- 适合需要高效并行化开发的高性能计算研究人员
并行编程是高性能计算(HPC)和人工智能的核心,但生成既正确又高效的代码仍具挑战性,尤其在OpenMP GPU offload场景中,数据移动和调优占据主导。自主编码代理可编译、测试并分析目标硬件上的代码,但缺乏领域支撑时输出脆弱。我们提出ParaCodex,一个面向HPC工程师的工作流,将基于Codex的代理转化为自主的OpenMP GPU offload系统,通过分阶段热点分析、显式数据规划、正确性门控和基于性能剖析的迭代优化实现。我们在HeCBench、Rodinia和NAS上评估从串行CPU内核到OpenMP GPU offload内核的转换,剔除5个无效内核后,对剩余31个有效内核全部成功生成。生成代码在25/31案例中优于参考OpenMP实现,分别在HeCBench和Rodinia上实现几何均值3倍和5倍加速,且优于零样本Codex基线。此外,在ParEval上评估从CUDA到OpenMP offload的转换,ParaCodex在仅代码输入和端到端设置下均保持高编译率与验证率。
原文摘要 · Abstract (English)
Parallel programming is central to HPC and AI, but producing code that is correct and fast remains challenging, especially for OpenMP GPU offload, where data movement and tuning dominate. Autonomous coding agents can compile, test, and profile on target hardware, but outputs are brittle without domain scaffolding. We present ParaCodex, an HPC-engineer workflow that turns a Codex-based agent into an autonomous OpenMP GPU offload system using staged hotspot analysis, explicit data planning, correctness gating, and profiling-guided refinement. We evaluate translation from serial CPU kernels to OpenMP GPU offload kernels on HeCBench, Rodinia, and NAS. After excluding five kernels, ParaCodex succeeded on all 31 valid kernels. The generated kernels improved GPU time over reference OpenMP implementations in 25/31 cases, achieving geometric-mean speedups of 3x on HeCBench and 5x on Rodinia, and outperforming a zero-shot Codex baseline on all suites. We also evaluate CUDA to OpenMP offload translation on ParEval, where ParaCodex maintains high compilation and validation rates in code-only and end-to-end settings.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。