An NVIDIA engineering post demonstrates a six-step CUDA workflow on RGB-to-grayscale and per-tile median image processing. It first shows how Compute Sanitizer localizes an out-of-bounds shared-memory write that ordinary error checking reports only as an illegal memory access; then it replaces the two custom kernels with CUB primitives. The reported effect is a fall from 6.8 seconds to roughly 635 milliseconds and a shift of the dominant cost from median computation to memory allocation.1

Context

The initial profile justifies the ordering of changes. Nsight Systems with NVTX ranges shows the GPU busy with kernels 98.5 percent of the time and the custom median kernel costing about 2.1 seconds per image inside a 6.8-second three-image run. The median kernel is both the correctness hazard and the performance hotspot: it copies a 32-by-32 tile into shared memory, but indexes that shared array with the thread's full-image linear offset, and later sorts the tile with a single thread.1

Assessment

The article's real move is from hand-written algorithm code to a layered toolbox: a new launch and index API makes the block-versus-global indexing distinction structural; spans supply debug-time bounds checks; and CUB absorbs the block-level sort. The arithmetic is internally coherent: three images at 2.1 seconds account for roughly 6.3 of the 6.8 seconds, so eliminating that stage leaves only about half a second of residual work, which is the same order as the reported post-CUB total. This makes the bottleneck attribution evidence-backed within the post's own environment.1

Caveats

The listed performance magnitudes are single-environment illustrations without stated hardware, CUDA or driver version, compiler flags, or variance, so the speed-up should not be read as a general benchmark. The assessment would change if a documented reproduction failed to show the same ordering of durations, if the median path required more than trivial harness changes at other tile sizes, or if memory pooling made allocations stop being the measured limit.1