Count Global Memory Transactions for a Warp's Loads
Last updated: November 29, 2026
Quick Overview
Given the byte addresses that the 32 threads of a warp load, compute how many aligned 128-byte memory segments the access touches. Use it to compare a warp reading along a row versus down a column of a row-major float matrix.
NVIDIA
November 29, 20260
0
0 solved
Given the byte addresses that the 32 threads of a warp load, compute how many aligned 128-byte memory segments the access touches. Use it to compare a warp reading along a row versus down a column of a row-major float matrix.
A memory and performance fundamentals question at NVIDIA for CUDA developer, DevTech and performance engineering roles. The interviewer checks that you understand coalescing at the level of segments and cache lines, can turn it into a simple model, and know the standard fixes for strided access.
What the Interviewer Expects
- Models the access as the set of distinct addr // 128 segment ids
- Shows row access with 4-byte floats touches 1 segment when aligned and 2 when misaligned
- Shows column access with a large stride touches 32 segments
- Explains the bandwidth cost: 32x more bytes moved for the same useful data
- Suggests fixes: transpose via shared memory, change layout (SoA), or reassign threads
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How do 32-byte sectors in modern L2 caches change this model?
- Why is an array of structs often slower than a struct of arrays on a GPU?
- What does misalignment by 4 bytes cost, and how would you avoid it?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Input: list of 32 byte addresses, segment size 128 by default. Output: number of distinct segments, a proxy for memory transactions. Also build helpers that generate addresses for row-wise and column-...
High-Level Design
The memory system serves a warp's request in aligned chunks. If the 32 addresses fall in one aligned 128-byte block, one transaction serves the warp. Each extra block touched is another transaction mo...