NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

KPerfIR: Towards a Open and Compiler-centric Ecosystem for GPU Kernel Performance Tooling on Modern AI Workloads

Yue Guan, Yuanwei Fang, Keren Zhou, Corbin Robeck, Manman Ren, Zhongkai Yu, Yufei Ding, Adnan AzizOSDI 2025

Introduction

As Large Language Models (LLMs) and generative AI continue to scale, the underlying GPU "kernels"—the low-level programs responsible for computation—have become increasingly sophisticated. Modern optimizations such as Software Pipelining (SWP) and Warp Specialization (WS) are now standard in state-of-the-art kernels like Flash-Attention-3. However, these techniques require intricate coordination between hardware units, making performance bottlenecks difficult to diagnose.

Existing profiling tools, such as NVIDIA’s Nsight Compute, operate externally to the compiler. While they provide detailed hardware metrics, they lack awareness of the high-level logic intended by the compiler, such as specific loop iterations or pipeline stages. This "semantic gap" forces developers to manually correlate machine code with high-level source code, a process that is both error-prone and time-consuming. Furthermore, vendor-specific tools create a lock-in effect, hindering the portability of optimizations between NVIDIA and AMD architectures.

The KPerfIR Infrastructure

To address these challenges, we introduce KPerfIR, a novel, compiler-centric infrastructure for GPU kernel profiling. Built on top of the MLIR (Multi-Level Intermediate Representation) framework and integrated into the Triton compiler, KPerfIR treats profiling as a programmable compiler pass rather than an external observation.

Key Technical Components

  1. The KPerfIR Dialect: The core of the system is a new set of MLIR operations, most notably the RecordOp. Developers can insert these markers into high-level code to designate specific regions of interest (e.g., a specific stage in a software pipeline).
  2. Compiler-Centric Lowering: Because the profiling logic is embedded in the IR, the compiler handles the translation of these markers into efficient, architecture-specific instructions. This includes reading hardware clocks and managing data movement without leaving the compiler workflow.
  3. Efficient Data Management: To minimize the "observer effect"—where the act of profiling alters the performance characteristics of the kernel—KPerfIR utilizes stack-allocated indices and vectorized stores to a shared memory circular buffer. This ensures that data collection adds minimal latency.
  4. Trace Replay and Reconstruction: Post-execution, KPerfIR employs a trace replay technique. By subtracting the known overhead of the profiling instructions, the system can reconstruct a highly accurate timeline of asynchronous GPU operations, such as Tensor Core executions.

Evaluation and Case Studies

KPerfIR was evaluated on high-end hardware, including the NVIDIA H100 and AMD MI300X, focusing on two primary workloads: standard General Matrix Multiplication (GEMM) and the experimental Flash-Attention-3 (FA3) kernel.

Bridging the Semantic Gap

In the evaluation of Flash-Attention-3, KPerfIR allowed researchers to correlate hardware clock cycles directly with high-level program constructs, such as "Iteration 5 of the Softmax loop." This level of granularity revealed "idle bubbles" in the execution timeline—instances where consumer warps were stalling because producer warps had not yet finished loading data. Identifying these bubbles visually would have been nearly impossible with traditional, semantically-unaware tools.

Performance and Accuracy

  • Low Overhead: The infrastructure introduces an average latency overhead of only 8.2%, making it feasible for use during active development cycles.
  • High Accuracy: When compared against theoretical performance models, KPerfIR achieved a ~2% relative error, demonstrating its reliability for performance modeling.
  • Cross-Platform Portability: The tool successfully generated actionable insights on both NVIDIA and AMD platforms, proving that compiler-centric profiling can break vendor silos.

Impact on Kernel Optimization

The ultimate value of KPerfIR is demonstrated by the performance gains it enables. By using the insights provided by the tool to optimize the Flash-Attention-3 kernel within Triton, researchers achieved a 24.1% performance boost over the vanilla implementation. Notably, this optimized version outperformed the best hand-tuned manual implementations by 7.6%, showcasing the power of combining high-level compiler abstractions with deep performance visibility.

Conclusion and Future Work

KPerfIR represents a significant step toward an open, vendor-agnostic ecosystem for GPU performance tooling. By moving profiling into the compiler, it bridges the semantic gap and empowers developers to optimize complex AI workloads with unprecedented precision.

Future work will focus on expanding KPerfIR to support "fused" kernels that span multiple GPUs in distributed environments and integrating the infrastructure more deeply into the main Triton ecosystem. While currently limited by the hardware metrics exposed via the Instruction Set Architecture (ISA), KPerfIR provides a robust foundation for the next generation of AI performance engineering.

Summary updated

BibTeX
@inproceedings{guan2025kperfir,
  author = {Yue Guan and Yuanwei Fang and Keren Zhou and Corbin Robeck and Manman Ren and Zhongkai Yu and Yufei Ding and Adnan Aziz},
  title = {{KPerfIR: Towards a Open and Compiler-centric Ecosystem for GPU Kernel Performance Tooling on Modern AI Workloads}},
  booktitle = {OSDI},
  year = {2025},
}
Figure