[PR #2720] [CLOSED] [Engine] --peer-device: the adaptive tier's copies land while the next window runs (opt-in STRATA_ADAPT_OVERLAP=1) #4229

Closed
opened 2026-11-07 15:34:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2720
Author: @bulhenvaster
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: pr/peer-adapt-overlap


📝 Commits (2)

  • c0ea1ec --peer-device: the adaptive tier's copies land while the next window runs (opt-in STRATA_ADAPT_OVERLAP=1); opt-in STRATA_PEER_LAUNCH_IN_POOL=1 launches the peer inside the pool's first phase
  • 6f3e4c0 Merge main (0.2.0-beta, e88ee39d) into pr/peer-adapt-overlap

📊 Changes

10 files changed (+226 additions, -25 deletions)

View changed files

📝 docs/DETAILS.md (+8 -0)
📝 include/strata/core/expert_source.hpp (+1 -0)
📝 include/strata/core/peer_experts.hpp (+25 -0)
📝 include/strata/core/verify.hpp (+15 -1)
📝 include/strata/kernels/cpu/pool.hpp (+6 -1)
📝 src/core/expert_source.cpp (+28 -7)
📝 src/core/peer_experts.cpp (+82 -3)
📝 src/core/verify.cpp (+8 -2)
📝 src/kernels/cpu/pool.cpp (+8 -3)
📝 src/program/generate.cpp (+45 -8)

📄 Description

Problem and result: in peer mode (--peer-device) STRATA_ADAPT_OVERLAP=1 is refused ("not with --peer-device"), so every decode window first waits for the previous adapt round's copies. On 0.2.0-beta (main e88ee39d) that wait is 5.0-5.2 ms of a 45 ms window. With this change the peer tier joins the overlap and the wait is 0.20-0.23 ms. Decode of 900-token greedy answers on a 161K-token conversation (3 questions x 3 rounds, decode only, medians), two runs each, alternating:

main, STRATA_ADAPT_OVERLAP=1 (refused) this branch, same this branch + STRATA_PEER_LAUNCH_IN_POOL=1
adaptive wait per window 5.21 / 4.98 ms 0.23 / 0.22 ms 0.22 / 0.20 ms
window 45.4 / 45.0 ms 38.1 / 42.0 ms 41.6 / 38.0 ms
ms per token, all 9 11.85 / 11.79 11.90 / 10.45 10.94 / 11.59

The wait is gone in every run; tokens per window move with the text the drafts find, so ms per token is noisier than the window (mean of the two runs: 11.82 -> 11.18, -5%). STRATA_PEER_LAUNCH_IN_POOL measured no gain over the overlap alone on this build (it gave +1.7% on 0.1.43); I can drop it from this PR if you prefer.

Approach: with STRATA_ADAPT_OVERLAP=1 PeerExperts::adapt issues its copies in layer order and signals each layer's landing with the primary's kind of signal (a stream-ordered D2H copy of the layer number into a pinned int, or host functions where the primary uses them), its table takes the swaps at the window's start (flip_pending), and a layer waits for a tier's copies only when that tier swapped in it. Without a peer the per-layer wait is the one it was; without the variable nothing changes. Separately, STRATA_PEER_LAUNCH_IN_POOL=1 (opt-in) runs the peer's launch on the host thread right after the CPU pool's first phase is published instead of before the pool starts (with the cold-read path of 0.2.0 it starts before the CPU's batches, as before). STRATA_DECODE_TIMING gains a line with the peer's launch and wait. docs/DETAILS.md: a paragraph under STRATA_ADAPT_OVERLAP.

Validation (RTX 5060 Ti 16 GB, PCIe 3.0 x8, primary + RTX 3060 12 GB, x16, --peer-device 1; Xeon E5-2683 v4, 64 GB DDR4 in two channels; Ubuntu, CUDA 13.3, driver 595.91; Qwen3.8-Flash-Next IQ3_XXS pack, --kv int8 --kv-resident 32768 --spec 4 --mtp --adapt-every 1 --adapt-swaps 160 --prompt-cache 14 --pcie-frac 0, STRATA_DECODE_TIMING=1; one engine start per run):

  • Passed: cmake --build build --target strata (CUDA, sm_86 + sm_120) on this branch's tree, no errors.
  • Passed: the default path. main and this branch, deterministic decode (--spec-min-p 1.01 --suffix-draft 0 --lookup-chain 0 --adapt-swaps 0, so no copies), STRATA_ADAPT_OVERLAP=1, no launch switch, a chain of 12 prompt reads with 64-token answers on a 161K conversation: 14 of 14 answers identical.
  • Passed: the A/B above (runs main, overlap, overlap + launch, then again).
  • Failed: none observed.
  • Not run: HIP, SYCL and Metal builds; Windows (the host-function signal path); a layer split; tokens compared bit for bit with the adaptive tier on (two runs of main already differ: the tier makes the output depend on timing).

Limits: one rig measured.

🤖 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/2720 **Author:** [@bulhenvaster](https://github.com/bulhenvaster) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/peer-adapt-overlap` --- ### 📝 Commits (2) - [`c0ea1ec`](https://github.com/Niko1221/Strata/commit/c0ea1ecea190ae15108aba1a0db381266da9adf9) --peer-device: the adaptive tier's copies land while the next window runs (opt-in STRATA_ADAPT_OVERLAP=1); opt-in STRATA_PEER_LAUNCH_IN_POOL=1 launches the peer inside the pool's first phase - [`6f3e4c0`](https://github.com/Niko1221/Strata/commit/6f3e4c0f293414290e63af3f7f3275cb321ae316) Merge main (0.2.0-beta, e88ee39d) into pr/peer-adapt-overlap ### 📊 Changes **10 files changed** (+226 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+8 -0) 📝 `include/strata/core/expert_source.hpp` (+1 -0) 📝 `include/strata/core/peer_experts.hpp` (+25 -0) 📝 `include/strata/core/verify.hpp` (+15 -1) 📝 `include/strata/kernels/cpu/pool.hpp` (+6 -1) 📝 `src/core/expert_source.cpp` (+28 -7) 📝 `src/core/peer_experts.cpp` (+82 -3) 📝 `src/core/verify.cpp` (+8 -2) 📝 `src/kernels/cpu/pool.cpp` (+8 -3) 📝 `src/program/generate.cpp` (+45 -8) </details> ### 📄 Description **Problem and result:** in peer mode (`--peer-device`) `STRATA_ADAPT_OVERLAP=1` is refused ("not with --peer-device"), so every decode window first waits for the previous adapt round's copies. On 0.2.0-beta (`main` e88ee39d) that wait is 5.0-5.2 ms of a 45 ms window. With this change the peer tier joins the overlap and the wait is 0.20-0.23 ms. Decode of 900-token greedy answers on a 161K-token conversation (3 questions x 3 rounds, decode only, medians), two runs each, alternating: | | `main`, `STRATA_ADAPT_OVERLAP=1` (refused) | this branch, same | this branch + `STRATA_PEER_LAUNCH_IN_POOL=1` | |---|---|---|---| | adaptive wait per window | 5.21 / 4.98 ms | **0.23 / 0.22 ms** | 0.22 / 0.20 ms | | window | 45.4 / 45.0 ms | 38.1 / 42.0 ms | 41.6 / 38.0 ms | | ms per token, all 9 | 11.85 / 11.79 | 11.90 / 10.45 | 10.94 / 11.59 | The wait is gone in every run; tokens per window move with the text the drafts find, so ms per token is noisier than the window (mean of the two runs: 11.82 -> 11.18, -5%). `STRATA_PEER_LAUNCH_IN_POOL` measured no gain over the overlap alone on this build (it gave +1.7% on 0.1.43); I can drop it from this PR if you prefer. **Approach:** with `STRATA_ADAPT_OVERLAP=1` `PeerExperts::adapt` issues its copies in layer order and signals each layer's landing with the primary's kind of signal (a stream-ordered D2H copy of the layer number into a pinned int, or host functions where the primary uses them), its table takes the swaps at the window's start (`flip_pending`), and a layer waits for a tier's copies only when that tier swapped in it. Without a peer the per-layer wait is the one it was; without the variable nothing changes. Separately, `STRATA_PEER_LAUNCH_IN_POOL=1` (opt-in) runs the peer's launch on the host thread right after the CPU pool's first phase is published instead of before the pool starts (with the cold-read path of 0.2.0 it starts before the CPU's batches, as before). `STRATA_DECODE_TIMING` gains a line with the peer's launch and wait. `docs/DETAILS.md`: a paragraph under `STRATA_ADAPT_OVERLAP`. **Validation** (RTX 5060 Ti 16 GB, PCIe 3.0 x8, primary + RTX 3060 12 GB, x16, `--peer-device 1`; Xeon E5-2683 v4, 64 GB DDR4 in two channels; Ubuntu, CUDA 13.3, driver 595.91; Qwen3.8-Flash-Next IQ3_XXS pack, `--kv int8 --kv-resident 32768 --spec 4 --mtp --adapt-every 1 --adapt-swaps 160 --prompt-cache 14 --pcie-frac 0`, `STRATA_DECODE_TIMING=1`; one engine start per run): - Passed: `cmake --build build --target strata` (CUDA, sm_86 + sm_120) on this branch's tree, no errors. - Passed: the default path. `main` and this branch, deterministic decode (`--spec-min-p 1.01 --suffix-draft 0 --lookup-chain 0 --adapt-swaps 0`, so no copies), `STRATA_ADAPT_OVERLAP=1`, no launch switch, a chain of 12 prompt reads with 64-token answers on a 161K conversation: 14 of 14 answers identical. - Passed: the A/B above (runs `main`, overlap, overlap + launch, then again). - Failed: none observed. - Not run: HIP, SYCL and Metal builds; Windows (the host-function signal path); a layer split; tokens compared bit for bit with the adaptive tier on (two runs of `main` already differ: the tier makes the output depend on timing). **Limits:** one rig measured. 🤖 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 changed title from [PR #2720] [Engine] --peer-device: the adaptive tier's copies land while the next window runs (opt-in STRATA_ADAPT_OVERLAP=1) to [PR #2720] [CLOSED] [Engine] --peer-device: the adaptive tier's copies land while the next window runs (opt-in STRATA_ADAPT_OVERLAP=1) 2026-11-07 16:30:25 +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#4229
No description provided.