0PricingLogin
CUDA Academy · Lesson

Registers and Local Memory

The fastest per-thread storage and its spills.

The Fastest Memory You Have

Every thread gets its own private registers, the quickest storage on the chip. They live right next to the math units, so reads cost almost nothing.

Plain Variables Become Registers

When you write a normal local variable in a kernel, the compiler usually keeps it in a register. No special syntax is needed at all. 🙂

__global__ void k() {
    int x = 5;   // x lives in a register
    float y = x * 2.0f;
}

All lessons in this course

  1. Registers and Local Memory
  2. Global Memory Tradeoffs
  3. Constant Memory and Its Cache
  4. A Mental Model of the Hierarchy
← Back to CUDA Academy