mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #816] 0.1.39: decode on an RX 6800 (gfx1030, Windows) is 12-22% slower than 0.1.38; STRATA_SH_STREAM=0 removes it #366
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#366
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 @did-technomancer on GitHub (Oct 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/816
strata-windows-x64-hip.zip; built here the same way as 0.1.39, it gave the same numbersv0.1.39built here withtools\hip\build_windows.bat,STRATA_HIP_ARCHS=gfx1030; the release zip wasnot run
STRATA_SH_STREAM=00.1.39's new decode switches, turned off one at a time (1 run each):
STRATA_SH_STREAM=0STRATA_IQ_STAGE_GRID=0STRATA_PLE_BATCH=0STRATA_OLD_IQ_MMVQ=1STRATA_DEC_BATCH=0On IQ3_XXS (
--draft-vocab cyrillic) 0.1.39 +STRATA_SH_STREAM=0gives 49.2 / 55.2 / 52.0 against 42.2 / 45.7 / 42.8on 0.1.38. Why the shared expert's second stream costs this much here was not profiled.
Full report, scripts and data: https://github.com/Niko1221/Strata/pull/815
@pugolini commented on GitHub (Oct 4, 2026):
Independent data point on RDNA4 / gfx1201, and I think I found what causes this.
Setup: Radeon AI PRO R9700 32 GB (gfx1201), ROCm 6.4.3, Linux, Qwen3.8-Flash-Next 176B MoE IQ3_XXS,
--kv int8 --kv-resident 32768 --resident-experts, temperature 0. Prompt is 48,067 tokens so the KV stream path is running; 3 measured runs per case, same binary per case, same prompt.STRATA_SH_STREAM=1(fork on)STRATA_SH_STREAM=0(fork off)So your workaround does the same thing here: +45%, 43.4 → 63.0 t/s. Runs 2 and 3 sit at 98.5%/99.0% expert cache hit, so this is not a cold-cache effect — run 1 is slower in every case because it pays the first cold read.
Cause: the shared-expert stream fork
cfd3b72("zero-doorbell resident verify graph, sub-warp expert packing, shared-mem staging") forks the shared expert onto a second stream and joins it back per layer (sh_forkinrecord_window). It is an ancestor of v0.1.39 (6f32ec0) but not of v0.1.38 (99f3dbd) —sh_stream_envappears 0 times in99f3dbdand twice in6f32ec0. That is exactly the window you and Burntgogi measured, and the overlap it buys on CUDA costs more than the shared expert takes to run on HIP, where the cross-stream event dependency serialises it.Two things hid it:
STRATA_SH_STREAM=0was the only way to see it. The profiler itself turns the fork off to time the stages, so every profiled run silently measured the fast path.For reference, that also explains the shape of your numbers: 12-22% rather than a flat figure, since it scales with how much of the run is on the stream path.
Fix
I opened #826, which makes the fork start off on HIP only (
STRATA_SH_STREAM=1forces it back on, as you already use). CUDA's default is unchanged — the#elsebranch returns exactly what the current code returns.The fork is a scheduling change only, so output is untouched: four prompts (explanatory, code, technical summary, free paragraph) at temperature 0 come back byte for byte identical, same sha256, with the fork on and off. The forcing cases bracket the change in the table above:
=1reproduces stock 0.1.39 (43.50 against 43.40).Caveat worth stating: this is one gfx1201 card, from me. Your gfx1030 report is the second data point and gfx1100 is a third, but I have not reproduced your configuration on Windows myself, and I did not profile why the second stream costs this much — the numbers are consistent with the event dependency serialising what CUDA overlaps, but that part is a hypothesis, not a measurement.
If anyone can run this on another HIP card, it settles it: the same long-prompt decode on a v0.1.39 binary with
STRATA_SH_STREAMunset versusSTRATA_SH_STREAM=0. A large prompt is needed (mine is ~48k tokens); on a short prompt the two are within a few percent and it will look like nothing is wrong.@sruggier commented on GitHub (Oct 4, 2026):
Thanks for reporting this: it was cutting my decode rate to roughly half the speed (with an RX 6900 XT, but on an older system with a Xeon E5-1620 v4 and slower system memory), and you saved me time by sharing the most efficient workaround.
Слава Україні!
@tomsun66-star commented on GitHub (Oct 4, 2026):
On what type of drive was the NGRAM Table located? NVME Gen5/NVME GEN4/NVME GEN3/SATA-SSD, was the drive connected via Chipset or directly to the CPU (i'm asking because i did the test with the Unsloth IQ3XXS model and there was no measurable difference but at that time i was running around 7 Tokens per second, and under "heavy load" (producing a 1500 word text from a long prompt app. 4K) around 3 Tokens/second. The question behind that is always it is claimed to use a fast NVME, but when does it really matters? When is the speed of the drive hosting the NGRAM-Table really the bottleneck, currently the bottleneck for me is still the DRAM speed. So interesting to see the experience of people using fast DDR5 RAMs and PCI Gen5 Systems if they encounter speed problems if the NGRAM Table is on a slower drive.
@sruggier commented on GitHub (Oct 5, 2026):
In my case, an old DRAM-less SSD, PCIe gen 3. Slow by today's standards, but I'm seeing 25-30 tokens/s on decode, and it stays that way regardless of how full the context window is. I've observed this up to 231k tokens.
@biosynthart commented on GitHub (Oct 5, 2026):
gfx1201 / Linux: same decode regression,
STRATA_SH_STREAM=0restores it (slightly above 0.1.38)Setup
/opt/rocm; engine built from source withcmake -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF -DCMAKE_HIP_ARCHITECTURES=gfx1201v0.1.38vsv0.1.39(tags); the 0.1.38 engine binary was run under the 0.1.39 server with the same config, so both arms saw the same server code--kv int8, MTP draft head,--spec 4 --spec-min-p 0.5temperature 0; decode tok/s from the server'stimings.predicted_per_second; 3 runs per arm, medians belowDecode, tok/s (median of 3)
STRATA_SH_STREAM=0Held constant across arms (engine log + timings): expert cache auto-sized identically (13,217 slots / 25.09 GiB), decode cache hit rate 94–98%, per-run draft acceptance counts
identical (e.g. 174/244 on both 0.1.38 and 0.1.39), long-prompt read ~1,150 tok/s unchanged. The regression is isolated to the decode verify path.
Notes
STRATA_SH_STREAM=0, 0.1.39 lands slightly above 0.1.38 on both models — same direction as the gfx1030 numbers in this issue.STRATA_VERIFY_COHERENT=1/STRATA_DOORBELL_STORE=1A/Bs if that helps #649 on gfx1201.@Vop3p commented on GitHub (Oct 5, 2026):
gfx1030 / Linux, 2x RX 6900 XT: no regression here — the fork on is 5–9% faster than
STRATA_SH_STREAM=0A data point in the other direction, same card family as the report (gfx1030), Linux instead of Windows. If #826 turns the fork off for all of HIP, this machine loses 5–9% decode unless it sets
STRATA_SH_STREAM=1.Setup: 2x AMD Radeon RX 6900 XT 16 GB (gfx1030), each PCIe 4.0 x8; Ryzen 5 5600X, 128 GB DDR4-3200; Ubuntu 26.04, kernel 7.0.0-38, ROCm 10.0.0. Source builds,
-DSTRATA_ENABLE_HIP=ON -DCMAKE_HIP_ARCHITECTURES=gfx1030 -DSTRATA_PREFILL_MMQ=ON. Qwen3.8-Flash-Next GSQ-RCO IQ3_S,--kv int8 --kv-resident 32768 --max-context 131072, MTP draft,--spec 4 --spec-min-p 0.5. Non-default:--adapt-every 100000in the long-prompt runs (the #884 workaround; it was not set in the short-prompt runs).Long prompt (the condition pugolini asked for): 50,517 prompt tokens, past
--kv-resident, so the KV stream path is running; "Summarize the document above", 256 tokens, temperature 0; 3 requests per arm on one server, the first cold, the next two reuse the prefix. tok/s from the engine'sstrata serve:line; ms per verify window fromSTRATA_DECODE_TIMING=1.STRATA_SH_STREAM=06f32ec0)In each pair the two arms accepted the same drafts (same output), so the difference is the window time, not the sampling. Prompt read is unaffected (764 tok/s stock, 1,650 with the PRs, both arms).
Short prompt (2026-10-04, 0.1.39 + #835 — a prompt-path-only change; two ~5,000-token prompts, sampled, up to 600 tokens,
STRATA_DECODE_TIMING=1, one server per arm):STRATA_SH_STREAM=0So on this box the second stream buys what it was meant to buy. I have no explanation for why it costs 12–45% on the RX 6800 (Windows) and gfx1201 and nothing here; the obvious differences are the OS and the ROCm version (10.0.0 here, 10.2.0a on the RX 6800, 6.4.3 on the R9700). A per-arch or per-OS default, or leaving the default and documenting the switch, would keep both sides whole.
One related note for the hang hunters: in #884 (gfx1030, Linux) the stuck barrier packet sits at the head of exactly this stream's queue (
sh_cs_), butSTRATA_SH_STREAM=0did not stop the hang there (it moved into the prompt read, 1 of 2 runs), so turning the fork off is not a fix for that.@aswin-dot-R commented on GitHub (Oct 5, 2026):
gfx1201 (RDNA4) / Linux, 2-card layer split: the fork costs ~22% here, and a bisect points at its interaction with the pipelined split
Setup: AI PRO R9700 32 GB + RX 9070 XT 16 GB (both gfx1201), layer split
[1, 0](auto: layers 0-29 / 30-47), Qwen3.8-Flash-Next IQ3_S, 262K context,--kv int8, MTP drafts. Linux 6.17, ROCm 7.2.0, engine built from the tags with setup's flags. R9700 on PCIe 4.0 x4, 9070 XT on 3.0 x4 (OCuLink).Decode = the engine's own
1200 generated in ... msline, 1,200-token replies, warm:STRATA_SH_STREAM=0So on this machine
STRATA_SH_STREAM=0is not only the fix but faster than 0.1.38 - the opposite of the 2x 6900 XT report above.Bisect (
git bisect --first-parent v0.1.38 v0.1.39, same config, best of two runs):cff608ccb97e6c- f-139b-spd merged, fork on1189218- merge of f-139b-par8b36fa0Every commit on f-139b-par by itself (
2fbbfa2,9556298,cef263f,1a56d71) measures 72.8 - 73.7. So neither side is slow alone: the fork was fine on the spd line, and the regression appears only where it meets the pipelined split.With
STRATA_SPLIT_TIMING=1 STRATA_DECODE_TIMING=1(which serializes the stages),cb97e6cand 0.1.39 are identical - 58.5 vs 58.1 tok/s, per window: stage 0 GPU wait 13.43 / 13.45 ms, stage 1 13.00 / 13.09 ms, pool + plan and commit within 0.03 ms. The per-stage work did not get slower; what 0.1.39 loses is the overlap between the two cards, and its normal speed (~61) lands almost exactly on the serialized one (~58).That may be why results differ between machines: on a single GPU (#816's RX 6800) the cross-stream event cost is the whole story, while on a split the fork's join seems to also stall the hand-off between stages. If that is right, #826 turning the fork off by default on HIP fits this machine too, and a split might want it off on CUDA as well - I have no CUDA split to check.
@Solear commented on GitHub (Oct 5, 2026):
gfx1201 / Linux, 2x R9700 layer split:
STRATA_SH_STREAM=0fixes it here too, and the default is unstable across engine startsSetup: 2x Radeon AI PRO R9700 32 GB (gfx1201), layer split auto (layers 0-25 / 26-47, 100% of experts resident, PCIe probe 28.7 GB/s), Core Ultra 7 270K Plus (no AVX-512), 192 GB DDR5-5600, Ubuntu 26.04, kernel 7.0.0-38, TheRock wheels rocm 7.10.0a20251120 (hipBLASLt 100200). Qwen3.8-Flash-Next GSQ-RCO IQ3_S, 262K context,
--kv int8 --kv-resident 32768, MTP--spec 4, vision on. Engine built by setup (--update) fromv0.1.38(99f3dbd) and6f32ec0.Decode = 400-token replies, temperature 0,
reasoning_effort: off, 3 requests per engine start (medians), engine restarted between rows:STRATA_SH_STREAM=0With the fork on, the speed is stable within one engine start (±2%) but flips between a slow and a fast mode across restarts; startup logs are identical in both (same split, expert placement, PCIe probe, thread affinity) and MTP acceptance is the same (~88% on code), so the difference is the time per verify window. With the fork off every start runs in the fast mode, ~15-20% above 0.1.38. Prefill is unchanged (~1,220 / 1,720 / 1,980 tok/s at 4K / 16K / 32K).
STRATA_IQ_STAGE_GRID_MMVQ=1made no difference.This matches @aswin-dot-R's bisect: the loss is in the overlap between the stages, and here the fork's join apparently stalls the hand-off on some starts and not on others. +1 for #826 turning the fork off by default on HIP.
@Vop3p commented on GitHub (Oct 5, 2026):
One more data point from the 2x RX 6900 XT machine above, since two of the slow reports are single RDNA2 cards: here the fork is also faster on one card.
Single RX 6900 XT, 50,517-token prompt, 256 tokens, temperature 0, 3 requests per arm (first cold), one server per arm:
STRATA_SH_STREAM=06f32ec0)Same direction as the split (+5-9%) and the expert-helper mode (+8%) measured earlier: six pairs, all in favour of the fork. Across 11 engine starts at the default settings the fork-on speed has been the same within a few percent (split 55.6-60.6 at a 50K-token context), never a slow mode like @Solear's.
So I have no explanation for the sign: the RX 6800 (Windows) and the RX 6900 XT on the E5-1620 v4 are the same card family and also single cards with CPU experts, and they lose with the fork on while this machine gains in every mode. What is left to differ is the OS, the host platform (DDR4-2133, PCIe 3.0 there) and ROCm (10.0.0 here; 7.2.0 / 7.10 nightly / 10.2.0a on the slow reports, so not a version order). The one thing the data does say is that the sign is a property of the machine and stable on a given one, which argues for keeping the switch and letting the default be measured:
calibrate.pyalready times--pcie-fracand--spec-min-pthrough one engine; aSTRATA_SH_STREAMarm there (it needs a restart per value, like--pool-workers) would set it right on every PC, whichever way #826 goes.@Niko1221 commented on GitHub (Oct 6, 2026):
Fixed in 0.1.40: the shared-expert stream fork is off by default on HIP (PR #826), except on gfx1151. STRATA_SH_STREAM=1 restores the 0.1.39 behaviour if you want to compare. Please tell us if decode is back to 0.1.38 speed on your card.
@Vop3p commented on GitHub (Oct 6, 2026):
The 2x RX 6900 XT (gfx1030, Linux) data above goes the other way - the fork is faster there, 5-13% of decode on 0.1.40.1 - so I opened #1272 with the measurements, and the #884 stall data with the fork on and off.
@sruggier commented on GitHub (Oct 6, 2026):
I can confirm that I'm no longer seeing this problem on Strata 0.1.40.1 (on RX 6900 XT, gfx1030).