Engineering posts
Tracing a CUDA kernel from nvcc to GPU hardware
- Category: Engineering post
- Status: discussion
- Sources: author write-up, discussion
- Summary: Fergus Finn traced a vector-addition CUDA kernel on an RTX 4090 across every layer: nvcc producing PTX and SASS, the host-side launch stub, driver communication through ioctls and memory-mapped doorbells, command submission via pushbuffers and QMD structures, warp scheduling with compiler-inserted control codes, memory coalescing and L2 caching, and the result copy back to the CPU. He reverse-engineers closed-source libcuda using LD_PRELOAD interposition and custom kernels that read device memory.
- Why it matters: It is a concrete, artifact-backed map from the CUDA API down to GPU hardware behavior, useful for anyone profiling or optimizing GPU code.