io_uring + DMA-BUF · Weight loading · Updated 24 November 2026

Which read sizes weight loading produces

No loader we traced asks the kernel for tensor-sized reads. vLLM's default reader maps each file and lets kernel readahead read it in 128 KiB commands. fastsafetensors' nogds reader asks for 516 KiB at a time, which reaches the drive as four 128 KiB commands and one 4 KiB command. Our DMA-BUF copier asks for 64 MiB at a time, straight into GPU memory, and the drive gets 2 MiB commands. Tensor sizes matter when a loader reads only part of a model, such as one expert of a mixture-of-experts layer: current MoE checkpoints store experts as 2 to 16 MiB tensors, and some store an expert's scales far from its weights, which adds a read of a few KiB.

Three sizes in one load

A weight load has three different read sizes, and each layer of the stack can change the size it receives. The tensor size is set by the checkpoint file: how big each tensor is and where it sits. The intent size is what the loader asks the kernel for: its read calls, its memory mappings and its io_uring requests. The command size is what reaches the drive: the NVMe read commands, after the page cache, readahead and the block layer have split or merged the loader's requests. We recorded all three for each load with the tracers of the ebpf-syscall project and one bpftrace script.

CheckpointTensor and expert sizes and offsets, read from the safetensors headers
Loader intentRead calls and their sizes (syscall_monitor), page faults and readahead (mmap_readamp), io_uring request sizes (bpftrace)
KernelPage cache and readahead, or io_uring DMA-BUF straight into GPU memory; the block layer splits at the command limit
DriveEach NVMe command and its size (nvme_tp_monitor)

On the drive used here, a normal read command carries at most 128 KiB and a DMA-BUF read command at most 2 MiB. The kernel splits any larger request at that limit.

How checkpoints store their bytes

We read every safetensors header of ten open checkpoints, from a 0.6-billion-parameter dense model to a 2.4-trillion-parameter mixture-of-experts (MoE) model: 836 files and 954,042 tensors. No weights were needed for this part. The chart shows, for each checkpoint, the share of its bytes held in tensors of each size.

< 1 MiB1-4 MiB4-16 MiB16-64 MiB64-256 MiB256 MiB-1 GiB1 GiB +
Where checkpoint bytes are, by tensor size For each checkpoint, a bar split by the share of its bytes held in tensors of each size class. Qwen3-0.6Bdense BF16 Qwen3-0.6B: 0.0% of bytes in < 1 MiB tensors Qwen3-0.6B: 7.8% of bytes in 1-4 MiB tensors 8% Qwen3-0.6B: 50.8% of bytes in 4-16 MiB tensors 51% Qwen3-0.6B: 41.4% of bytes in 256 MiB-1 GiB tensors 41% Qwen2.5-7Bdense BF16 Qwen2.5-7B: 0.0% of bytes in < 1 MiB tensors Qwen2.5-7B: 1.3% of bytes in 1-4 MiB tensors Qwen2.5-7B: 9.4% of bytes in 16-64 MiB tensors 9% Qwen2.5-7B: 74.9% of bytes in 64-256 MiB tensors 75% Qwen2.5-7B: 14.3% of bytes in 1 GiB + tensors 14% Qwen2.5-7B AWQdense INT4 (AWQ) Qwen2.5-7B AWQ: 1.6% of bytes in < 1 MiB tensors Qwen2.5-7B AWQ: 1.6% of bytes in 1-4 MiB tensors Qwen2.5-7B AWQ: 6.5% of bytes in 4-16 MiB tensors 6% Qwen2.5-7B AWQ: 51.2% of bytes in 16-64 MiB tensors 51% Qwen2.5-7B AWQ: 39.1% of bytes in 1 GiB + tensors 39% Llama-3.1-405Bdense BF16 Llama-3.1-405B: 0.0% of bytes in < 1 MiB tensors Llama-3.1-405B: 1.0% of bytes in 16-64 MiB tensors Llama-3.1-405B: 16.7% of bytes in 256 MiB-1 GiB tensors 17% Llama-3.1-405B: 82.3% of bytes in 1 GiB + tensors 82% Qwen3-Next-80BMoE BF16 Qwen3-Next-80B: 0.0% of bytes in < 1 MiB tensors Qwen3-Next-80B: 97.3% of bytes in 1-4 MiB tensors 97% Qwen3-Next-80B: 1.9% of bytes in 16-64 MiB tensors Qwen3-Next-80B: 0.8% of bytes in 256 MiB-1 GiB tensors DeepSeek-V3MoE FP8 DeepSeek-V3: 0.0% of bytes in < 1 MiB tensors DeepSeek-V3: 0.1% of bytes in 1-4 MiB tensors DeepSeek-V3: 97.1% of bytes in 4-16 MiB tensors 97% DeepSeek-V3: 0.5% of bytes in 16-64 MiB tensors DeepSeek-V3: 1.3% of bytes in 64-256 MiB tensors DeepSeek-V3: 1.1% of bytes in 1 GiB + tensors Kimi-K2MoE FP8 Kimi-K2: 0.0% of bytes in < 1 MiB tensors Kimi-K2: 0.0% of bytes in 1-4 MiB tensors Kimi-K2: 99.0% of bytes in 4-16 MiB tensors 99% Kimi-K2: 0.5% of bytes in 16-64 MiB tensors Kimi-K2: 0.0% of bytes in 64-256 MiB tensors Kimi-K2: 0.5% of bytes in 1 GiB + tensors DeepSeek-V4-ProMoE FP4 DeepSeek-V4-Pro: 5.7% of bytes in < 1 MiB tensors 6% DeepSeek-V4-Pro: 0.1% of bytes in 1-4 MiB tensors DeepSeek-V4-Pro: 91.3% of bytes in 4-16 MiB tensors 91% DeepSeek-V4-Pro: 0.5% of bytes in 16-64 MiB tensors DeepSeek-V4-Pro: 2.0% of bytes in 64-256 MiB tensors DeepSeek-V4-Pro: 0.4% of bytes in 1 GiB + tensors Kimi-K3MoE packed 4-bit Kimi-K3: 5.5% of bytes in < 1 MiB tensors 5% Kimi-K3: 0.0% of bytes in 1-4 MiB tensors Kimi-K3: 87.4% of bytes in 4-16 MiB tensors 87% Kimi-K3: 0.8% of bytes in 16-64 MiB tensors Kimi-K3: 6.0% of bytes in 64-256 MiB tensors 6% Kimi-K3: 0.1% of bytes in 256 MiB-1 GiB tensors Kimi-K3: 0.3% of bytes in 1 GiB + tensors Qwen3.8-2.4TMoE BF16, fused experts Qwen3.8-2.4T: 0.0% of bytes in < 1 MiB tensors Qwen3.8-2.4T: 0.0% of bytes in 1-4 MiB tensors Qwen3.8-2.4T: 0.0% of bytes in 4-16 MiB tensors Qwen3.8-2.4T: 0.2% of bytes in 16-64 MiB tensors Qwen3.8-2.4T: 1.6% of bytes in 256 MiB-1 GiB tensors Qwen3.8-2.4T: 98.1% of bytes in 1 GiB + tensors 98%
Tensors and routed-expert units per checkpoint, from the safetensors headers
CheckpointTypeTensorsSizeTensors under 1 MiBOne routed expert
Qwen3-0.6Bdense BF163111.4 GiB36%-
Qwen2.5-7Bdense BF1633914.2 GiB42%-
Qwen2.5-7B AWQdense INT4 (AWQ)7315.2 GiB69%-
Llama-3.1-405Bdense BF161,137756 GiB22%-
Qwen3-Next-80BMoE BF1675,944151 GiB0%6 MiB (95% of bytes); 1 extent: 15,071, 2 extents: 9,505
DeepSeek-V3MoE FP891,991641 GiB50%42.0 MiB (97% of bytes); 1 extent: 14,951, 2 extents: 153
Kimi-K2MoE FP8139,644958 GiB50%42.0 MiB (99% of bytes); 2 extents: 23,040
DeepSeek-V4-ProMoE FP4145,116805 GiB50%33.5 MiB (95% of bytes); 2 extents: 23,424
Kimi-K3MoE packed 4-bit497,2201.4 TiB50%16.7 MiB (93% of bytes); 1 extent: 82,432
Qwen3.8-2.4TMoE BF16, fused experts1,6094.4 TiB38%96 MiB slab inside fused 3-D tensors

Dense checkpoints keep their bytes in a few large tensors. In Qwen2.5-7B, 89% of the bytes are in tensors of 128 MiB or more. In Llama-3.1-405B, 81% are in tensors of 1 to 2 GiB. Most current MoE checkpoints are the opposite: 87 to 99% of their bytes are in the routed experts, which are stored as separate tensors of 2 to 16 MiB. One expert is 6 MiB (Qwen3-Next) to 42 MiB (DeepSeek-V3 and Kimi-K2 in FP8). Lower precision makes the expert tensors smaller and adds a scale tensor for each weight tensor, so in the FP8 and FP4 checkpoints half of all tensors are scales. The scales hold at most 6% of the bytes. Qwen3.8-2.4T is the exception: it stores all experts of a layer as two fused tensors of 16 and 32 GiB, but one expert is still a contiguous 96 MiB slab inside them.

Where an expert sits matters when a loader reads only some experts. In Kimi-K2 and DeepSeek-V4-Pro every expert is in two places. The safetensors writer groups tensors by data type, so each file holds all its scale tensors together, away from the weights. Fetching one Kimi-K2 expert is one 42 MiB read plus one 10.5 KiB read up to 15 GB away in the same file. In DeepSeek-V4-Pro it is one 31.5 MiB read plus one 2 MiB read. In Qwen3-Next, 9,505 of 24,576 experts are split across two files. In every checkpoint, the tensor data starts off a 4 KiB boundary for more than 99.99% of the bytes, because the data section begins right after a header of arbitrary length.

What loaders ask for

No loader we traced asks the kernel for tensor-sized reads. The loader, not the tensor layout, sets the intent size of a full load. We traced three loaders on four checkpoints that we have in full: two dense BF16 models, an INT4 AWQ model and a 27 GB MoE model (EMO 1b14b, 128 experts per layer). Each load started with an empty page cache, and every tensor was checked against a SHA-256 of the file bytes. All 40 loads matched.

Full loads: what each loader asks for and what reaches the drive. The intent and command columns are from the first load; the second matches.
CheckpointLoaderLoad time (s), two cold loadsWhat the loader asks forNVMe read commandsDrive bytes over loaded bytes
Qwen3-0.6B (1.5 GB)vLLM default (safetensors, mmap)1.06, 1.02no read calls; maps each shard, 0 page faults; readahead fills 1.50 GB11,512: 11,479 of 128 KiB+0.2%
Qwen3-0.6B (1.5 GB)fastsafetensors nogds0.245, 0.2482,870 pread64 calls; 2,867 of 516 KiB14,369: 11,477 of 128 KiB, 2,879 of 16 KiB or less+0.9%
Qwen3-0.6B (1.5 GB)DMA-BUF copier0.225, 0.22523 io_uring reads into GPU memory; 22 of 64 MiB, the rest shorter shard tails748: 716 of 2 MiB+0.1%
Qwen2.5-7B (15.2 GB)vLLM default (safetensors, mmap)8.82, 8.83no read calls; maps each shard, 1 page fault; readahead fills 15.23 GB116,256: 116,208 of 128 KiB+0.0%
Qwen2.5-7B (15.2 GB)fastsafetensors nogds2.30, 2.2829,062 pread64 calls; 29,050 of 516 KiB145,291: 116,212 of 128 KiB, 29,062 of 16 KiB or less+0.8%
Qwen2.5-7B (15.2 GB)DMA-BUF copier2.15, 2.14228 io_uring reads into GPU memory; 224 of 64 MiB, the rest shorter shard tails7,332: 7,260 of 2 MiB+0.0%
Qwen2.5-7B AWQ (5.6 GB)vLLM default (safetensors, mmap)3.60, 3.61no read calls; maps each shard, 604 page faults; readahead fills 5.57 GB42,709: 42,376 of 128 KiB+0.0%
Qwen2.5-7B AWQ (5.6 GB)fastsafetensors nogds0.839, 0.83910,630 pread64 calls; 10,624 of 516 KiB53,160: 42,508 of 128 KiB, 10,636 of 16 KiB or less+0.8%
Qwen2.5-7B AWQ (5.6 GB)DMA-BUF copier0.818, 0.78884 io_uring reads into GPU memory; 82 of 64 MiB, the rest shorter shard tails2,688: 2,655 of 2 MiB+0.0%
EMO 1b14b MoE (27.1 GB)vLLM default (safetensors, mmap)20.29, 20.44no read calls; maps each shard, 32 page faults; readahead fills 27.14 GB207,392: 206,993 of 128 KiB+0.0%
EMO 1b14b MoE (27.1 GB)fastsafetensors nogds4.00, 4.0851,793 pread64 calls; 51,760 of 516 KiB258,852: 207,044 of 128 KiB, 51,786 of 16 KiB or less+0.8%
EMO 1b14b MoE (27.1 GB)DMA-BUF copier3.82, 3.84413 io_uring reads into GPU memory; 402 of 64 MiB, the rest shorter shard tails12,983: 12,931 of 2 MiB+0.0%

vLLM's default reader

vLLM's default loader opens each shard with the safetensors library and calls get_tensor() for every tensor. We ran the same calls outside vLLM. The library maps the shard into memory and makes no read call on it. Copying a tensor out of the mapping touches its pages. The kernel's readahead then reads the whole file ahead of the copy, so the tracer counted only 0 to 604 page faults per load. The drive gets 128 KiB commands, the largest normal command, and reads the file once. This path is about 4 to 5 times slower than the other two here. We did not profile why.

fastsafetensors nogds

The nogds reader reads each shard with pread64 calls of 516 KiB into a host buffer, then copies the buffer to the GPU. Each call is 512 KiB of data plus 4 KiB for alignment. The drive gets four 128 KiB commands and one 4 KiB command for each call. These 4 KiB commands are 20% of all its commands, and they make the drive read 0.8 to 0.9% more bytes than the files hold. This is the only place in a full load where we saw many small commands, and they come from the reader's alignment, not from the tensors.

The DMA-BUF copier

The copier issues io_uring READ_FIXED requests of 64 MiB straight into GPU memory, with a shorter request at the end of each shard. The kernel splits each request into 2 MiB NVMe commands, the largest DMA-BUF command on this drive. For the 15.2 GB model that is 228 requests and 7,260 commands of 2 MiB, against 145,291 commands for nogds. The drive reads the file bytes to within 0.1%. Its only read calls are the 8-byte header length and the JSON header of each shard (9 to 72 KiB). The larger commands are why the copier is the fastest loader here; the weight-loading page explains this with drive rates.

Fetching experts

An MoE server that keeps experts on NVMe reads only the experts a request needs. That is where tensor size becomes intent size. In EMO 1b14b one expert is three 4 MiB tensors, stored next to each other. We fetched one expert and eight experts of one layer, once through safetensors and once with one pread per tensor.

Fetching routed experts of one layer (12 MiB each: three 4 MiB tensors)
CheckpointLoaderLoad time (s), two cold loadsWhat the loader asks forNVMe read commandsDrive bytes over loaded bytes
EMO 1b14b MoE (27.1 GB)1 expert, safetensors (mmap)0.019, 0.017no read calls; maps the shard, 1 page fault; readahead fills 14.5 MB142: 111 of 128 KiB, 13 of 16 KiB or less+25.4%
EMO 1b14b MoE (27.1 GB)8 experts, safetensors (mmap)0.087, 0.085no read calls; maps the shard, 7 page faults; readahead fills 106.1 MB844: 801 of 128 KiB+6.6%
EMO 1b14b MoE (27.1 GB)1 expert, one pread per tensor0.015, 0.0153 pread64 calls; 3 of 4 MiB117: 100 of 128 KiB, 6 of 16 KiB or less+10.0%
EMO 1b14b MoE (27.1 GB)8 experts, one pread per tensor0.094, 0.09824 pread64 calls; 24 of 4 MiB801: 772 of 128 KiB+2.3%

With one pread per tensor, the loader asks for 4 MiB at a time, and the drive gets 128 KiB commands through the page cache. Readahead reads past the end of what was asked: 10% extra for one expert, 2% for eight. Through safetensors the extra is 25% for one expert and 7% for eight. At these sizes the drive gets no command smaller than 128 KiB apart from a few at the edges.

Two cases in the larger checkpoints would produce smaller reads. A fetch of one Kimi-K2 expert includes a 10.5 KiB scale read. Qwen3-Next stores 2 MiB expert tensors, so a reader that reads one tensor at a time asks for 2 MiB. We did not trace those checkpoints, because we have only their headers. We have also not traced an expert fetch through the DMA-BUF copier. With it, one expert would be one io_uring read into GPU memory, split into 2 MiB commands.

Software and kernel

What the measurements used
PartVersionWhat it does here
fastsafetensors2026-10-28-iouring-dma-buf at eb7ec8fOur branch adds the DMA-BUF copier. It exports GPU memory as a DMA-BUF, registers it with io_uring as a fixed buffer, and reads each shard into it with READ_FIXED. Without kernel support it falls back to nogds. The same branch provides the nogds reader.
Linux kernel2026-11-06-dmabuf-io-async-release at a7c2fb31The io_uring DMA-BUF series queued for Linux 7.4, the XFS support RFC, ext4 support, patches that let DMA-BUF reads use the drive's largest command (max_hw_dmabuf_sectors_kb, 2 MiB here), and a fix that releases a DMA-BUF registration without waiting about 14 ms. See kernel requirements.
Tracersebpf-syscall: syscall_monitor, mmap_readamp, nvme_tp_monitor; bpftrace 0.27Loader calls with requested sizes, page faults and readahead fills, NVMe commands. The bpftrace script records io_uring setup, registrations and the size of each request.
Python stackPython 3.12, PyTorch 2.9.1 for ROCm 6.4.3, safetensors 0.8.0The loaders.
GPUAMD RDNA3 workstation GPU, 48 GB, PCIe Gen4 x16The load target.
Drive and file systemOne PCIe Gen4 x4 NVMe SSD, 4 TB class, 512-byte logical blocks, 128 KiB normal command limit, 2 MiB DMA-BUF command limit; XFSHolds the checkpoints.

Reproduce

The scripts are in knlp's scripts/weight_io. You need the kernel branch above for the DMA-BUF loader, a built ebpf-syscall tree, bpftrace, and sudo for the tracers. The loaders run as your user. Put the fastsafetensors branch on PYTHONPATH:

git clone -b 2026-10-28-iouring-dma-buf https://github.com/mcgrof/fastsafetensors
export PYTHONPATH=$PWD/fastsafetensors
python3 scripts/weight_io/trace_intent.py --tools ~/ebpf-syscall --disk nvme0n1 \
    --model qwen2.5-7b=/models/Qwen2.5-7B-Instruct \
    --model moe=/models/my-moe --moe moe --out /data/intent
python3 scripts/weight_io/analyze_intent.py /data/intent > intent_summary.json

--moe adds the expert fetches for that model; --layer, --experts-1 and --experts-8 choose the layer and the experts. --disk names the block device that holds the models, so the NVMe tracer watches the right drive. For the checkpoint layout, the inventory stage of the weight-loading I/O workflow (make defconfig-weight-io-inventory && make) reads the shard headers over HTTP without downloading weights, and inventory_sizes.py turns its inventory.jsonl into the size classes and expert units shown above.

Limits

← Weight loadingTensor alignment →