PRAGMA: A Profiling-Reasoned Multi-Agent Framework for Automatic Kernel Optimization
Lei, Kelun, Yang, Hailong, Zhang, Huaitao, You, Xin, Zhang, Kaige, Zhongzhi Luan et al. · 2025 · 20 citationsRead the paper
Designing high-performance kernels requires expert-level tuning and a deep understanding of hardware characteristics. Recent advances in large language models (LLMs) have enabled automated kernel generation, yet most existing systems rely solely on correctness or execution time feedback, lacking the ability to reason about low-level performance bottlenecks. In this paper, we introduce PRAGMA, a profile-guided AI kernel generation framework that integrates execution feedback and fine-grained hardware profiling into the reasoning loop. PRAGMA enables LLMs to identify performance bottlenecks, preserve historical best versions, and iteratively refine code quality. We evaluate PRAGMA on KernelBench, covering GPU and CPU backends. Results show that PRAGMA consistently outperforms baseline AIKG without profiling enabled and achieves 2.81$\times$ and 2.30$\times$ averaged speedups against Torch on CPU and GPU platforms, respectively.
What the full text shows
Working prototype- Average speedup over Torch baseline on CPU platforms — 2.81x (KernelBench dataset on Intel Xeon Gold 6230R CPU)
- Average speedup over Torch baseline on GPU platforms — 2.30x (KernelBench dataset on NVIDIA A100 40GB GPU)
- Improvement over N-PRAGMA (baseline without profiling) on CPU — 10.95x (KernelBench dataset)
- Improvement over N-PRAGMA (baseline without profiling) on GPU — 1.90x (KernelBench dataset)
- Success rate (kernels that compile, execute correctly, and pass verification) — 92.0% (Compared to Caesar (49.0%) and N-PRAGMA (92.0%))
- Percentage of kernels correct and as fast as Torch baseline (Fast1) — 59.8% (Compared to Caesar (14.3%) and N-PRAGMA (32.2%))
- Setup
- Intel Xeon Gold 6230R CPU (gcc 12.3.0) and NVIDIA A100 40GB GPU (CUDA 13.0); evaluated on KernelBench across six categories (matmul, activation, normalization, pooling/reduction, conv, others).
- How
- A multi-agent framework (Coder, Verifier, Profiler, Conductor) that uses an iterative loop of code generation, correctness verification, and fine-grained hardware profiling. The Conductor agent reasons over low-level metrics (e.g., occupancy, IPC, cache utilization) to provide targeted optimization suggestions to the Coder.
- Limitations
- Limited gains observed in convolution kernels due to high implementation complexity (deep loop nests, high-dimensional tensor accesses). · CPU backend lacks the autotuning support available in Triton for GPUs, making optimal tiling harder to achieve.
Summarized by Gemma 4 from the open-access full text · 22 Nov 2026. Read it