Reading GPU Architecture: How Thread Blocks Meet SMs and Memory
GPU performance depends on how parallel work is divided and how data moves through the memory hierarchy, not just on the number of compute units. Using NVIDIA CUDA and a worked vector-add example, this guide connects thread blocks, SMs, caches, and device memory while distinguishing the conceptual model from a physical chip layout.
Reading GPU Architecture: How Thread Blocks Meet SMs and Memory
When reading GPU architecture, look beyond the number of compute units. Ask how program work is divided into execution units and how data moves through memory. In NVIDIA CUDA’s conceptual model, kernel thread blocks are assigned to SMs, and each thread calculates its part of the data. This article follows CUDA terminology and a one-dimensional array addition. Other vendors use different names and may organize hardware differently.
First, separate two kinds of hierarchy
GPCs and SMs belong to CUDA’s conceptual hardware model. A GPU has multiple Streaming Multiprocessors (SMs), and Graphics Processing Clusters (GPCs) group multiple SMs. Each SM includes registers for fast thread-local use, compute units, and on-chip data-cache resources. In CUDA’s model, L1 cache and a block’s shared memory draw on a unified data-cache resource within the SM; L2 cache and global memory are shared by more SMs. Global memory generally refers to the GPU’s device DRAM.
Grids and thread blocks are software units developers use to divide a kernel’s work. A kernel is a function that runs on the GPU. Launching it starts one grid made of thread blocks, each containing multiple threads. In NVIDIA CUDA, a warp is a group of 32 threads. Do not treat a GPC and a grid as the same kind of hierarchy: one groups hardware in the model, while the other groups the work in a kernel launch.
In the CUDA model, threads in one block run together on a single SM. They can exchange data through shared memory and synchronize within that block. Grid blocks are assigned to available SMs, but the order and exact SM assignment are not guaranteed. If there are more blocks than available SM capacity, later blocks run after earlier ones finish, in successive waves. This abstraction lets programs target GPUs of different sizes; the model should not be read as a diagram of the chip’s exact circuitry.
The diagram connects the hardware hierarchy to work placement. Its boxes and arrows illustrate relationships and data flow; they do not show physical distances or execution order.
Conceptual CUDA model. GPC/SM groups and grid/blocks are different hierarchies; input arrays pass through a computation into an output array. Box counts are illustrative, not hardware counts. The diagram does not show physical chip placement or scheduling order.
Follow the data through an array addition
Suppose we add elements at matching positions in two arrays to create a third array. In a simple kernel, each thread calculates an index, reads two inputs, adds them, and writes one result.
i = blockIdx.x * blockDim.x + threadIdx.x
if i < N:
C[i] = A[i] + B[i]threadIdx.x is a thread’s position inside its block; blockIdx.x is the block’s position in the grid; and blockDim.x is the number of threads in a block. For 1,000 elements and 256 threads per block, the grid needs ceil(1000 / 256) = 4 blocks. The last block has 24 threads whose indices fall beyond the array, so the i < N check prevents out-of-bounds access. A block size of 256 is an illustrative setting, not an optimal recommendation for every GPU or workload.
An application usually prepares its inputs in device memory from the CPU (host) and then launches the GPU kernel. Each block runs on one SM; its threads read A[i] and B[i] from global memory, add them, and write C[i]. If the CPU needs the result, it can be copied back to host memory after the kernel finishes. This is the basic vector-add path; an application’s transfer steps depend on whether data is already on the GPU and reused by other operations.
Assume each element is a 32-bit floating-point number. One addition reads 8 bytes of inputs and writes 4 bytes of output: 12 bytes of algorithm-level data access for one addition. The simple arithmetic intensity is therefore 1 operation / 12 bytes. This illustrative count omits caching, actual memory transactions, and address-calculation instructions; it is not measured DRAM traffic or a benchmark. It shows why theoretical arithmetic throughput alone may not predict the speed of a data-moving workload.
Memory access patterns also matter. When neighboring warp threads read or write neighboring array elements, CUDA can combine their global-memory accesses efficiently. If threads request addresses far apart, the hardware may transfer more data than the program uses. Array addition is a simple example with consecutive indices; matrix transpose and sparse data need separate access-pattern analysis.
Connect specifications to the workload
| Specification or structure | What to check | How it relates to the workload |
|---|---|---|
| SM count and generation | Product-specific SM count and supported features or precision | Enough blocks are needed to distribute work across SMs; the count alone does not determine application speed. |
| Warp and block limits | Threads allowed per block and execution model | These affect parallel decomposition and launch configuration; verify the limits for the generation. |
| Registers and shared memory | Capacity per SM and per block, plus the kernel’s requirements | A block that uses many resources can reduce how many blocks fit on an SM concurrently. |
| L1 and L2 cache | Capacity, scope, and relationship to shared memory | Data reuse can change where memory requests are served. |
| GPU memory | Capacity, type, bandwidth, and connection | These help determine whether the data set fits and whether memory movement may limit the work. |
| Throughput by precision | Theoretical peak and supported formats such as FP32 or FP16 | The same GPU may have different peak throughput for different formats and kernels. |
A small addition with only four blocks may leave some SMs idle on a GPU with many SMs. Even with enough blocks, a kernel that needs many registers or much shared memory may limit the number of blocks resident on each SM. Occupancy compares active warps on an SM with its supported maximum; a high value by itself does not guarantee a faster kernel. Consider it alongside resource use, latency hiding, and measured throughput.
Actual performance may be limited by memory bandwidth, compute throughput, latency, or insufficient parallelism. Specifications show hardware resources and possible ceilings, but do not prove which limit affects a particular application. Start by measuring total time on representative inputs, including CPU-to-GPU and GPU-to-CPU transfers. Then use a profiler to inspect kernel time, memory throughput, compute-unit activity, and resource use. Do not assume that adding compute units will speed up a memory-oriented workload.
References
[NVIDIA CUDA Programming Guide: Programming Model](https://docs.nvidia.com/cuda/cuda-programming-guide/01-introduction/programming-model.html)
[NVIDIA CUDA Programming Guide: Writing SIMT Kernels](https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/writing-cuda-kernels.html)
[NVIDIA GPU Performance Background User’s Guide](https://docs.nvidia.com/deeplearning/performance/dl-performance-gpu-background/index.html)