[PR #864] [CLOSED] perf: opt-in resident expert exchange buffer rotation #2883

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/864
Author: @CC-David-CC
Created: 10/5/2026
Status: ❌ Closed

Base: main ← Head: perf/exchange-rotation-only


📝 Commits (3)

  • 18a30ad perf: opt in to resident expert exchange buffer rotation
  • 13936d2 bench: verify rotation-only build with an exact native 1K pair
  • 92a6517 bench: document the standard Q2 token-identical rotation pair

📊 Changes

10 files changed (+849 additions, -9 deletions)

View changed files

📝 CMakeLists.txt (+8 -0)
➕ bench/results/exchange-rotation-ab.json (+288 -0)
➕ bench/results/exchange-rotation-token-ids.json (+1 -0)
➕ docs/EXCHANGE_ROTATION.md (+139 -0)
➕ include/strata/core/exchange_storage.hpp (+114 -0)
📝 include/strata/core/expert_source.hpp (+7 -0)
📝 src/core/expert_source.cpp (+59 -8)
📝 src/program/generate.cpp (+4 -0)
➕ tests/core/exchange_storage_test.cpp (+133 -0)
📝 tests/core/file_expert_source_test.cpp (+96 -1)

📄 Description

Resident RAM exchanges copy each evicted expert from a temporary buffer into the promoted expert's old slot. This patch rotates buffer ownership after the existing reader/transfer completion boundary, removing that host copy.

Clean extraction of aa6e0e3 + 1a50d91 and their tests, as requested in #689, based on upstream 6f32ec0. Includes the focused guide and one Q2_0 A/B. Q8 PLE support and the broader performance experiments remain separate.

STRATA_EXCHANGE_ROTATE=1 opts in; default off. It requires equal-size expert blocks and fully pinned/mapped resident and exchange buffers. Other layouts keep the existing copy path. Presets, placement policy and GPU synchronization are unchanged; configurations without the resident RAM complement do not use rotation.

Validation

  • Clean code at 18a30ad775bce86e99a54e6dc552ccb72c66d16e; same binary in both arms. RTX PRO 6000 Blackwell 96GB, Ryzen 7950X, GCC 13.3, CUDA 13.2.
  • Standard GSQ-RCO Q2_0 and matching IQ4_NL PLE; both shards SHA-256 verified. Same 1,024 input tokens, fresh engine per arm, all 1,024 generated token IDs identical. FP16 KV, greedy target-only, zero drafts and prompt reuse.
  • CPU ownership checks (12,304 exchanges), both CTest checks, and CUDA copy/rotation/pageable-fallback fixtures passed. ASan/UBSan passed; Compute Sanitizer reported 0 errors.
Rotation Decode tokens/s Resident exchanges Avoided host-copy payload Output IDs
0 104.90 3,802 0 bytes 1,024, identical
1 113.44 3,802 5,255,884,800 bytes 1,024, identical

The GPU cache was deliberately capped at 12,000 slots to exercise the 16.19 GiB RAM complement; Q2 can fit fully on this card. One pair, rates exclude startup/prefill, EOS sentinel forces the exact length. No general speedup, model-quality or speculative-path parity claim. AMD and Windows GPU execution remain untested.

Guide and verification commands | Receipt | Raw token IDs


🔄 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/864 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/exchange-rotation-only` --- ### 📝 Commits (3) - [`18a30ad`](https://github.com/Niko1221/Strata/commit/18a30ad775bce86e99a54e6dc552ccb72c66d16e) perf: opt in to resident expert exchange buffer rotation - [`13936d2`](https://github.com/Niko1221/Strata/commit/13936d238cfee2e689431b5840f1eb151a58ecaf) bench: verify rotation-only build with an exact native 1K pair - [`92a6517`](https://github.com/Niko1221/Strata/commit/92a65170b783ffd578646f617bf1059a1d4bdada) bench: document the standard Q2 token-identical rotation pair ### 📊 Changes **10 files changed** (+849 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+8 -0) ➕ `bench/results/exchange-rotation-ab.json` (+288 -0) ➕ `bench/results/exchange-rotation-token-ids.json` (+1 -0) ➕ `docs/EXCHANGE_ROTATION.md` (+139 -0) ➕ `include/strata/core/exchange_storage.hpp` (+114 -0) 📝 `include/strata/core/expert_source.hpp` (+7 -0) 📝 `src/core/expert_source.cpp` (+59 -8) 📝 `src/program/generate.cpp` (+4 -0) ➕ `tests/core/exchange_storage_test.cpp` (+133 -0) 📝 `tests/core/file_expert_source_test.cpp` (+96 -1) </details> ### 📄 Description Resident RAM exchanges copy each evicted expert from a temporary buffer into the promoted expert's old slot. This patch rotates buffer ownership after the existing reader/transfer completion boundary, removing that host copy. Clean extraction of `aa6e0e3` + `1a50d91` and their tests, as requested in #689, based on upstream `6f32ec0`. Includes the focused guide and one Q2_0 A/B. Q8 PLE support and the broader performance experiments remain separate. `STRATA_EXCHANGE_ROTATE=1` opts in; default off. It requires equal-size expert blocks and fully pinned/mapped resident and exchange buffers. Other layouts keep the existing copy path. Presets, placement policy and GPU synchronization are unchanged; configurations without the resident RAM complement do not use rotation. ### Validation - Clean code at `18a30ad775bce86e99a54e6dc552ccb72c66d16e`; same binary in both arms. RTX PRO 6000 Blackwell 96GB, Ryzen 7950X, GCC 13.3, CUDA 13.2. - Standard GSQ-RCO Q2_0 and matching IQ4_NL PLE; both shards SHA-256 verified. Same 1,024 input tokens, fresh engine per arm, **all 1,024 generated token IDs identical**. FP16 KV, greedy target-only, zero drafts and prompt reuse. - CPU ownership checks (12,304 exchanges), both CTest checks, and CUDA copy/rotation/pageable-fallback fixtures passed. ASan/UBSan passed; Compute Sanitizer reported 0 errors. | Rotation | Decode tokens/s | Resident exchanges | Avoided host-copy payload | Output IDs | |---|---:|---:|---:|---| | `0` | 104.90 | 3,802 | 0 bytes | 1,024, identical | | `1` | 113.44 | 3,802 | 5,255,884,800 bytes | 1,024, identical | The GPU cache was deliberately capped at 12,000 slots to exercise the 16.19 GiB RAM complement; Q2 can fit fully on this card. One pair, rates exclude startup/prefill, EOS sentinel forces the exact length. No general speedup, model-quality or speculative-path parity claim. AMD and Windows GPU execution remain untested. [Guide and verification commands](https://github.com/CC-David-CC/Strata-a5500/blob/perf/exchange-rotation-only/docs/EXCHANGE_ROTATION.md) | [Receipt](https://github.com/CC-David-CC/Strata-a5500/blob/perf/exchange-rotation-only/bench/results/exchange-rotation-ab.json) | [Raw token IDs](https://github.com/CC-David-CC/Strata-a5500/blob/perf/exchange-rotation-only/bench/results/exchange-rotation-token-ids.json) --- <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:50 +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#2883
No description provided.