What a Memory Transaction Is
Cache lines and 32-/128-byte segments.
What a Memory Transaction Is is a free CUDA Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CUDA Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Memory Comes in Chunks
The GPU never fetches a single byte by itself. It moves memory in fixed-size blocks called a memory transaction, even if you only asked for one value.
The Warp Asks Together
A warp of 32 threads issues its loads at the same time. The hardware gathers all 32 requests and tries to serve them with as few transactions as possible.
Cache Lines and Segments
Global memory is carved into aligned segments, commonly 32 or 128 bytes wide. Each transaction pulls in one whole segment, never a partial slice.
Why 128 Bytes Matters
A 128-byte line holds exactly 32 four-byte floats. That is one value for every thread in a warp, so a tidy warp can be served by a single transaction.
// 32 threads x 4-byte float = 128 bytes = one lineAlignment Is Key
Segments start at fixed, aligned addresses. If your data begins mid-segment, a single warp can spill across two lines and force an extra transaction.
Paying for Bytes You Skip
If a warp touches only a few bytes of a 128-byte line, the GPU still moves all 128. The unused bytes are wasted bandwidth you paid for anyway.
Counting Transactions
Performance often comes down to one number: how many transactions a warp needs. Fewer transactions means you read less and finish faster.
The Best Case
When 32 threads read 32 neighboring floats from an aligned address, the GPU answers with one clean 128-byte line. That is the ideal single transaction.
float v = data[blockIdx.x * blockDim.x + threadIdx.x];The Worst Case
If each thread grabs a value far from its neighbors, the warp may trigger up to 32 separate transactions, dragging in 32 full lines for tiny use.
Bandwidth Is the Limit
Most kernels are bound by how fast they move memory, not by math. Shrinking transaction count directly raises your effective bandwidth. 🚀
Set the Stage
Now you know the unit of cost: the segment-sized transaction. Every coalescing trick ahead is really about packing warps into as few of these as you can.
Quick Check
Test your grasp of transaction size.
Recap
You learned that the GPU moves memory in fixed segments, and a warp is served by as few transactions as it can manage. Fewer transactions, faster kernel. 🎉
Frequently asked questions
Is the “What a Memory Transaction Is” lesson free?
Yes — the full text of “What a Memory Transaction Is” is free to read here on the web, and the CUDA Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CUDA Academy course, upgrade to CoddyKit PRO.
What will I learn in “What a Memory Transaction Is”?
Cache lines and 32-/128-byte segments. You practise CUDA Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start CUDA Academy?
No prior experience is required. CUDA Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “What a Memory Transaction Is” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this CUDA Academy lesson?
Yes. Every CUDA Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What a Memory Transaction Is
- Coalesced vs Strided Reads
- Structure of Arrays vs Array of Structs
- Measuring Effective Bandwidth