0Pricing
CUDA Academy · Lesson

Constant Memory and Its Cache

Broadcasting read-only values cheaply.

A Space for Read-Only Values

Constant memory is a small region built for data that every thread reads but none of them ever writes during a kernel.

Declaring It

You mark a global-scope array with the __constant__ qualifier. It lives outside any function, visible to all your kernels.

__constant__ float weights[256];

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