R450 · Infrastructure for agents at scale › Consistency and storage tradeoffs

Storage IO straight into GPU memory: what the fio patches measure, and the two costs the announcement skips

Read the original

storagegpuio-uringlinux-kernelbenchmarkingverificationkv-cache

Linux 7.4 adds a dma-buf path to io_uring's registered-buffer interface. In plain terms: userspace can hand io_uring a buffer that lives in an accelerator's memory — GPU VRAM, in the case measured here — and issue storage IO directly against it. An NVMe device reads and writes GPU memory without a bounce through host RAM.

For anyone serving models, that matters because the obvious consumers are KV-cache offload and tensor loading: the paths where terabytes move between storage and accelerator memory and the host copy is pure overhead. The work below is the measurement tooling for that path, submitted as an open pull request against fio, the standard storage benchmark. It is worth reading not for the headline (GPU-direct storage is not new as a concept) but because it is an unusually honest benchmark write-up, and the two numbers it reports against its own interest are the ones that should shape anyone's expectations.

What was added

A prior merged series added a dmabuf=udmabuf option to fio's io_uring engine, exercising the new interface with ordinary system memory. This series does three things on top.

It fixes a registration bug with a real cost. The whole dma-buf was being registered once per queue-depth entry, and each registration is a separate device attachment and DMA mapping in the kernel. The fix registers it once per file and addresses buffers by offset. The measured effect at queue depth 32: 32 device attachments become 1. Two restrictions fall out of the fix — the "exactly one file" limit disappears, and registerfiles and sqthread_poll begin working, where previously they failed every IO with EBADF because they reopened the file.

It puts the exporter behind an interface. A small ops struct with alloc and free, with the existing system-memory exporter converted and no functional change. The structural point is that the second exporter is a plug-in, not a fork.

It adds a GPU exporter. Buffers allocated with HIP and exported through the vendor runtime's portable dma-buf export call, behind a build flag. There is also an up-front requirements check that produces clear errors for a kernel without the needed io_uring feature flag, for polled IO, for files that are not block devices, and for a buffer over 4 GiB or not a page-size multiple — a small thing that separates a usable benchmark from one that fails mysteriously.

The design problem nobody mentions when pitching GPU-direct IO

A storage benchmark has to fill buffers before writing and verify them after reading. Both are CPU work on memory that is now on the far side of a PCIe link, where CPU access is slow.

The chosen solution is a host shadow buffer, with copies only when contents matter: writes are copied to the GPU before queueing if verification or buffer refilling is on, otherwise the initial contents are copied once; reads are copied back in the event hook, after the completion timestamp has been taken, and only when verification is on.

That last detail is the whole trick. Completion latencies are unaffected because the copy happens after the clock stops. The honest consequence, stated plainly: a verifying job issues IO more slowly, because the job thread is doing the copying.

This is a pattern worth stealing for any benchmark of a device whose memory the measuring code cannot cheaply touch. Keep a host shadow, copy only on the paths where correctness is being checked, and move the copy outside the measured interval — then say so, loudly, so nobody reads the correctness-checking run as a throughput run.

Proving the IO is actually peer-to-peer

This is the part most write-ups skip, and it is the reason to trust the rest. Rather than asserting the data went straight to the GPU, the series shows it four independent ways during a single 200,000-IO job:

Four signals at three layers — kernel decision, address-space evidence, request counting, and device-side accounting — with the last one independent of the host entirely. Any claim of the form "the data took the fast path" should be substantiated roughly like this. The SMART-log check in particular costs nothing and catches the case where the benchmark was measuring something other than it thought.

The throughput result: a null finding, correctly reported

Sixty-second runs on a single device, no verification, comparing default buffers, pre-registered host buffers, dma-buf over system memory, and dma-buf over GPU memory.

At 4k random read, queue depth 128, one job: 238k IOPS for default buffers, then 264k, 268k and 267k for the three registered types. Random write at the same shape: 225k, 244k, 238k, 251k. At four jobs: 857k against 956k, 956k, 945k. At 128k and 1M block sizes all four land within a percent of each other, between 5.25 and 5.67 GB/s — and the write-up names the reason rather than leaving it hanging: the device's PCIe link is the limit there.

Completion latency at 4k, qd128, one job: 476 µs average and 537 µs at p99 for GPU-memory buffers, 481 and 545 for registered host buffers, 534 and 610 for default buffers.

So the finding is that IO to GPU memory performs like any other registered buffer type, and registration is what buys the gain over default buffers at small blocks. That is a null result on the interesting axis, and reporting it as such is the right call. Profile data supports the mechanism: at 4k, per-IO mapping cost is lowest for dma-buf buffers (~0.5% of samples in the unmap and dma-buf setup paths), ~1.3% for registered host buffers across three map/unmap functions, and default buffers add page-pinning work on top of that.

The practical reading: the win from this path is not throughput. It is that the data lands where the accelerator already wants it, saving a host copy and the host memory to stage it in. Any capacity plan that budgets a throughput gain from GPU-direct storage is budgeting the wrong thing.

The two costs the announcement does not mention

Polled IO is off the table. The kernel does not permit polled IO with dma-buf buffers, so the high-priority path cannot be used to eliminate interrupts — and interrupt entry is about a third of the profile samples in this environment. On the same device, 4k random read at queue depth 128 with one job:

ConfigurationIOPS
GPU-memory dma-buf267k
GPU-memory dma-buf + NVMe interrupt coalescing (100 µs, 8 entries)378k
Registered host buffers with polling, for comparison552k

That is a 2.07x gap against the polled host-buffer configuration, on identical hardware. Interrupt coalescing recovers part of it (1.42x) and is the available mitigation today. If your workload is small-block and latency-sensitive and you were going to reach for polling, this path currently costs you that option.

Verification through GPU memory is ~6.8x slower. A 2 GiB CRC-checked read-back runs at 735 MiB/s through GPU memory against 4,995 MiB/s through host buffers. That is the shadow-buffer copy, and it sits outside the completion latencies — so it does not distort the latency numbers, and it does mean any data-integrity run over this path takes nearly seven times as long.

The caveat that should change how you report results

From the submission's own notes for reviewers: whether the IO is peer-to-peer is decided by the GPU driver when the buffer is registered. If the NVMe device cannot reach the GPU's memory, the driver maps the buffer from system memory instead — and the IO still works. Userspace cannot tell.

That is a silent fallback with no error and no flag, on the one property the whole exercise is about. A deployment can believe it is doing peer-to-peer transfers and be bouncing through host memory, with nothing in the application's view distinguishing the two. It is exactly why the four-signal verification above is not over-engineering: the kernel-side evidence is the only way to know which path you got.

Generalise it: when a performance feature degrades gracefully and invisibly, graceful degradation becomes a correctness problem for measurement. Anything that silently falls back needs an out-of-band check in your monitoring, not just a successful return code.

Review checklist

  1. Do not budget throughput. Expect parity with registered host buffers; the gain is the avoided host copy and staging memory.

  2. Verify the path out of band — kernel peer-to-peer distance, the mapped bus address against the VRAM aperture, and the device's own command and byte counters. The fallback is silent.

  3. Check whether you need polled IO. It is unavailable here; budget the gap, and evaluate interrupt coalescing as the mitigation.

  4. Separate integrity runs from performance runs. Verification over this path is several times slower by construction.

  5. Confirm the registration shape. One attachment per file, not per queue-depth entry; a per-entry registration is a kernel-side cost multiplier.

  6. Mind the buffer constraints: page-size multiple, under 4 GiB, block devices only.

  7. Treat it as unmerged and pre-release. The pull request is open and unreviewed; the kernel it targets is pre-release and its feature semantics can still change.

  8. Watch the vendor-exclusivity question. Today one accelerator vendor has an exporter; the interface permits others, but "any accelerator with dma-buf exporter code" is a statement about what is possible, not about what exists.

Where the evidence stops

Every measurement was taken inside a virtual machine with the devices passed through — no bare-metal run — and the emulated-device runs needed a local driver fix to initialise at all, which the author flags as unrelated to the benchmark but which is still a non-stock kernel. Integration with the inference-side consumers (cache-offload libraries and serving engines) is stated as intent, with nothing published yet. None of this is hidden; all of it is in the submission's own text, which is the strongest thing about it.

Connections

See R450 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.