Table of Contents
Fetching ...

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.

ParaCodex: A Profiling-Guided Autonomous Coding Agent for Reliable Parallel Code Generation and Translation

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.
Paper Structure (86 sections, 8 figures, 2 tables)

This paper contains 86 sections, 8 figures, 2 tables.

Figures (8)

  • Figure 1: ParaCodex: An autonomous LLM agent that parallelizes and migrates code. The core idea is to turn generation into an artifact-driven, tool-verified agentic workflow: the agent first extracts bottlenecks and a data-mapping plan, then proposes patch-level OpenMP target edits, and finally uses compiler/tests as a hard correctness gate and profiler traces as a performance signal. By separating what to move (data planning) from what to offload (kernel translation) and closing the loop with measurement, ParaCodex reduces brittle one-shot outputs and makes iterations reproducible via structured plans, logs, and profiles.
  • Figure 2: CUDA$\rightarrow$OpenMP translation quality on ParEval across scoring regimes. Compilation (blue) and validation (green) success rates are shown for both the baseline Codex model and ParaCodex under the ParEval protocol. Kernels are scored under (i) a fixed build environment (code-only) and (ii) a setting where the system must also construct the build flow (overall). The heatmap layout mirrors the original ParEval presentation. Both models perform strongly; ParaCodex matches or slightly exceeds the baseline, indicating that the agentic workflow generalizes to cross-API translation.
  • Figure 3: GPU-time performance of ParaCodex and baseline Codex on HeCBench. GPU time (log scale; lower is better) relative to the HeCBench references. Each kernel reports baseline Codex and ParaCodex performance; missing baseline bars indicate failures to produce a correct/compilable implementation. Both systems generally outperform the references, while ParaCodex achieves higher geometric-mean and median gains across the suite.
  • Figure 4: Performance of ParaCodex and baseline Codex on Rodinia and NAS reference implementations. GPU time over the Rodinia (ms, log scale) (Left) and NAS (s, log scale) (Right) reference codes. Rodinia includes practical OpenMP programs that are not always fully optimized, while NAS contains highly tuned scientific kernels that serve as a stronger reference point. In both suites, the baseline Codex model already delivers meaningful results. ParaCodex further improves geometric-mean performance on each benchmark. The NAS results demonstrate near-parity with expert implementations.
  • Figure 5: Performance breakdown and generalization.(Left) Anonymized Rodinia GPU execution time (log scale) comparing Reference, ParaCodex, and Baseline on representative kernels. (Right) Anonymized NAS Class D performance showing the impact of ParaCodex's staged refinement (Initial Translation vs. Targeted Optimizations) compared to Reference.
  • ...and 3 more figures