CUDA Kernel Profiling, Occupancy & the Roofline

Nsight Systems and Nsight Compute workflow, occupancy tuning, warp stall analysis, ILP, warp divergence, and CUDA Graphs. How to go from a slow kernel to a fast one systematically.

Overview

Measure before you optimize

Profiling is the empirical method of AI performance engineering; without measurement, optimization is guesswork. NVIDIA provides two complementary profilers, and knowing how to read and act on their output is an essential skill for any AI systems engineer.

The two tools work together in a loop.

  • Run the workload under Nsight Systems and read its timeline. It answers the first question: why is the GPU idle?
  • Pick the hot kernel and open it in Nsight Compute. Its hardware counters answer the second question: why is this kernel slow?
  • Make one targeted fix.
  • Re-profile. The next bottleneck sends you back to the timeline in step 1.

Interview questions

  • How would you systematically profile and optimize a slow GEMM kernel using Nsight tooling?
  • What is CUDA Graph pre-warming and why does it matter for LLM inference latency?

Sign up free to read the full topic

More AI Infrastructure topics

Start free on Cariara · Coding problems · System design studio