Multi-turn RL with Structural and Performance Aware Rewards for CUDA Kernel Generation

Quazi Ishtiaque Mahmud, Nesreen K. Ahmed, Ali Jannesari 2026-07-24

CudaPerf addresses the problem that existing RLVR methods for CUDA kernel generation overlook structural code properties like memory coalescing and occupancy, relying only on outcome-based signals. The method proposes a two-stage reflective RL framework with offline pairwise ranking and online RL training that jointly optimizes correctness, performance, and structural efficiency via a unified reward. Experimental evidence shows CudaPerf achieves up to 5X and 3.32X speedup improvements and 17% and 7% correctness gains over Qwen-3-32B and CUDA Agent on C-to-CUDA and PyTorch-to-CUDA benchmarks. This matters because it demonstrates that incorporating structural code-aware rewards significantly enhances LLM-driven optimized code generation for high-performance computing.

PDF