[PR #1548] [CLOSED] decode: STRATA_PCIE_BALANCE=1 picks each layer's PCIe count from measured costs (refile of #1038 by @sergqwer, on 0.1.40.3) #3524

Closed
opened 2026-11-07 14:42:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1548
Author: @stuchapin909
Created: 10/8/2026
Status: ❌ Closed

Base: main ← Head: pr/refile-1038


📝 Commits (1)

  • a513394 decode: STRATA_PCIE_BALANCE=1 picks each layer's PCIe count from measured costs

📊 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

Summary

A refile of #1038 by @sergqwer, which GitHub closed when main's history was rewritten (not a rejection; your note there asked for a new branch from the new main). The commit is theirs, cherry-picked onto 0.1.40.3 with -x, authorship kept. Opt-in: STRATA_PCIE_BALANCE=1 picks each layer's PCIe count from measured CPU and GPU costs; unset, nothing changes. The method, the scope (one GPU, no batch slots, no --pcie-frac) and the original measurements are in #1038.

What changed

Nothing beyond #1038's commit, except one conflict: in include/strata/kernels/verify_kernels.hpp the comment above gpu_stamp changed on main (the PDL sentence) while #1038 added wait_flag_ge_stamped above it. Both are kept: the new declaration, then main's current gpu_stamp comment. wait_flag_ge_stamped launches like wait_flag_ge (no PDL), as on main.

Measured

The case #1038 did not cover: a strong CPU on a slow link, where the probe's share is too high. i9-9920X (Skylake-X, 12 cores, AVX-2 expert kernels), 96 GB DDR4, Windows 11, one RTX 3090 on PCIe 3.0 x16 (probe 12.3 GB/s -> pcie_frac 0.34), built with STRATA_PORTABLE=ON. IQ3_S (GSQ-RCO), expert cache 2,454 slots (4.71 GiB, --vram-reserve-mib 12300, about a 12 GB card), --spec 4 --spec-min-p 0.5 --kv k8v4 --kv-resident 32768 --max-context 262144, one prompt ("Explain how to compute 1719 + 2329 by hand, then give the integer."), greedy, 256 tokens, strata generate --tokens-file, a fresh process per run.

switch unset STRATA_PCIE_BALANCE=1
2026-10-07, #1038's head cherry-picked (alternating with --pcie-frac 0.25) 52.83, 51.90 tok/s 57.04, 57.41 tok/s
2026-10-08, this commit 52.51 tok/s 54.82, 55.75 tok/s
experts per layer read over PCIe 5.55-5.57 4.45-4.78

+9.2% and +5.3% over the probe share in the two sittings. The fitted model printed CPU 162-173 us + 57-65 an expert + 0 a PCIe one, GPU 145-178 us + 146-150 a PCIe expert. The best fixed share on this PC, by hand, is 0.25 (58.0-58.2 tok/s, 4.1 experts a layer over PCIe), so the switch gets most of the way there without tuning. The same tokens in every run.

On this PC's two-card layer split the share makes no measurable difference (automatic vs 0.25, 3 starts each), in line with the switch's one-GPU scope.

Extra Notes

@sergqwer: the change is yours; if you would rather refile it yourself, I will close this one.

🤖 Generated with Claude Code


🔄 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/1548 **Author:** [@stuchapin909](https://github.com/stuchapin909) **Created:** 10/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/refile-1038` --- ### 📝 Commits (1) - [`a513394`](https://github.com/Niko1221/Strata/commit/a513394c4768f1d0fa13957e79b171b0fcc51c32) decode: STRATA_PCIE_BALANCE=1 picks each layer's PCIe count from measured costs ### 📊 Changes **7 files changed** (+212 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description ## Summary A refile of #1038 by @sergqwer, which GitHub closed when `main`'s history was rewritten (not a rejection; your note there asked for a new branch from the new `main`). The commit is theirs, cherry-picked onto 0.1.40.3 with `-x`, authorship kept. Opt-in: `STRATA_PCIE_BALANCE=1` picks each layer's PCIe count from measured CPU and GPU costs; unset, nothing changes. The method, the scope (one GPU, no batch slots, no `--pcie-frac`) and the original measurements are in #1038. ## What changed Nothing beyond #1038's commit, except one conflict: in `include/strata/kernels/verify_kernels.hpp` the comment above `gpu_stamp` changed on `main` (the PDL sentence) while #1038 added `wait_flag_ge_stamped` above it. Both are kept: the new declaration, then `main`'s current `gpu_stamp` comment. `wait_flag_ge_stamped` launches like `wait_flag_ge` (no PDL), as on `main`. ## Measured The case #1038 did not cover: a strong CPU on a slow link, where the probe's share is too high. i9-9920X (Skylake-X, 12 cores, AVX-2 expert kernels), 96 GB DDR4, Windows 11, one RTX 3090 on PCIe 3.0 x16 (probe 12.3 GB/s -> `pcie_frac 0.34`), built with `STRATA_PORTABLE=ON`. IQ3_S (GSQ-RCO), expert cache 2,454 slots (4.71 GiB, `--vram-reserve-mib 12300`, about a 12 GB card), `--spec 4 --spec-min-p 0.5 --kv k8v4 --kv-resident 32768 --max-context 262144`, one prompt ("Explain how to compute 17*19 + 23*29 by hand, then give the integer."), greedy, 256 tokens, `strata generate --tokens-file`, a fresh process per run. | | switch unset | `STRATA_PCIE_BALANCE=1` | | --- | --- | --- | | 2026-10-07, #1038's head cherry-picked (alternating with `--pcie-frac 0.25`) | 52.83, 51.90 tok/s | 57.04, 57.41 tok/s | | 2026-10-08, this commit | 52.51 tok/s | 54.82, 55.75 tok/s | | experts per layer read over PCIe | 5.55-5.57 | 4.45-4.78 | +9.2% and +5.3% over the probe share in the two sittings. The fitted model printed `CPU 162-173 us + 57-65 an expert + 0 a PCIe one, GPU 145-178 us + 146-150 a PCIe expert`. The best fixed share on this PC, by hand, is 0.25 (58.0-58.2 tok/s, 4.1 experts a layer over PCIe), so the switch gets most of the way there without tuning. The same tokens in every run. On this PC's two-card layer split the share makes no measurable difference (automatic vs 0.25, 3 starts each), in line with the switch's one-GPU scope. ## Extra Notes @sergqwer: the change is yours; if you would rather refile it yourself, I will close this one. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:42:06 +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#3524
No description provided.