mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1516] [CLOSED] PLE: a prompt chunk's rows through 8 batch readers (a 32K chunk -3%, the same rows) #3502
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3502
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1516
Author: @sergqwer
Created: 10/8/2026
Status: ❌ Closed
Base:
main← Head:pr/ple-batch-readers📝 Commits (1)
8da3610PLE: a prompt chunk's rows through 8 batch readers, each with its own handle and completion port (the same rows)📊 Changes
8 files changed (+447 additions, -5 deletions)
View changed files
📝
include/strata/kernels/ngram.hpp(+3 -0)📝
include/strata/ngram/ple_reader.hpp(+14 -0)📝
include/strata/platform/direct_file.hpp(+4 -0)📝
src/kernels/ngram.cpp(+27 -0)📝
src/ngram/ple_reader.cpp(+329 -0)📝
src/ngram/ple_reader_test.cpp(+36 -0)📝
src/platform/direct_file.cpp(+23 -4)📝
src/prefill/prefill.cpp(+11 -1)📄 Description
With
--ple-io direct(the default) a prompt chunk's PLE rows are one batched request toPleReader: one worker thread submits the page reads and reaps every completion. A 32K prompt reads ~213K pages of the n-gram table. In 8192-token chunks (the default--prefill auto) that read hides behind layer 0 and the chunk before. In one 32768-token chunk (--prefill auto:32768, #282) it does not, and layer 1 waits for it:The SSD is not the limit. One thread reaping every completion is. On top of that come the job building before the first read and 8 KiB reads for rows that cross a page boundary.
Change:
PleReader::read_batchserves a prompt chunk's rows (256+ tokens, Direct mode only).STRATA_PLE_READERS, 0 = the old path; default 0 on POSIX) each keep 32 reads in flight on their own handle and completion port (DirectFilegets aninline_submitmode).gather_batchdecodes the rows that have landed while the rest are read.STRATA_PLE_TRACE=1prints, per chunk, when its read started, when layer 1 asked for the rows, and how long it waited.ple_reader_test --selftest:check_batchwith 3 / 1 / 0 readers, rows across pages, duplicates, the table's edges, and a repeat served from the row cache. It passes with row sizes 90 and 110.Identity (first-token logits, sha256,
--expert-cache 12000 --pcie-frac 0.25,d5ea7133vs this branch):d5ea7133--prefill auto:32768Every A/B run below had the same logits within its prompt as well.
A/B on current main: RTX 5090, Ryzen 9 9950X3D, Samsung 9100 PRO, IQ2_XS,
--expert-cache 12000 --pcie-frac 0.25 --vram-reserve-mib 1500, interleaved pairs, order alternating. The prompt times are from the engine'sprefill N tokens ... msline. "Wait at layer 1" is thePLEfigure of the same line.d5ea7133auto:32768)auto)auto)With 8192-token chunks the trace shows 0.0 ms waited at every chunk: the read was already done. So the default gains nothing on this machine. The gain is for prompts read in large chunks:
auto:32768/auto:16384, or a GPU whose layer 0 finishes before the read does.Not measured:
auto:16384; Linux (the readers are off there by default:DirectFileon POSIX is a pool of blockingpreads, and an inline reader would be one read at a time); SATA or slower NVMe drives; 96K prompts on IQ2_XS.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.