[PR #2073] [CLOSED] PLE: --ple-io direct stays direct when the start-up probe measures the disk slow (STRATA_PLE_AUTO_MMAP=1 opts into the mmap switch); PLE read diagnostics #3842

Closed
opened 2026-11-07 15:31:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2073
Author: @imanu86
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: pr/ple-direct


📝 Commits (1)

  • 779c858 PLE: --ple-io direct stays direct when the start-up probe measures the disk slow (STRATA_PLE_AUTO_MMAP=1 restores the switch to mmap); PLE read diagnostics for prefill and decode

📊 Changes

7 files changed (+49 additions, -6 deletions)

View changed files

📝 include/strata/core/verify.hpp (+2 -0)
📝 include/strata/ngram/ple_reader.hpp (+2 -0)
📝 src/core/verify.cpp (+4 -0)
📝 src/kernels/ngram.cpp (+5 -1)
📝 src/ngram/ple_reader.cpp (+2 -0)
📝 src/prefill/prefill.cpp (+6 -1)
📝 src/program/generate.cpp (+28 -4)

📄 Description

Title

Issue: none (a start-up default that misfired on a slow SSD, and read diagnostics).

Summary

Since 0.1.42 the engine probes the PLE table at start-up and, under 15,000 rows/s, switches --ple-io direct to
mmap on its own. The probe reads 64 rows a batch from a cold table, a far lower queue depth than a prompt chunk's
batched read, so a healthy SATA SSD can measure "slow" and the switch costs a long prompt more than three times its
time. This change keeps the probe and its warning but makes the switch opt-in (STRATA_PLE_AUTO_MMAP=1); an
explicit --ple-io is untouched. It also adds a few PLE read diagnostics.

Why

Measured on one PC (PLE table on a SATA SSD, 131K-token prompt, two-card layer split): the probe read 1,259 rows/s,
switched to mmap, and the prompt took 260 s; the same engine with direct I/O took 75 s and decode was 3.9%
faster (the mmap mode also drops the row cache and the in-flight reads). mmap faults the rows in one 4 KiB page at a
time; direct I/O keeps --ple-inflight reads in flight and the chunk read-ahead hides them. The probe's figure is a
cold, low-depth read and does not predict the prompt path's throughput.

What changed

  • src/program/generate.cpp: the probe still runs and prints PLE direct read probe: N rows/s; under the threshold it
    warns and keeps direct unless STRATA_PLE_AUTO_MMAP=1 (then it switches as before). With
    STRATA_DECODE_TIMING the decode summary adds the primary verifier's PLE gather time per window and the reader's
    cumulative counters before and after the request (strata decode PLE primary/before/after).
  • src/ngram/ple_reader.cpp, include/strata/ngram/ple_reader.hpp: ple io: adds the read mean, the maximum and the
    count of reads over 100 ms (all reads, where p50/p99 cover the last 65,536).
  • src/prefill/prefill.cpp: a chunk that waited more than 1 s for its PLE rows logs one line
    (strata prefill: the chunk at token N waited X ms for its PLE rows).
  • src/kernels/ngram.cpp, include/strata/core/verify.hpp: the gather time counter.

No kernel changes; the output tokens are the same in both I/O modes.

Measurements

RTX 2080 Ti 22 GB + RTX 3060 12 GB, Windows 11, CUDA 12.6, --layer-split 16 --pipeline-windows 2, Qwen3.8-Flash-Next
IQ3_XXS, 131K-token prompt, PLE table on a SATA SSD (cold):

prompt 131K decode (131K, 1024 tokens)
0.1.42 default (probe -> mmap) 260 s reference
direct kept (this change) 75 s +3.9%

With the table on an NVMe the probe says fine (91,220 rows/s here) and nothing changes.

Built and started on v0.1.43 (7695859a, RTX 2080 Ti + RTX 3060 layer split, Windows): the probe reports 43,290 rows/s (fine) on the NVMe, the engine serves as before; the same code has run in this fork's daily build since 0.1.42.

Risks / limits

A disk that really is too slow for direct I/O keeps direct unless STRATA_PLE_AUTO_MMAP=1 is set; the warning says
so and names the variable. --ple-io ram and an explicit --ple-io mmap behave as before.

Part of a series from a public patch registry (stack/ in the fork imanu86/Strata-2080Ti): one lever per PR, each
opt-in or bit-exact, measured on the same two-card box.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2073 **Author:** [@imanu86](https://github.com/imanu86) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/ple-direct` --- ### 📝 Commits (1) - [`779c858`](https://github.com/Niko1221/Strata/commit/779c858a5fe4e899243d77eaec3a7012841e5cb2) PLE: --ple-io direct stays direct when the start-up probe measures the disk slow (STRATA_PLE_AUTO_MMAP=1 restores the switch to mmap); PLE read diagnostics for prefill and decode ### 📊 Changes **7 files changed** (+49 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/verify.hpp` (+2 -0) 📝 `include/strata/ngram/ple_reader.hpp` (+2 -0) 📝 `src/core/verify.cpp` (+4 -0) 📝 `src/kernels/ngram.cpp` (+5 -1) 📝 `src/ngram/ple_reader.cpp` (+2 -0) 📝 `src/prefill/prefill.cpp` (+6 -1) 📝 `src/program/generate.cpp` (+28 -4) </details> ### 📄 Description ## Title Issue: none (a start-up default that misfired on a slow SSD, and read diagnostics). ## Summary Since 0.1.42 the engine probes the PLE table at start-up and, under 15,000 rows/s, switches `--ple-io direct` to `mmap` on its own. The probe reads 64 rows a batch from a cold table, a far lower queue depth than a prompt chunk's batched read, so a healthy SATA SSD can measure "slow" and the switch costs a long prompt more than three times its time. This change keeps the probe and its warning but makes the switch **opt-in** (`STRATA_PLE_AUTO_MMAP=1`); an explicit `--ple-io` is untouched. It also adds a few PLE read diagnostics. ## Why Measured on one PC (PLE table on a SATA SSD, 131K-token prompt, two-card layer split): the probe read **1,259 rows/s**, switched to mmap, and the prompt took **260 s**; the same engine with direct I/O took **75 s** and decode was 3.9% faster (the mmap mode also drops the row cache and the in-flight reads). mmap faults the rows in one 4 KiB page at a time; direct I/O keeps `--ple-inflight` reads in flight and the chunk read-ahead hides them. The probe's figure is a cold, low-depth read and does not predict the prompt path's throughput. ## What changed - `src/program/generate.cpp`: the probe still runs and prints `PLE direct read probe: N rows/s`; under the threshold it warns and **keeps direct** unless `STRATA_PLE_AUTO_MMAP=1` (then it switches as before). With `STRATA_DECODE_TIMING` the decode summary adds the primary verifier's PLE gather time per window and the reader's cumulative counters before and after the request (`strata decode PLE primary/before/after`). - `src/ngram/ple_reader.cpp`, `include/strata/ngram/ple_reader.hpp`: `ple io:` adds the read mean, the maximum and the count of reads over 100 ms (all reads, where p50/p99 cover the last 65,536). - `src/prefill/prefill.cpp`: a chunk that waited more than 1 s for its PLE rows logs one line (`strata prefill: the chunk at token N waited X ms for its PLE rows`). - `src/kernels/ngram.cpp`, `include/strata/core/verify.hpp`: the gather time counter. No kernel changes; the output tokens are the same in both I/O modes. ## Measurements RTX 2080 Ti 22 GB + RTX 3060 12 GB, Windows 11, CUDA 12.6, `--layer-split 16 --pipeline-windows 2`, Qwen3.8-Flash-Next IQ3_XXS, 131K-token prompt, PLE table on a SATA SSD (cold): | | prompt 131K | decode (131K, 1024 tokens) | |---|---|---| | 0.1.42 default (probe -> mmap) | 260 s | reference | | direct kept (this change) | **75 s** | **+3.9%** | With the table on an NVMe the probe says `fine` (91,220 rows/s here) and nothing changes. Built and started on v0.1.43 (`7695859a`, RTX 2080 Ti + RTX 3060 layer split, Windows): the probe reports `43,290 rows/s (fine)` on the NVMe, the engine serves as before; the same code has run in this fork's daily build since 0.1.42. ## Risks / limits A disk that really is too slow for direct I/O keeps direct unless `STRATA_PLE_AUTO_MMAP=1` is set; the warning says so and names the variable. `--ple-io ram` and an explicit `--ple-io mmap` behave as before. Part of a series from a public patch registry (`stack/` in the fork imanu86/Strata-2080Ti): one lever per PR, each opt-in or bit-exact, measured on the same two-card box. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:31:08 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3842
No description provided.