Coalescing and shared workgroup memory

15-minute session: read for 3 minutes, trace for 3, experiment for 7, and complete the check for 2. Spend longer whenever you need.

GPU lanes accessing adjacent elements can allow efficient memory transactions. Workgroup-shared memory may reduce repeated global reads, but it consumes a limited resource and requires correct synchronization. Names and details vary across CUDA, Metal, Vulkan, and other APIs. Draw which lane reads which element before changing data layout; validate the output after every layout change.

Practice and evidence: Predict the example or draw its state transitions. Change one assumption, test the boundary, and record the actual result. Explain what this small model does not establish about a production system.

lanes=4
contiguous=[lane for lane in range(lanes)]
strided=[lane*16 for lane in range(lanes)]
print(contiguous)
print(strided)

Expected result: [0, 1, 2, 3] [0, 16, 32, 48]

Practice and evidence

Keep three notes: your prediction, the actual result, and why they match or differ. The completion check grades understanding; the practice task builds skill.

Language reference: git.agilaos.com

Language reference: docs.nvidia.com