AMD is very clear about the memory capacity and performance details in their OpenCL programming guide. The figure below showcases these hardware characteristics of the Radeon HD5870:
OpenCL Memory Type | Hardware Resource | Size/CU | Size/GPU | Peak Read Bandwidth / Stream Core |
Private | GPRs | 256KB | 5MB | 48 bytes/cycle |
Local | LDS | 32KB | 640KB | 8 bytes/cycle |
Constant | Direct-addressed constant | - | 48KB | 16 bytes/cycle |
Same-indexed constant | - | - | 4 bytes/cycle | |
Varying-indexed constant | - | - | ~0.6 bytes/cycle | |
Images | L1 Cache | 8KB | 160KB | 4 bytes/cycle |
L2 Cache | - | 512KB | ~1.6 bytes/cycle | |
Global | Global Memory | - | 1GB | ~0.6 bytes/cycle |
GPRs – General Purpose Registers
LDS – Local Data Store
Direct-addressed constant – a constant accessed using a constant address.
Same-indexed constant – a varying-indexed constant where each processing element accesses the same index.
Varying-indexed constant – a varying-indexed constant where the processing elements access different indices.
Of course, consider this data for fetches that are properly aligned. In case of unaligned data access the actual throughput can be much lower. In order to be able to reach the peak bandwidth we have to align our data usually to multiples of 4, 8 or 16 bytes (depending on actual hardware).
As it can be seen, constant storage can also fall into three different access performance categories so do buffers and images. While actual numbers differ on various platforms, the guidelines apply to most of modern GPUs: use a particular addressing method wisely and take in consideration access locality in order to get optimum performance.