Xtrace: High-Fidelity GPU Intra-Kernel Tracing via Binary-Level Instruction Splicing
Zhuobin Huang, Kai Zhang, Weihao Cui, Hongshi Tan, Liang Luo, Christopher Dewan, Shen Li, Bingsheng He
Abstract
Modern GPU kernels fuse increasingly more work into a single kernel, and intra-kernel tracing has become the mainstream method to profile them. Tracing inserts probes into the kernel to record its runtime states, and the fidelity of the trace determines the efficiency of performance optimization. Unfortunately, existing tools insert probes before compilation. These tools interfere with the compiler's optimizations, so they trace a different binary from the one the GPU executes. They also add significant runtime overhead. Xtrace is the first GPU kernel tracing system with near-zero compile-time interference and minimized runtime overhead. Xtrace inserts probes directly into the compiled kernel binary. It reuses only the registers that hold dead values at the insertion address and resolves all hazards with the compiler's hazard tables. It further schedules the instruction order, register allocation, and control bits to minimize the runtime overhead the probe introduces. Xtrace supports 19 NVIDIA and AMD GPU architectures, and is publicly available for use at https://g-watch.github.io. We evaluate Xtrace on major production large language model (LLM) kernels against the state-of-the-art tracers Neutrino and IKET from NVIDIA. On H100, B300, and MI300X GPUs, Xtrace preserves 94-98% of the instructions of the kernel, while existing tools preserve only 8-48%. Xtrace adds only 0.9-2.8% overhead, while existing tools add 3.8-75.6%. Xtrace guides a coding agent to reach the same FlashAttention-3 performance with 3.9x fewer iterations than existing traces do. Thanks to our binary-level instrumentation, Xtrace also traces the faster closed-source cuDNN kernel, which guides the agent to lift the open-source FlashAttention-4 by 5.2-13.3% in throughput.
Create a lesson
Related papers
"Is Low Power Enough?" Rethinking Energy Efficiency in High-Fidelity Sensing
Shared title terminology · Chae Young Lee, Lan Mei, Jesse Fonseca et al.
Splice-Core: Low-Order-Bit-Splicing GEMM for Highly Energy-Efficient AI Inference Accelerators
Shared title terminology · Prabhu Vellaisamy, Hsien-Fu Hung, Andrew Kim et al.
Native FPGA Hard-Block Implementation from High-Level Synthesis
Shared title terminology · Mohamed Bouaziz, Mahmoud A. Elshenawy, Krishnan B. Iyer et al.
RTLREX: LLM-Guided Framework for Exact High-Level RTL Recovery
Shared title terminology · Wuqian Tang, Fangzhou Liu, Ruijie Wang et al.
An ASIC Design Flow for High-Level Synthesis of Asynchronous Circuits
Shared title terminology · Mayuresh Warunjikar, Madhav Desai
Structure-augmented LLMs for High-Level Synthesis Pragma Optimization
Shared title terminology · Haocheng Xu, Ye Qiao, Phyo Pyae Moe Aung et al.