[PR #794] [CLOSED] split: the auto placement sees each stage's PCIe link #2833

Closed
opened 2026-11-04 02:03:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/794
Author: @chengshenyangtai
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: split-link-aware


📝 Commits (10+)

  • fa16567 setup: an earlier config that does not parse is skipped, not a crash; configs are written atomically (#459)
  • 749d957 setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)
  • 5a30024 calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)
  • 9f60d13 serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)
  • eb8da1d /metrics: each request's speculative draft counts, and their sums in the totals (#457)
  • 6a09387 setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)
  • d6a91e2 docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)
  • d8d4ad3 Merge branch 'f-135-eng' into rel-0.1.35
  • 7b600d5 Merge branch 'f-135-small' into rel-0.1.35
  • d9ab843 Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it

📊 Changes

1 file changed (+28 additions, -1 deletions)

View changed files

📝 src/program/generate.cpp (+28 -1)

📄 Description

What this fixes

`--layer-split auto` picks the split by a predicted window time: layer compute plus a miss cost for experts no cache 
holds. That miss cost (`190 ms per unit of routed mass`) is **one constant for every stage** — it was fitted on a pair 
of equal x16 cards, so the search cannot see an asymmetric pair and spreads layers by compute and cache size alone.

Measured case: 2x RTX 4090 D, the second card on a **physical x1 link** (probed: 23.9 GB/s on the x16 card vs 1.6 GB/s
on the x1 card). The prompt path streams every missed expert over *its stage's* link, so the layers given to the x1 card
 dominate every chunk:

| | placement | 29K-token prompt, fresh reads |
|---|---|---|
| search as-is | K=22 (26 layers on the x1 card) | ~350 tok/s |
| with this change | K=38 (the x1 card's cache holds all of its layers' pairs — zero streaming there) | ~1410 tok/s |

Same machine, same model (Qwen3.8-Flash-Next UD-Q4_K_XL), 3 fresh real-text prompts per arm, engine-reported timings. 
The old placement's per-chunk streaming on x1 is ~26 GB ÷ 1.6 GB/s ≈ 17 s; the observed chunk time matched.

## How

- Probe each stage's link inside the search (`probe_pcie_h2d_gbps`). The stage-setup probes are skipped when 
`--pcie-frac` is given, and the search needs the reading either way.
- Scale each stage's miss term by `clamp(20 GB/s / bw, 1, 64)`. 20 GB/s is `pcie_frac_for_gbps`' x16 reference; the 
lower clamp keeps a symmetric machine on the exact formula the sweep's K was fitted with (all scales 1.0 → the objective
 is unchanged).
- The objective's miss term becomes per-stage: `Σ_i miss_ms × scale_i × (missed mass of stage i)`, with the per-stage 
held mass now accumulated in the placement fill.

Log lines on that machine:

layer split auto: CUDA0 link 23.9 GB/s -> miss cost x1.00
layer split auto: CUDA1 link 1.6 GB/s -> miss cost x12.15
layer split auto: K=38 - predicted 17.1 ms per decode window; the caches hold 10451 of 24576 profiled pairs (~97.4% of
the routed mass)

## Limits / notes

- The 190 ms constant mixes the decode CPU-pool cost with the prompt link cost; scaling the whole per-stage term is the
first-order fix. Splitting the constant into its two parts would need a fresh fit on both a narrow and a wide link —
happy to do that if you want it.
- Symmetric pairs are untouched: an x16 gen4/5 link reads 23-28 GB/s, so its scale is exactly 1.0.
- `--pcie-frac` still overrides the decode share exactly as before; this only changes the *placement search*'s cost
model.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/794 **Author:** [@chengshenyangtai](https://github.com/chengshenyangtai) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `split-link-aware` --- ### 📝 Commits (10+) - [`fa16567`](https://github.com/Niko1221/Strata/commit/fa165679f9860552ac97ebd07118bb8db286be4a) setup: an earlier config that does not parse is skipped, not a crash; configs are written atomically (#459) - [`749d957`](https://github.com/Niko1221/Strata/commit/749d957a1790b1a171dd4a01ab3e31b3882c9892) setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446) - [`5a30024`](https://github.com/Niko1221/Strata/commit/5a3002446dbb9dfcabb7d0bd9f113da90cc2f3c0) calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447) - [`9f60d13`](https://github.com/Niko1221/Strata/commit/9f60d13246e46b02b1dd0841980b4d18b0faaea7) serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448) - [`eb8da1d`](https://github.com/Niko1221/Strata/commit/eb8da1d8c26ec41e6ffb084fdf579dba7cad10bd) /metrics: each request's speculative draft counts, and their sums in the totals (#457) - [`6a09387`](https://github.com/Niko1221/Strata/commit/6a093874fe037020f49bd5cf053879ff6a133c21) setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444) - [`d6a91e2`](https://github.com/Niko1221/Strata/commit/d6a91e2d1770d0f469d6ec15890acc7ee93e764c) docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438) - [`d8d4ad3`](https://github.com/Niko1221/Strata/commit/d8d4ad337d3c98ba21d3bd0af1a16e9177e112b6) Merge branch 'f-135-eng' into rel-0.1.35 - [`7b600d5`](https://github.com/Niko1221/Strata/commit/7b600d55ff801caaaa11542af1523050992e049b) Merge branch 'f-135-small' into rel-0.1.35 - [`d9ab843`](https://github.com/Niko1221/Strata/commit/d9ab8435f654c368c586340d490915f6addf56a3) Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it ### 📊 Changes **1 file changed** (+28 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/program/generate.cpp` (+28 -1) </details> ### 📄 Description ## What this fixes `--layer-split auto` picks the split by a predicted window time: layer compute plus a miss cost for experts no cache holds. That miss cost (`190 ms per unit of routed mass`) is **one constant for every stage** — it was fitted on a pair of equal x16 cards, so the search cannot see an asymmetric pair and spreads layers by compute and cache size alone. Measured case: 2x RTX 4090 D, the second card on a **physical x1 link** (probed: 23.9 GB/s on the x16 card vs 1.6 GB/s on the x1 card). The prompt path streams every missed expert over *its stage's* link, so the layers given to the x1 card dominate every chunk: | | placement | 29K-token prompt, fresh reads | |---|---|---| | search as-is | K=22 (26 layers on the x1 card) | ~350 tok/s | | with this change | K=38 (the x1 card's cache holds all of its layers' pairs — zero streaming there) | ~1410 tok/s | Same machine, same model (Qwen3.8-Flash-Next UD-Q4_K_XL), 3 fresh real-text prompts per arm, engine-reported timings. The old placement's per-chunk streaming on x1 is ~26 GB ÷ 1.6 GB/s ≈ 17 s; the observed chunk time matched. ## How - Probe each stage's link inside the search (`probe_pcie_h2d_gbps`). The stage-setup probes are skipped when `--pcie-frac` is given, and the search needs the reading either way. - Scale each stage's miss term by `clamp(20 GB/s / bw, 1, 64)`. 20 GB/s is `pcie_frac_for_gbps`' x16 reference; the lower clamp keeps a symmetric machine on the exact formula the sweep's K was fitted with (all scales 1.0 → the objective is unchanged). - The objective's miss term becomes per-stage: `Σ_i miss_ms × scale_i × (missed mass of stage i)`, with the per-stage held mass now accumulated in the placement fill. Log lines on that machine: layer split auto: CUDA0 link 23.9 GB/s -> miss cost x1.00 layer split auto: CUDA1 link 1.6 GB/s -> miss cost x12.15 layer split auto: K=38 - predicted 17.1 ms per decode window; the caches hold 10451 of 24576 profiled pairs (~97.4% of the routed mass) ## Limits / notes - The 190 ms constant mixes the decode CPU-pool cost with the prompt link cost; scaling the whole per-stage term is the first-order fix. Splitting the constant into its two parts would need a fresh fit on both a narrow and a wide link — happy to do that if you want it. - Symmetric pairs are untouched: an x16 gen4/5 link reads 23-28 GB/s, so its scale is exactly 1.0. - `--pcie-frac` still overrides the decode share exactly as before; this only changes the *placement search*'s cost model. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:26 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2833
No description provided.