DCJun 4

LLM-Based Porting of Optimized C++ to CUDA Through Deoptimization and Reoptimization

arXiv:2606.0606364.3
Predicted impact top 47% in DC · last 90 daysOriginality Synthesis-oriented
AI Analysis

For HPC developers seeking to automate GPU porting of legacy CPU-optimized code, this work provides a conditional improvement over direct LLM translation, but the gains are non-universal and depend on specific kernel and model characteristics.

The paper proposes a Deopt-Reopt workflow for LLM-based porting of optimized C++ to CUDA, which first simplifies CPU-specific optimizations and then reoptimizes for GPU. On twelve HPC kernels, the method outperformed direct translation in some cases (e.g., conv2d) but was not universally beneficial, with mixed results on feasibility and performance depending on kernel, model, and search budget.

When porting high-performance computing (HPC) code from CPU to GPU, CPU-oriented optimizations may obstruct LLM-based CUDA translation. We design and evaluate a Deopt-Reopt workflow that first simplifies the input C++ code and then retranslates and reoptimizes it for CUDA, comparing it against direct translation (Direct) on twelve HPC kernels with two LLMs (gpt-oss-120b (O120) and qwen-3-235b-a22b-instruct-2507 (Q235)) in Single-shot (one pass) and Iterative (repeated refinement) settings. In Single-shot, among 18 testable cases Deopt-Reopt was significantly faster among successful trials (after BH-FDR correction) in five - most clearly for conv2d, where CPU- and GPU-oriented designs diverge - but Direct was faster in three, so removing CPU-specific optimizations is not universally beneficial. An exploratory Direct-3 control that equalizes the LLM-call count left Deopt-Reopt ahead in only four of nineteen testable cases, with Direct-3 ahead in four others. In Iterative, repeated generation and repair narrow the mode gap - markedly so for O120 - while Q235 retains large Deopt-Reopt advantages on conv2d, ddgemm, and bgemm. Deopt-Reopt's effect on feasibility is also mixed - sharply higher for some kernels Direct rarely compiles, lower for others. Because performance is conditioned on successful trials, the benefit is conditional rather than a guaranteed end-to-end gain. Overall, Deopt-Reopt is an effective but non-universal technique for LLM-based GPU porting, with gains that depend on the kernel, the model, the search budget, and the success rate.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes