Better Bug Detection: How Compile-Time Instrumentation for Compute Sanitizer Enhances Memory Safety

AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.

Why it matters

CUDA developers can now catch buffer overruns that slip past Compute Sanitizer's binary instrumentation, at the cost of recompiling with CUDA 13.1's new flag and accepting higher register and stack usage.

Read this as

NVIDIA's Compute Sanitizer is a tool that finds memory bugs in programs written for NVIDIA GPUs. Its old method checked only whether an address was inside any valid allocation, so a bug that overflowed one buffer into a neighboring buffer went undetected. CUDA 13.1 adds a compiler flag that attaches bounds information to pointers, catching these overruns. Developers debugging GPU code benefit.

Teams debugging CUDA C++ code get materially better bug coverage in CUDA 13.1: a new compile-time instrumentation option catches buffer overruns into adjacent valid allocations, a class of false negatives that also affects GCC and Clang address sanitizers. The trade-offs are recompilation, register and stack bloat that can block kernel launches, and unsupported HMM allocations. Shipping code must not use the flag.

CUDA 13.1 adds -fdevice-sanitize=memcheck, converting device pointers to fat pointers carrying base and bounds so overruns into adjacent allocations are caught, unlike peephole binary instrumentation that only checks allocation validity. Runtime overhead can drop by nearly an order of magnitude in some cases. Limitations: no HMM support (false positives possible), race conditions and undefined behavior cause false positives/negatives, use -lineinfo not -G.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

NVIDIA Compute Sanitizer CUDA 13.1 memcheck GCC Clang

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading