mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4875] [Engine] Opt-in data-parallel prompt path for 2-GPU layer splits (nicejunjie's STRATA_DP_PREFILL): 19K-123K prompts read 14-68 % faster on 2x RTX 3090 #2239
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#2239
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 @orochifj on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4875
Area
[Engine]
What do you want to do?
Read long prompts on both cards of a two-GPU layer split. Today a layer split reads a prompt through the layer pipeline. The layer-major walk does not run on our 2x RTX 3090: it logs
no VRAM for a super-chunk, 587 MiB freeeven without batch slots, because the expert cache takes the rest. A dual data-parallel prompt path reads 19K-123K prompts 14-68 % faster on these cards. I'd like to know whether you would take it as an opt-in switch before I prepare a PR.The design is nicejunjie's, from nicejunjie/Strata-rdna3 (MIT,
STRATA_DP_PREFILL=1, built there on 2x RX 7900 XTX). I ported it onto v0.2.9 and run it on 2x RTX 3090. @nicejunjie, the last question below is for you.How it works
STRATA_DP_MIN), or one the plan cannot split that way, goes to the layer pipeline as today.Measured on v0.2.9 (
c62d5e3a, engine 0.1.55) built from source for sm_86 with local changes: the int8 IQ4 kernel from #4871 and a block-score kernel change are on in both arms. The only difference between the arms isSTRATA_DP_PREFILL=1.--max-context 524288 --rope-scaling yarn --rope-scale 2 --kv int8 --kv-resident 32768 --spec 4 --spec-min-p 0.5 --pipeline-windows 2 --pcie-frac 0 --prefill auto --expert-cache auto, envSTRATA_KV_HOST_DMA=1 STRATA_PREFILL_AUTO_MAX=16384in both arms. No--trim-stage-weightsin either arm, because the DP path needs every card's full dense weights.max_tokens1. Tokens/s is prompt tokens divided by the time to first token at the client.STRATA_MMQ_DIRECT=1added to both arms and DP on twice: DP off 2,464 / 3,561 / 4,194 / 4,287, DP on 4,178 and 4,164 / 4,601 and 4,592 / 4,998 and 4,977 / 4,953 and 4,933.STRATA_QSA_DUMP) of a fixed 123K prompt read through DP was byte-identical in two runs (1.62 GB). Its bits differ from the layer pipeline's, because the chunk boundaries differ.What a PR would contain, if you're interested:
STRATA_DP_PREFILL=1. Unset, nothing changes.--peer-device, no--trim-stage-weights, and streamed K/V withSTRATA_KV_HOST_DMA=1.prefill.cpp/prefill.hpp(run_dpand the hand-off events) andgenerate.cpp(the extra sessions, the link, and the hook where the server reads a prompt part). That is about 530 lines in our port.STRATA_DP_EARLY_REFILL). Another user traced non-finite logits on cold prompts to it in nicejunjie/Strata-rdna3#3. The port refills after the read, as upstream does.Limits: one rig and one pack. Peer access on these GeForce cards comes from a P2P-enabled build of NVIDIA's open kernel modules. Without peer access the hand-offs would go through host RAM, which I have not measured.
What do you do today instead?
I run the port on 2x RTX 3090. Without it, long prompts read at the "DP off" rates above.
Questions
Prepared with AI assistance (Claude); every number above comes from the runs described, and the logs are available.
@rafatxf commented on GitHub (Nov 1, 2026):
I ported nicejunjie's
STRATA_DP_PREFILL(f60e317b) onto 0.2.7 (engine 0.1.52) independently, on a smaller box than yours: 2x RTX 2080 Ti 22 GB on NVLink, PCIe 3.0 x8 each, i7-6700, 56 GB RAM, UD-IQ4_XS. Three things came up that a PR should probably cover.1. With little RAM, the foreign layers' experts come from the model file.
run_dp's residency view, mark a foreign layer's expert that the peer holds with a flag, and resolve it to the peer's slot pointer, read over the peer link. The weight-stationary MMQ path has to be skipped for those, since it uses offsets from this card's slot 0.2. Each foreign session pins its own host K/V copy, which is then discarded.
session_initfor the foreign session allocates the streamed QSA layers' pinned host pools. The code then pointsqsa_states[q].hostat the owner's, so that copy is never used: about 2.3 GiB of pinned RAM in total here at 384K.session_init) brought decode back to the non-DP numbers within noise.3. Stage trim.
STRATA_STAGE_TRIM=1if a weight row the card skipped falls back to the peer's table, read over the peer link. I did that with a fallback inWeightTable::find, set only for the duration ofrun_dp.A caution. After a 174K DP read, the next DP read (96K) hit Xid 62 on the second card ("internal micro-controller halt", then GPU Reset Required), and only a reboot recovered it.
-sm tensor, which is also heavy on peer traffic.At long prompts the gain is small on x8 links: 174K read in 93.7 s with DP vs 96 s without. Each card streams the non-resident experts of all 48 layers for half the chunks, so each link carries about the same total as in the pipeline, and only the compute overlaps.
Reproduction status: measured locally; every number here is from my runs.
@orochifj commented on GitHub (Nov 1, 2026):
@rafatxf thank you, this is exactly the cross-check the proposal needed. Here is how each point looks against my port on v0.2.9 (2x RTX 3090, 256 GB RAM, 512K context).
1. Experts from the model file. This does not arise here. The expert arena holds every expert in RAM (about 61 GiB), so a foreign layer's experts always come from RAM. I agree a PR has to handle the small-RAM case. Your peer-slot lookup is one way. A simpler first step would be to leave a prompt to the layer pipeline when the arena does not hold the foreign layers' experts.
2. The foreign sessions' pinned K/V copy. Confirmed in my port too.
qsa_state_initpins a full host copy for each streamed layer of the foreign session, and the port then points.hostat the owner's copy. At 512K that is another ~2.6 GiB of pinned RAM next to the real 2.58 GiB. I have not measured its decode cost on this box, but it is plain waste, and skipping that allocation for these sessions belongs in the first PR.3. Stage trim. That closes the gap I flagged: every arm here ran without
--trim-stage-weights. I'd keep it as a follow-up, since it adds peer reads.Xid. The kernel log here has no Xid since 10-27, across eight boots of daily DP use. These cards use peer copies over PCIe 4.0 x16, no NVLink. My port only peer-copies the per-layer state, and experts come from RAM, so its peer traffic is much lighter than the peer-read forms in 1 and 3. Those would need a stress run before going in.
Long prompts. Same shape here: the gain shrinks with length, from +68 % at 19K to +14 % at 123K on PCIe 4.0 x16.
A possible split, if the maintainer wants this:
Would you like to own the follow-ups, or co-author? Your 2080 Ti box covers the low-RAM, x8 case that mine cannot.
Prepared with AI assistance (Claude).
@nicejunjie commented on GitHub (Nov 1, 2026):
@orochifj Thanks for porting it and for the careful measurements. I'm happy that you submit the PR. Please add me as co-author on the commits:
Co-authored-by: Junjie Li nicejunjie@gmail.com
@rafatxf commented on GitHub (Nov 1, 2026):
Thanks, that split works for me. The first PR as you describe it (the base path, opt-in, the foreign sessions' host K/V skipped, and a pipeline fallback when the arena does not hold the foreign layers' experts) is the safe start.
I'm glad to co-author the two follow-ups, the peer-slot residency and DP with stage trim. Once your PR is up I'll rebase my patches onto it, so the follow-ups apply cleanly to your branch.
On the stress run: this box is moving to a new platform within a couple of weeks (X99, both cards at x16, 128 GB). GPU1 here has thrown Xid 62 twice under peer-heavy loads, so I'd rather run the peer-traffic stress test there than risk another hard reset here. I'll post the numbers and the kernel log from that run with the follow-ups.
@orochifj commented on GitHub (Nov 2, 2026):
The draft is up: #5002, one commit on main (branch
pr/dp-prompt-pathon orochifj/Strata), withCo-authored-by: Junjie Li.STRATA_DP_PREFILL=1, the foreign sessions without their own pinned K/V copy, and DP off with a log line when not every expert is in RAM.@rafatxf, you can rebase your two follow-ups onto that branch. @Niko1221, the PR stays a draft until you agree the scope here.
Prepared with AI assistance (Claude).