CUDA Pro Tip: Increase Performance with Vectorized Memory Access

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

Why it matters

CUDA programmers can cut executed load/store instructions by 2x-4x using vectorized memory access, directly boosting bandwidth on increasingly bandwidth-bound GPU kernels.

Read this as

NVIDIA updated its CUDA programming tutorial on vectorized memory access. GPUs normally move data in small 32-bit chunks, but with a simple code change programmers can move data in chunks four times larger, cutting instructions by up to 4x and speeding up data-heavy programs. The trade-off is that data must line up at specific boundaries, and it can hurt code that is already stretched thin. The original tip ran in December 2013 and now reflects current GPUs.

NVIDIA's updated CUDA Pro Tip shows developers how to get up to 4x fewer memory instructions from existing GPU code using vectorized types like int4, with corresponding bandwidth gains. Adoption cost is low: minor kernel changes plus alignment handling. The caveat: kernels already limited by registers or parallelism may perform worse, so teams should verify with profiling tools before rewriting. Anyone running bandwidth-bound CUDA workloads gains most.

Recasting pointers via reinterpret_cast<int2*> or <int4*> makes nvcc emit LDG.E.64/128 and STG.E.64/128 SASS instructions instead of scalar LDG.E/STG.E, reducing executed instructions 2x-4x with measured bandwidth improvements. Requirements: pointers offset in multiples of the vector size, and structures must be power-of-two bytes or the compiler adds padding. Vector loads raise register pressure and lower parallelism, so scalar loads may win in register-limited kernels. Verify with cuobjdump.

Read the original

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

Key terms

CUDA NVIDIA cuobjdump CUDA Toolkit NVIDIA Nemotron

Was this summary useful?

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

Related reading