mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1038] [CLOSED] decode: STRATA_PCIE_BALANCE=1 picks each layer's PCIe count from measured costs (opt-in) #2986
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#2986
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/1038
Author: @sergqwer
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:pr/pcie-balance📝 Commits (10+)
f4e96d5tests: gdn_rec_head also compares the PP (variant 4) and two-column (variant 5) recurrence kernels, bitwise16bc95aprefill: STRATA_HCD_EXACT=1 - the HC down projection by a WMMA kernel with hipBLASLt solution 1176/1177 k order (StaggerU included), bitwise502fcef#606: the fused SwiGLU q8_1 quantizers keep the block's scale and sum finite too64d0136cache: preserve checkpoints when split allocation failsa0d0056prefill: fused-expert exact wins (table16 via direct selector, float4 moe_combine, LDS alias + occupancy)5f5452bserve: park_current's try covers the checkpoint split too (#752): a host OOM skips parking8b19a38Layer split: --vram-reserve-later-mib, a separate reserve for the later cardsea83d0dResident RAM mode with a layer splitd2d981fsetup: the low-RAM mode's resident variant on several GPUs (#642)cd62e5eserve: a split's stage-0 GPU profile line keeps its text (#848); later stages say which stage📊 Changes
7 files changed (+212 additions, -6 deletions)
View changed files
📝
include/strata/core/expert_source.hpp(+94 -0)📝
include/strata/core/verify.hpp(+21 -0)📝
include/strata/kernels/verify_kernels.hpp(+4 -0)📝
src/core/expert_source.cpp(+3 -2)📝
src/core/verify.cpp(+46 -3)📝
src/kernels/cuda/verify_kernels.cu(+25 -0)📝
src/program/generate.cpp(+19 -1)📄 Description
The verify window reads
pcie_fracof a layer's missed experts over PCIe. The link probe sets that share, so the CPU's speed never enters it. On a slow CPU the GPU spins on the pool's rows while the link sits mostly idle.This adds an opt-in,
STRATA_PCIE_BALANCE=1. Off (the default), nothing changes: no new kernel is captured and the share is the probe's.What it does
Stamps.
wait_flag_ge_stampedis the same flag spin kernel, which also writes the GPU clock at three points: as the layer's plan arrives (flag A), as the PCIe part starts (flag B) and as the GPU starts waiting for the CPU's rows. This adds no extra launch, and the stamped kernels are captured only with the switch on.Fits. The host already times its pool per step. After each window, least squares with forgetting (~200 layers) fit two lines:
a + c·n_cpu + d·n_pcie;g0 + g·n_pcie.dis there because the pool and the link read the same RAM. On a DRAM-bound pool, a PCIe copy slows the pool by about what the expert it took off the CPU saved, so moving misses buys nothing there. A plain per-expert balance got this wrong and was ~4% slower on such a box.Choice. A layer reads over PCIe the
mof its misses that minimizesmax(GPU, CPU). Every 64th layer that would keep all its misses on one side moves one to the other, so neither fit goes stale. Without that, a cold first sample once sent everything over PCIe for good.Scope. One GPU, no batch slots and no
--pcie-frac. A serve request's ownpcie_fracpauses the switch for that request. The decode summary prints the fitted costs.Measured
IQ2_XS (ISTA's GSQ-RCO), RTX 5090 + Ryzen 9 9950X3D, chat prompt decoded to the end of the turn (
--stop-eos), automatic cache:STRATA_PCIE_BALANCE=1STRATA_FORCE_AVX2=1 --pool-workers 1 --no-host-worker)d26-28 us, so 0.8 of the misses move.d0.5-0.6 ofc) and few misses move.Off, the logits and the 32 greedy tokens equal v0.1.39 on IQ2_XS: 2K prompt, fixed cache, identical bytes.
The slow-CPU case is emulated on this machine by fewer workers and the AVX2 kernels, not run on such a CPU. A 6-core or a Zen 2 box (the README's Ryzen 9 3900X) sits somewhere between those two rows. That is the case the fit is for: it finds the box's own split instead of the probe's. The HIP builds take the clock
gpu_stampalready uses (wall_clock64), but I have no AMD card to run them on.🤖 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.