What the memory system gives a streaming kernel, measured with the vector add.
We measure bandwidth with vadd, which computes
c[i] = a[i] + b[i].
The kernel:
No loaded value is used twice, so memory sets the speed.
The host times one dispatch. The clock starts just before the doorbell write. It stops when the completion signal reaches zero. So the time includes the launch.
Each size runs five reps with a fresh signal and reused buffers. We keep the best rep.
Bandwidth is 12 bytes per element over the best time: two reads and one write. We measured with the model server stopped and coarse data unless a row says fine.
| elements | best time | GB/s |
|---|---|---|
| 1 | 133 us | launch floor |
| 1,048,576 | 151 us | 83 |
| 16,777,216 | 924 us | 218 |
| 16,777,216, fine | 906 us | 222 |
| 67,108,864 | 3,578 us | 225 |
| 67,108,864, fine | hangs | open item |
The theoretical peak is 256 GB/s. The largest size reaches 225 GB/s, which is 88 percent of the peak.
At 1,048,576 elements the launch is still a large share of the time, so the rate is only 83 GB/s.
The launch floor is 133 us.
A dispatch of one element costs 133 us. Every dispatch pays this cost before it moves any memory.
At 225 GB/s, 133 us moves about 30 MB. A training step must move enough bytes that 133 us is small against it. So the floor sets a lower bound on the batch size.
Fine-grained data streams at the same speed as coarse data: 222 GB/s against 218 GB/s at 16,777,216 elements. So the COHERENT flag costs nothing on streaming loads.
At 67,108,864 fine elements (768 MiB), the kernel hangs before its first store and logs no fault. This is an open item. Our data stays coarse.
Two processes share the bandwidth.
With two rbg processes at once, their bandwidths add up to about the bandwidth of one process alone. With a model server generating alongside, our reps run at about half speed, and every result is correct.
The hardware runs the queues side by side. It does not starve one queue for another.
docs/lessons.mdsrc/kernels/vadd.s