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
- Registers and Local Memory
- Global Memory Tradeoffs
- Constant Memory and Its Cache
- A Mental Model of the Hierarchy