mmap down to 9.53 s while lifting decode from 0.89 t/s to 4.50 t/s.
Why it matters: Oversized local MoE checkpoints can now stream off fast NVMe drives on Linux and Windows with zero extra flags and only 64 MiB of pinned memory per device. Yet the automatic 1.2x RAM trigger carries a sharp edge: maintainer testing at 1.42x RAM measured a 31% decode drop versus standard
mmap.
What happened: verified vs. unconfirmed
Streaming giant sparse models off NVMe used to stall between every transfer. Earlier direct I/O work (#33490 by @carmenlok) read a 512 MiB staging block from disk, uploaded it to the GPU, and synchronized before pulling the next chunk.
PR #33698 (authored by @am17an, with Windows unbuffered overlapped ReadFile support added by @ServeurpersoCom) breaks that serial lock. Reads now land in a ring of 32 pinned slots of 2 MiB per device across 8 fixed I/O threads. Each slot uploads the instant its read completes, while a completion event gates slot reuse so the NVMe controller and GPU copy engine run concurrently.
- Confirmed (Primary Source): Pinned staging drops from 512 MiB down to 64 MiB per device, saving precious shared RAM on unified-memory boxes like GB10 and Strix Halo. Direct I/O turns on automatically with no CLI flag whenever mapped host experts exceed 1.2x available memory (
MemAvailableor Linux cgroup v2memory.max, or available physical memory on Windows). Numerical fidelity againstmmaponQwen3.5-35B-A3B Q8_0(--moe-cache-mib 3000, 8 chunks) showed a maximum KLD of5.5e-5and 100% identical top-token output at ubatch 4 and 512. - Still unconfirmed / watchlist: Maintainers have not yet published a broad crossover curve mapping PCIe 4.0 versus PCIe 5.0 NVMe drives against the 1.2x auto-trigger threshold. Three follow-up cleanup items flagged during review—including Windows file-handle reduction and per-thread event reuse—remain open for future commits.
By the numbers
Five independent hardware runs inside PR #33698 show where pipelined direct I/O crushes mmap and where bypassing the OS page cache backfires.
| Hardware & OS | Model & mapped experts | Baseline (mmap or #33490) | b13024 pipelined direct I/O | Outcome |
|---|---|---|---|---|
| DGX Spark (GB10, 121 GB, Linux) | DeepSeek-V4-Flash (156 GB / 137 GiB) | 151.7 s prompt / 0.89 t/s (mmap) |
9.53 s prompt / 4.50 t/s (9.26 s / 4.57 t/s run 2) | Massive cold-cache win |
| RTX PRO 6000 (24 GiB cgroup, QLC 1.5 GiB/s) | Qwen3.8-Flash-Next IQ4_NL (63 GiB) | 32.34 s prompt / 2.46 t/s (#33490) |
20.48 s prompt / 2.50 t/s | Major prefill cut on slow QLC |
| RTX 5060 Ti (32 GB RAM, Win, PCIe 5 SSD) | Qwen3.6-35B-A3B Q8_K_XL (38.5 GB) | 42 t/s prompt / 13.6 t/s decode (mmap) |
130 t/s prompt / 15.2 t/s decode | Prompt triples; decode climbs |
| RTX 5080 (64 GB RAM, Linux) | DSv4.1 (123.00 GiB mapped, 53.63 GiB free) | 4.5 tok/s (1.0-1.6 GB/s reads) |
6 tok/s (2.5-3 GB/s reads) |
Higher read saturation |
| RTX 5060 Ti (16 GB Linux VM, 1.42x RAM) | Qwen3-30B-A3B Q6_K (22.15 GiB mapped) | 106.5 t/s prompt / 22.0 t/s decode | 146.2 t/s prompt (+37%) / 15.2 t/s (-31%) | Prefill up; decode drops 31% |
Look closely at the bottom row. On a 20 GB VM (1.13x ratio), b13024 keeps direct I/O turned off and hits 28.1 t/s decode (forcing it on drops generation to 15.3 t/s). On an 8 GB VM (22.15 / 7.65 GiB), page-cache thrashing wrecks mmap, so direct I/O boosts prompt processing from 42.9 to 140.3 t/s and lifts decode from 11.0 to 15.1 t/s.
At 16 GB (1.42x), the threshold misfires for interactive chat. The Linux page cache still retains enough hot experts under mmap to sustain 22.0 t/s. Bypassing the OS cache with direct I/O gains 37% on prompt prefill (106.5 to 146.2 t/s), yet drags decode down 31% to 15.2 t/s.
What builders should do right now
- Heavy RAM overflow (experts roughly double free RAM or higher): Update straight to
b13024and leave defaults alone. The 8-thread pipelined ring activates automatically, cuts pinned staging from 512 MiB to 64 MiB, and unlocks full NVMe read throughput on both Linux and Windows. - Tight overflow (mapped experts just above 1.2x free RAM, such as 1.42x): Test decode speed with
LLAMA_MOE_CACHE_DIRECT_IO=0. If your workflow prioritizes token generation over cold prompt ingestion on a single NVMe drive, keeping the OS page cache active can preserve roughly 7 t/s of decode speed. - Hardware sizing check: Fast PCIe 5.0 NVMe drives now directly raise MoE prefill throughput when models spill past RAM, as shown by the 42 to 130 t/s Windows jump. Check whether a target MoE checkpoint fits inside unified RAM or hits NVMe streaming using The Benchmarque Can It Run calculator and compare unified-memory local AI systems on the live hardware leaderboard.
@ngxson's documented 31% decode penalty at 1.42x RAM on a single NVMe drive, reviewer notes highlight three unresolved code edges in b13024: Windows currently keeps 3 open handles per model file, allocates and destroys a Windows event on every 2 MiB read, and Linux containers still running legacy cgroup v1 ignore container memory caps and evaluate host MemAvailable instead. Also watch system logs for direct I/O read failed, reading the experts through mmap from now on; contributor @zarbis hit repeated fallbacks on a 64 GB Linux box until clocking down an unstable RAM kit resolved the I/O errors.
- Dec 4, 09:13 AM ET: Contributor
@am17anopens PR #33698 inggml-org/llama.cppbuilding on@carmenlok's #33490 direct I/O base. - Dec 5, 04:46 AM ET:
@ServeurpersoCompushes native WindowsFILE_FLAG_NO_BUFFERING/FILE_FLAG_OVERLAPPEDsupport and posts RTX 5060 Ti PCIe 5 SSD benchmarks. - Dec 5, 01:41 PM ET: Core maintainer
@ngxsonapproves #33698 while documenting the 16 GB (1.42x) 31% decode drop and three follow-up nits. - Dec 5, 10:21 PM ET: PR #33698 merges to master (commit
2ed8d097, +511 / -7 lines across 9 files). - Dec 5, 10:52 PM ET: Official
b13024prebuilt binaries publish for Linux, Windows, macOS, and Android.
2ed8d097), file count, memory ratio (1.2x, 1.42x, 1.13x), and Windows/Linux implementation detail was extracted directly from the live GitHub API payloads for ggml-org/llama.cpp release b13024 and Pull Request #33698 on December 6, 2026. Zero third-party rewrites or unverified forum claims were used.
Quick answers
Does llama.cpp b13024 require a new CLI flag for pipelined direct I/O?
No. Release b13024 removed the earlier --moe-cache-io-threads flag, fixes the reader pool at 8 threads, and enables direct I/O automatically whenever mapped host experts exceed 1.2x available memory.
How can builders disable direct I/O if decode speed drops in b13024?
Set the environment variable LLAMA_MOE_CACHE_DIRECT_IO=0 before launching llama-server or llama-cli. Setting LLAMA_MOE_CACHE_DIRECT_IO=1 forces direct I/O on regardless of available memory.
Why did pinned staging memory drop from 512 MiB to 64 MiB?
Instead of reading a full 512 MiB staging block before synchronizing with the GPU, PR #33698 uses a ring of 32 pinned slots of 2 MiB per device (64 MiB total) so NVMe reads and GPU uploads overlap continuously while saving RAM on unified-memory machines like GB10 and Strix Halo.