Achieving a 232x Faster GPU Kernel Using Codex in an Auto-Research Loop
A GPU Mode contest participant used Codex in a tight automated feedback loop to optimize a batched QR decomposition CUDA kernel, achieving a 232x speedup over baseline. The approach highlights how agentic loop engineering and automated benchmarking allow developers to iterate rapidly on high-performance code.

Impact: High
Why it matters
You can apply agentic loop engineering to high-performance computing by coupling Codex or Claude Code with automated testing and benchmarking CLI harnesses.
TL;DR
- 01Coupling Codex with a deterministic feedback loop enables automated performance hill-climbing.
- 02Domain knowledge in prompts transforms unknown unknowns into structured algorithm choices like blocked Householder.
- 03Agentic iteration allows non-specialists to achieve competitive kernel speedups over baseline implementations.
Key facts
- Speedup over baseline
- 232x
- Leaderboard rank
- 12th out of 183
- Total agent submissions
- 1500+ over 14 days
- Tested matrix sizes
- 512x512 to 4096x4096 FP32
Agent-Friendly Benchmarking with Popcorn CLI AI agents excel when provided with precise, automated feedback loops. In the GPU Mode contest, participants optimized a batched square FP32 CUDA matrix A (shapes from 512x512 up to 4096x4096) returning compact Householder QR representations matching torch.geqrf(A). The organizers provided popcorn, a CLI tool that automated test execution, output validation, and geometric mean runtime scoring across matrix shapes. ### Loop Engineering and Architectural Strategy Rather than relying on raw code generation, the optimization strategy combined human-guided architectural direction with agentic iteration. Key execution steps included: - Algorithmic Selection: Transitioning to the blocked Householder algorithm with trailing WY-updates to eliminate sequential bottlenecks and reshape operations into Matrix Multiplications (GEMM). - High Submission Volume: Codex made over 1,500 automated submissions across 14 days to hill-climb performance gains. - Domain Guidance: Converting unknown unknowns into known unknowns by prompting the model with structural matrix concepts similar to those used in modern neural network optimizers like Muon and Shampoo.
Try it in 2 minutes
popcorn submit --kernel qr_v2.cu --benchmarkbash
✓ When to use
- Optimizing compute-heavy CUDA or Triton GPU kernels with automated verification
- Setting up autonomous agent execution loops backed by CLI benchmark harnesses
✕ When NOT to use
- Building generic business logic where performance feedback loops are absent
- Tasks where code correctness cannot be evaluated deterministically via test suites
What to do today
- Build CLI evaluation harnesses around performance-critical code to give coding agents a tight benchmark loop.
- Provide high-level algorithmic hints (such as GEMM blocked structures) in agent system prompts.
What the community says
“They are easily verifiable and hill-climbable... built tools for the same automatic verifiability that is useful for LLMs.”
Sources