mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4170] [Engine] dsv41 0.1.51: decode on fresh prompts waits on serial store reads (disk queue < 0.4 on a 990 Pro); DS4_AHEAD=1 is 10% slower (RTX 5090, Windows) #1830
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#1830
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?
Originally created by @Guilzx9r on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4170
All numbers measured on my machine unless marked "derived" (computed from measured counters).
Setup
strata-dsv410.1.51, build562a0c2ed716+dsv41+cuda13.0, NVIDIA driver 617.42, Windows 11.ist-das-2.25bpw, context 256k.--set reserve-mib=8192 --set ssd-cache=96 --speed faster(experts 5).RAM store: up to 8436 slots of 11.4 MB (96.0 GB), policy 0, 8 reader threads, unbuffered readsRAM store: 8180 of the profile's hottest experts read in (74.8 GB) in 12.8 s13906 routed experts on the CPU lane (135.3 GB, in place in the model's files), 8 threadsCUDA0 … experts 14.53 GB (1454 of 15360 in VRAM)Observation
On repeated prompts decode runs at about 25 tok/s; on never-seen prompts it drops to about 15 tok/s. That second case is what an agent workload (Hermes) actually sees. During the slow case the SSD is far from busy.
Method:
Derived
What is not the limit (measured)
RAM bandwidth.
PCIe 4.0 x16 (GPU).
nvidia-smi dmonduring decode: host→GPU 0.33 GB/s mean (1.3 GB/s peak), about 1–4% of the link, warm and fresh alike. Only a 13.7k-token prompt read uses it heavily: 13.3 GB/s mean, peaks 26–33 GB/s.GPU power. Power limit 400 W: decode draws 142–171 W at 2931 MHz, with no power, thermal or hardware throttling.
More store reader threads. With queue < 0.4 the 8 store readers are mostly idle. I did not test
DS4_STORE_THREADS> 8 for that reason.Router lookahead into the store (
DS4_AHEAD=1, A/B/A, environment of the test process only):DS4_AHEAD=1init_store()("measured 4.5 against 4.7 tok/s… DS4_AHEAD=1 turns them on"). Keeping it off is right here too.Question
On a miss, the decode path seems to wait on the store reads of a layer about one at a time: queue 0.26–0.38 while the drive can sustain 4–6 GB/s at queue about 2.
st.ahead_*counters (ahead_pf, ahead_hit…) exposed anywhere (log or /metrics)? I could not find where they are printed.I can rerun any of this with a build or a flag you suggest and post the numbers.
@nayuta-yanagisawa commented on GitHub (Oct 27, 2026):
Same here on Linux with 0.2.7 (
5e8a4cca, built locally): RTX 3090 24 GB, Ryzen 7 7700X, 64 GB DDR5, Lexar NM790 on PCIe 4.0, IST-DAS 2.00 bpw,--ssd-cache 40, the store preloaded from an expert profile. Through the server (six fresh prompts, 512 tokens each, four rounds),DS4_AHEAD=1decodes 11.1 tok/s against 13.0 without it (−14%).I measured where the time goes with the engine's own statistics (
strata-dsv41 --ids ... --n 512, greedy, two prompts, two rounds each). The loss has two parts.cpu_expertstakes thehold.wait_all()path whenever it is given an order (ord != nullptr, since6fcde7e3), and the lookahead passes one unlessDS4_AHEAD_ORDER=0. So the miss split, which computes the RAM hits while the misses load, never runs. This is about two thirds of the loss here.DS4_AHEAD=1DS4_AHEAD=1 DS4_AHEAD_ORDER=0DS4_AHEAD=1, guesses made and ordered but not read (a local diagnostic switch)With the order off and three guesses a layer (
DS4_AHEAD_ORDER=0 DS4_AHEAD_EXTRA=-3), the lookahead came out level with it off (78.1 against 79.8 ms, measured alongside). So on this machine it does not pay, and keeping it off with the store is right. Holding the guesses' reads until no demand read is running (a patch I tried) changed little: −11% instead of −13% through the server.On your machine,
DS4_AHEAD=1 DS4_AHEAD_ORDER=0would show whether the first part applies there too.Not tested: Windows, other drives, store sizes other than 40 GB, the rank skips. I can attach the individual runs and logs.
@StackArc3 commented on GitHub (Oct 30, 2026):
Same engine on a smaller card, Windows, and a different regime from the one in the opening post: here the store reads were bandwidth-bound, not serial. The wait sat at the ceiling of the drive's PCIe link, and moving the drive to a faster slot halved it. All numbers measured on my machine unless marked derived.
Setup
strata-dsv41built from source atdfbd8342(v0.2.7.1 plus the six-shard layout commit), CUDA 13.4, Windows 11.ist-das-2.00bpw,--ssd-cache 24, faster mode (5 experts). Engine log:670 of 15360 in VRAM,14690 routed experts on the CPU lane (126.7 GB),RAM store: up to 2336 slots of 10.3 MB (24.0 GB), policy 0, 8 reader threads, unbuffered reads.--ids, 256 greedy tokens, one prompt),DS4_PROF=1, store cold at every start, the same expert profile file copied fresh for every run. Three runs per setting, settings interleaved. Every run kept. The output ids are the same in every run quoted here.The same engine on two links
The board (B550) has one M.2 slot on the CPU at PCIe 4.0 x4 and one on the chipset at 3.0 x4. The model drive was measured in the chipset slot, then moved to the CPU slot and measured again. Same binary, same command, same output hash. Medians of three runs.
Derived: 260.7 MB a token in 87.3 ms is 3.0 GB/s, at the drive's ceiling on the 3.0 link. On the 4.0 link it is 5.7 GB/s, about 80 percent of the new ceiling. The 24 GB store, the 32 GB store and the start-up preload all move 5.7 to 5.8 GB/s on the new link, so the engine's store path now tops out somewhat under the drive. Where the remaining 1.3 GB/s goes I did not profile.
So with 16 GB of VRAM and 30 misses a token the question is bytes a token against link bandwidth, not queue depth. Your 5090 runs with a queue under 0.4 because it misses 5 experts a token; this card misses 30 and keeps the link full. The practical check for anyone on a desktop board: which M.2 slot the model drive is in. Mine had been in the chipset slot.
Your question 1: issuing the pieces together
I tried it. A local opt-in patch (46 lines,
DS4_STORE_SPLIT=<bytes>) cuts each matrix read (about 3 MB, three per expert) into pieces of that size and pushes all the pieces to the reader pool at once, so the NVMe queue holds many reads per miss. Measured on the 3.0 link, cache on, medians of three interleaved runs:Slower at every size. The drive is not the reason: in the drive test, 512 KiB reads reach the same 3,265 MB/s ceiling from 8 threads up. My reading, not profiled: on a saturated link more reads in flight cannot add bandwidth, and the per-piece handling costs. I have not re-run the patch on the 4.0 link, where the balance might be different, and I am not proposing it.
More reader threads do not help on either link.
DS4_STORE_THREADS8, 16, 32 on the 4.0 link: medians 9.54, 9.61, 9.51 tok/s, store wait 42 to 46 ms in all nine runs.Store size
On the 4.0 link,
--ssd-cache 32against 24: 10.63 against 9.53 tok/s, misses 24.1 against 30.3 a token, 207 against 261 MB a token, store wait 35.7 against 45.2 ms. Bytes a token is the lever that still works here.Lookahead
Same sign as both of you.
DS4_AHEAD=1on the 4.0 link, medians of three interleaved rounds: 8.15 against 9.46 tok/s (−14 percent), slower in every round. Misses fall from 30.3 to 13.7 a token, but MB a token rise from 261 to 412 (+58 percent) and the store wait from 45.9 to 62.1 ms. The store line at the end of the run says 8,786 to 8,788 prefetched, 6,051 to 6,053 used, 2,317 given up unused (26 percent) over 256 tokens. The lookahead lines: the guesses a layer before held 73.3 percent of the picks, two layers before 0.0 percent; by the guess's rank, 96, 89, 77, 61 and 44 percent of ranks 1 to 5 were picked. Output ids identical with and without it.On the order switch described above: an earlier batch on this machine, official engine 0.1.52, same pack, 24 GB store, 3.0 link, ran
DS4_AHEAD=1 DS4_AHEAD_ORDER=0against the plain engine, three runs each, interleaved with other settings. With the order off the lookahead still lost: 6.23, 6.28, 6.24 against 7.42, 7.41, 7.42 tok/s (−16 percent), misses 13.1 against 30.4 a token, 397 against 261 MB a token, store wait 104 to 105 against 81 ms. My reading: on a link the reads already fill, thewait_allpath is not what costs; the extra bytes are.DS4_AHEAD=1with the order on was not run on that engine, andDS4_AHEAD_ORDER=0was not run on the source build or the 4.0 link, so the two lookahead results here are not a direct pair.Your question 3: the counters
The engine prints them itself at the end of a direct
strata-dsv41 --ids ... --n Nrun, on standard error, whenever--ssd-cacheis on: thestore:line (hits and misses a token, MB a token, ms waited, prefetched, used, given up unused, slots, evictions, failed reads) and, withDS4_AHEAD=1, twolookahead:lines (share of picks guessed one and two layers before; share picked by the guess's rank). They come fromds4_main.cpparound the decode summary. I did not look for them in the server or/metrics.Not tested
One prompt, one model, one machine, faster mode only. Store sizes other than 24 and 32 GB.
DS4_AHEAD_EXTRA. The lookahead order switch on the 4.0 link. The split patch on the 4.0 link. Linux.@StackArc3 commented on GitHub (Oct 30, 2026):
The piece-size patch on the 4.0 link, at 2 MiB only: median decode 8.00 against 9.59 tok/s, 17 percent lower. Same setup as my comment above, cache on, 24 GB store, three interleaved rounds, figures in run order.
On the 3.0 link the same pair was 6.91 against 6.67 (−3.5 percent). Splitting each matrix read into pieces costs more on the faster link, not less; where the extra wait goes is not profiled. 1 MiB and 512 KiB were not re-run on the 4.0 link.
Output: four of the six runs gave the same output hash as my earlier runs on this link. Baseline round 2 and split round 3 gave one other hash, the same for both; those are the two runs with 31.2 misses. The baseline shows it without the patch. With the expert cache on, this engine's output on this machine varies run to run (six of six identical with
--no-expert-cache, measured in an earlier batch); I did not look into it further here.