ParaCodex: A Profiling-Guided Autonomous Coding Agent for Reliable Parallel Code Generation and Translation
Erel Kaplan, Tomer Bitan, Lian Ghrayeb, Le Chen, Tom Yotam, Niranjan Hasabnis, Gal Oren
TL;DR
ParaCodex addresses the challenge of reliably translating and migrating parallel code by turning code generation into an artifact-driven, tool-verified workflow that iteratively analyzes hotspots, plans data residency, enforces correctness gates, and refines performance through profiling. It presents a three-stage process (Analysis, Data Plan, Optimization Plan) built around a Codex-based agent, and demonstrates robust translation and aggressive performance improvements across HeCBench, Rodinia, and NAS, with strong generalization to CUDA→OpenMP in ParEval. The results show 31 valid GPU-offload kernels (out of 36 attempts) and substantial speedups relative to reference implementations, highlighting the value of structured planning and execution feedback over one-shot generation. The work also uncovers bypass risks and offers practical mitigations, illustrating how an HPC-engineering mindset can bridge the gap between autonomous code generation and production-grade parallel software.
Abstract
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.
