Repository navigation
Conversation
…h the Direct reader The strata-poly Qwen4 mapped shard 2's 11-22 GB PLE table whole into host RAM. Its rows now come straight off the disk through strata::ngram::PleReader - the same Direct reader the Flash Next engine runs for its own n-gram PLE: unbuffered O_DIRECT reads, a 1M-row (~100 MB) row cache, the keep-alive that keeps the SSD awake, issued once per step over the step's whole row set and reaped in the existing begin_step prefetch slot, dequantized from pinned raw bytes into the h_ple_emb_ staging the kernels already consume. --ple-mmap asks for the old whole-file map; a file whose table the reader cannot open (or Metal, whose unified-memory gathers read the map with no copy) falls back to it. The destructor reports the reader's rows-asked/cache-hits/SSD-reads/collect-wait snapshot, as Flash Next reports its own. Verified on a Linux CUDA box with Qwen4-35B-A3B UD-Q5_K_M: a 256-token greedy run is byte-identical to llama.cpp's reference output (1249/1249 chars), 4272 rows asked, 2880 row cache hits, 1392 SSD reads, 41.5 ms total collect wait across load + prefill + 256 tokens; builds clean for the CUDA target.
On Linux DirectFile issues its reads from a pool of threads, each doing one blocking O_DIRECT pread, so the pool size is the queue depth: 16 by default, sized for the Flash Next decode's 16 rows a token. A Qwen4 prompt call asks for 16 rows a token too, 16,384 for a 1,024-token call, and they were read 16 at a time while the card waited at the PLE layer. DirectFile::open() and PleReader::open() take an optional thread count now (0: the default as before; STRATA_IO_THREADS still overrides it, and Windows, whose threads only submit overlapped reads, ignores it), and Qwen4 opens its table with 64. Everything else keeps its 16. RTX 4060 Laptop 8 GB, RS1D0TSSD710 NVMe, UD-IQ4_XS, --kv q8_0, frozen experts, 2 runs each: 2,048 tokens 1,029.3 / 1,022.9 tokens/s against 989.2 / 989.9 (the reader's collect wait 194 against 268 ms), 6,000 tokens 1,125.0 / 1,124.9 against 1,086.5 / 1,086.3 (317 against 493 ms), the same tokens. Decode unchanged: 82.03 +- 3.00 against 82.27 +- 2.84 tokens/s (6 interleaved runs, 400 tokens). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018j62UGHq9crCFFy7fHrCcW
Collaborator
|
Thank you for the PR! We are closing this because it modifies 4 shared upstream strata core files (direct_file., ple_reader.), largely overlaps with #465, and STRATA_IO_THREADS=64 is already available. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and result
On Linux
DirectFileissues reads from a pool of threads, each doing one blockingO_DIRECTpread, so the pool size is the queue depth: 16 by default (io_threads(16)), sized for the Flash Next decode's 16 n-gram rows a token. Qwen4's PLE needs 16 rows a token too, which is 16,384 rows for a 1,024-token prompt call, and with PR #440 those were read 16 at a time while the card waited at the PLE layer. WithSTRATA_IO_THREADSset by hand, 64 read a 2,048-token prompt 3.5% faster on my laptop and 128 no faster than 64.Now
DirectFile::open()andPleReader::open()take an optional thread count, and Qwen4 opens its table with 64. On the laptop below: 2,048 tokens 1,029.3 / 1,022.9 tokens/s against 989.2 / 989.9 (the reader's collect wait 194 against 268 ms), 6,000 tokens 1,125.0 / 1,124.9 against 1,086.5 / 1,086.3 (317 against 493 ms). Decode is unchanged.Related discussion
PR #440 (the Direct PLE reader). No issue.
Approach
DirectFile::open(path, err, threads = 0): on Linux and macOS the pool isio_threads(threads > 0 ? threads : 16), soSTRATA_IO_THREADSstill overrides it and the clamp to 1..64 stays; on Windows, whose threads only submit overlapped reads, the parameter is ignored.PleReader::open(..., read_threads = 0)passes it on.Qwen4: 64 for its PLE table.Validation
Revision
76e2adafb. RTX 4060 Laptop GPU 8 GB, i9-12900H, 30 GB RAM, NVMe RS1D0TSSD710, Linux, CUDA 13.4; Qwen4-35B-A3B UD-IQ4_XS (pinned742bc191),--kv q8_0 --max-context 8192.Passed:
STRATA_FREEZE_EXPERTS=1 --expert-swaps 0), 2 runs each, numbers above; the same tokens in every pair (c50e2dbf,512f5519).strata-polybuilds; the Flash Nextstratatarget builds with the changeddirect_file.cppandple_reader.cpp(see Not run if it did not finish).Failed:
Not run:
Limits
🤖 Generated with Claude Code