TL;DR
AMDKernelVault addresses the severe shortage of AMD-specific GPU optimization data by introducing a massive, open corpus of over 100,000 execution-verified HIP and Triton kernels. By training a compact, locally deployable Qwen3-8B model on this dataset using execution-aware reinforcement learning, the authors demonstrate that specialized local models can outperform frontier LLMs like GPT-5 and Claude Sonnet 4 in generating correct code for AMD hardware.
What Problem Does This Paper Address?
The current landscape of GPU kernel optimization is heavily centered around NVIDIA's CUDA ecosystem. While large language models (LLMs) and agentic workflows have shown great promise in automatically writing and optimizing high-performance kernels, their training data and tooling are almost exclusively CUDA-centric.
When developers try to target AMD's ROCm/HIP ecosystem, they often rely on source-to-source translation tools like hipify. However, direct translation fails to generate performant code because it ignores fundamental architectural differences between NVIDIA and AMD hardware—such as wavefront execution sizes (32 vs. 64 threads), Local Data Share (LDS) usage, and memory coalescing constraints. Furthermore, state-of-the-art kernel generation agents rely on repeated, expensive calls to proprietary frontier LLMs, making them costly and impossible to deploy in secure, private AMD environments.
Methods
The authors developed a unified, agent-driven framework consisting of two pipelines: HIPKernelGen and TritonKernelGen.
The framework operates in two distinct stages:
- PyTorch Reference Standardization: Raw PyTorch modules are converted into standardized, function-style references to ensure consistent interface semantics and reliable validation.
- Backend-Specific Kernel Synthesis: An LLM-based agent generates candidate kernels, which are then compiled under ROCm, tested for numerical correctness against the PyTorch reference, and profiled for latency on actual AMD hardware. If a kernel fails, a "reflector" agent interprets the compiler/runtime errors to guide iterative regeneration.
To demonstrate the utility of this data, the authors fine-tuned a Qwen3-8B model using a two-stage training recipe:
- Supervised Fine-Tuning (SFT): Teaches the model basic syntax, binding conventions, and memory-access idioms to overcome the "cold-start" problem.
- Execution-Aware Reinforcement Learning (RL): Uses Group Relative Policy Optimization (GRPO) with a hierarchical reward function (rewarding compilation, numerical correctness, and speedup).
Datasets
The resulting corpus, AMDKernelVault, contains two primary components:
- HIP/ROCm Datasets (64,530 samples): Includes PyTorch-to-HIP translation tasks, HIP-to-HIP optimization pairs, and a unique ROCm Libraries QA subset. The QA subset provides production-grounded, interface-level supervision extracted directly from AMD's
rocBLASandrocSOLVERlibraries. - Triton Datasets (39,893 samples): Aggregates and refactors Triton kernels from sources like
TritonBench-8kandStack-v2-dedup, filtering out vendor-specific artifacts to ensure strict compatibility with AMD hardware.
Key Insights and Ideas
- The "Binary Reward Collapse" Dilemma: In early stages of reinforcement learning for code generation, most candidate kernels fail to compile or pass validation. The authors mathematically prove that standard GRPO with binary rewards (0 or 1) leads to a "zero-advantage collapse" over 60% of the time, meaning the model receives no gradient signal to learn from.
- The Fix (Hierarchical Rewards + Disabling Normalization): To solve this, the authors introduced partial credit for compilation (0.4) and disabled variance normalization in GRPO. This keeps gradients stable even when rewards are highly clustered and sparse.
- Data Quality Beats Model Size: A relatively small 8B parameter model, when trained on native, execution-verified AMD data, can successfully internalize the roles of generator, reflector, and optimizer within an agent loop, outperforming massive frontier models on correctness.
Key Results
The specialized Qwen3-8B model was evaluated against frontier models (GPT-5, Claude Sonnet 4, Gemini 2.5 Pro) under a fixed 3-iteration agent budget on AMD MI355X GPUs.
- PyTorch-to-HIP Translation: The trained Qwen3-8B achieved 34.0% Pass@1 correctness, outperforming GPT-5 (24.0%) and Claude Sonnet 4 (22.0%).
- HIP-to-HIP Optimization: The model reached 84% correctness with a 1.14× average speedup, approaching GPT-5's 87% correctness.
- Triton Benchmarks: On
TritonBench-G, the model achieved 33.2% Corr@3, beating Claude Sonnet 4 (29.8%) and GPT-5 (15.2%). On the AMD-specificROCmBench, it achieved the highest correctness at 41.94% Corr@3.
Limitations and Future Work
While the model excels at basic to medium-difficulty tasks (Levels 1–3), expert-level kernels (Levels 4–5) remain highly challenging for all models tested. Common failure modes include choosing incorrect tile sizes for unusual tensor shapes and synchronization errors in multi-stage reductions.
Additionally, some generated kernels still inherit suboptimal structures from their upstream CUDA lineages. The authors note that future iterations must incorporate richer, profiler-guided feedback (tracking register pressure, memory footprint, and hardware occupancy) rather than relying primarily on compilation and numerical correctness.
Summary updated