[PR #5158] [CLOSED] [Engine] split: retain a window in every expert pool #5327

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5158
Author: @midhatn
Created: 11/3/2026
Status: ❌ Closed

Base: main ← Head: fix/split-expert-pool-floor-20261104


📝 Commits (1)

  • 60cf456 [Engine] split: retain a window in every expert pool

📊 Changes

4 files changed (+136 additions, -16 deletions)

View changed files

📝 src/split/CMakeLists.txt (+1 -1)
➕ src/split/src/expert_residency.hpp (+60 -0)
📝 src/split/src/model.cpp (+8 -15)
➕ src/split/tools/expert_residency_test.cpp (+67 -0)

📄 Description

Problem and result

Mixed-quant models can fail to load in the split engine after cold-expert offload. The global residency ranking can leave one size pool below the 2 * MAXT * TOPK slots required by Up::expert_cache(), even while other pools can still give up experts.

Reproduced on Ubuntu 26.04.1, NVIDIA 580.196.07, two V100-SXM2-16GB GPUs at 200 W, with Qwen3.8-Flash-Next Unsloth UD-Q4_K_XL, 131072 context, four lanes, FNX_ARENA=1, and FNX_EXPERT_RAM_GIB=59. The unmodified #5119 engine stopped during load:

card 0: expert cache: pool 1 has 44 slots, a window needs 320 (fewer experts in RAM)

With this fix on the same baseline and configuration, model placement and warm-up completed, the API became ready, and short, concurrent 32K, and single 128K requests completed. The engine reported a load time of 82.4 seconds. This establishes the observed loading fix; full answer-quality qualification remains incomplete.

Focused port of the planner in johnfink8/sfnx#12. V100 validation combines this fix with #5119, which provides the experimental launcher/build support. No matching Strata fix was found in the issue/PR search.

Approach

Group experts by both gate/up and down byte strides. Continue the existing cold-first ranking, but skip eviction from a pool once it reaches the required window floor. Count only actual extra evictions under VRAM pressure and report impossible placement before uploading the model.

The regression test covers rare pools, equal-total-size/different-stride pools, byte targets plus extra eviction, impossible requests, a 48-layer/512-expert case including explicit 59 GiB offload, and 1,000 comparisons with the original ordering when the floor does not constrain placement. Kernel arithmetic and numerical-test tolerances are unchanged.

Validation

Public fix: 60cf456c, based on main ffa80d73. GPU validation: 5b46abb7, a clean cherry-pick onto #5119 6ffae2d4. CUDA 12.9, GCC 14, sm70. Paths below are relative to the checkout; model and MTP paths are represented by shell variables.

Passed:

  • g++-14 -std=c++17 -O2 -Wall -Wextra -Werror src/split/tools/expert_residency_test.cpp -o /tmp/expert_residency_test, then the executable: expert_residency_test: PASS. (The retained test executable used an equivalent private output path.)
  • git diff --check.
  • Fresh CMake/Ninja Release build with CUDA enabled, tests enabled, split enabled, two cards, STRATA_SPLIT_ARCH=70, CMAKE_CUDA_ARCHITECTURES=70, STRATA_NATIVE_EXPERTS=ON, STRATA_EXPERIMENTAL_SM60=ON, GCC 14 as C++/CUDA host compiler, and llama.cpp headers at 3cf03257. Built strata-split-2, split_moe_tile_test, split_fnx_run, and the nine split host-test targets.
  • ctest --test-dir build-ws1-sm70 --output-on-failure --no-tests=error -R '^split_(expert_residency_test|batch_plan_test|pf_ring_plan_test|card_check_test|rope_test|sfnx_input_test|peer_policy_test|rccl_policy_test|selftest_policy_test)$': 9/9 passed.
  • python -m pytest tests/split tests/terminal/test_split_engine_flag.py tests/terminal/test_split_parallel.py -q: 92 passed, 5 subtests passed.
  • Real-model load through serve/server.py, which launched this engine command with the same environment as the failed control:
strata-split-2 --serve --native "$MODEL_FIRST_SHARD" --mtp "$MTP_DIR" \
  --draft-vocab "$MTP_DIR/draft_vocab.bin" --max-context 131072 \
  --spec 6 --lookup 15 --conversation-cache-mib 1024 --batch 4 --layer-split auto
  • Private API acceptance harness: four simultaneous short requests each completed 512 tokens; two simultaneous fresh 32,333-token requests and one fresh 129,001-token request completed and each recalled all three exact values placed at the beginning, middle and end. The full-context request emitted 1,138 tokens and ended normally. These are functional checks, not a broad answer-quality qualification.

Failed:

  • Unmodified control: expert-cache pool failure above.
  • The unmodified V100 tile oracle fails strict Q4_K/Q5_K equality. Independent reconstruction reproduces the observed values exactly using the existing half-scale rounding. This allocation-only patch does not change that arithmetic or mark the strict oracle passed.
  • Separately, the parser generated in the 128K answer failed four of its own five unit tests: its regular expression did not accept indentation used in its fixtures. This is a retained single-answer quality observation, not evidence that the allocation fix caused a quality change.

Not run / incomplete:

  • HIP build/device validation is unavailable locally; targeted HIP validation on this draft would help.
  • Full model-answer quality and Hermes workflow qualification are not complete.

Limits

This is an allocation fix, not a throughput claim. V100 integration uses the existing experimental host-exchange split path; this PR adds no peer transport or architecture support. Keep this PR as a draft until required backend validation is resolved.

Prepared with AI assistance; claims were checked against source, retained test output, and the real before/after load result.


🔄 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/5158 **Author:** [@midhatn](https://github.com/midhatn) **Created:** 11/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/split-expert-pool-floor-20261104` --- ### 📝 Commits (1) - [`60cf456`](https://github.com/Niko1221/Strata/commit/60cf456cf7b926f18cf22f0c7a3067bd88dd9e8c) [Engine] split: retain a window in every expert pool ### 📊 Changes **4 files changed** (+136 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/split/CMakeLists.txt` (+1 -1) ➕ `src/split/src/expert_residency.hpp` (+60 -0) 📝 `src/split/src/model.cpp` (+8 -15) ➕ `src/split/tools/expert_residency_test.cpp` (+67 -0) </details> ### 📄 Description ## Problem and result Mixed-quant models can fail to load in the split engine after cold-expert offload. The global residency ranking can leave one size pool below the `2 * MAXT * TOPK` slots required by `Up::expert_cache()`, even while other pools can still give up experts. Reproduced on Ubuntu 26.04.1, NVIDIA 580.196.07, two V100-SXM2-16GB GPUs at 200 W, with Qwen3.8-Flash-Next Unsloth UD-Q4_K_XL, 131072 context, four lanes, `FNX_ARENA=1`, and `FNX_EXPERT_RAM_GIB=59`. The unmodified #5119 engine stopped during load: ```text card 0: expert cache: pool 1 has 44 slots, a window needs 320 (fewer experts in RAM) ``` With this fix on the same baseline and configuration, model placement and warm-up completed, the API became ready, and short, concurrent 32K, and single 128K requests completed. The engine reported a load time of 82.4 seconds. This establishes the observed loading fix; full answer-quality qualification remains incomplete. ## Related discussion Focused port of the planner in johnfink8/sfnx#12. V100 validation combines this fix with #5119, which provides the experimental launcher/build support. No matching Strata fix was found in the issue/PR search. ## Approach Group experts by both gate/up and down byte strides. Continue the existing cold-first ranking, but skip eviction from a pool once it reaches the required window floor. Count only actual extra evictions under VRAM pressure and report impossible placement before uploading the model. The regression test covers rare pools, equal-total-size/different-stride pools, byte targets plus extra eviction, impossible requests, a 48-layer/512-expert case including explicit 59 GiB offload, and 1,000 comparisons with the original ordering when the floor does not constrain placement. Kernel arithmetic and numerical-test tolerances are unchanged. ## Validation Public fix: `60cf456c`, based on main `ffa80d73`. GPU validation: `5b46abb7`, a clean cherry-pick onto #5119 `6ffae2d4`. CUDA 12.9, GCC 14, sm70. Paths below are relative to the checkout; model and MTP paths are represented by shell variables. **Passed:** - `g++-14 -std=c++17 -O2 -Wall -Wextra -Werror src/split/tools/expert_residency_test.cpp -o /tmp/expert_residency_test`, then the executable: `expert_residency_test: PASS`. (The retained test executable used an equivalent private output path.) - `git diff --check`. - Fresh CMake/Ninja Release build with CUDA enabled, tests enabled, split enabled, two cards, `STRATA_SPLIT_ARCH=70`, `CMAKE_CUDA_ARCHITECTURES=70`, `STRATA_NATIVE_EXPERTS=ON`, `STRATA_EXPERIMENTAL_SM60=ON`, GCC 14 as C++/CUDA host compiler, and llama.cpp headers at `3cf03257`. Built `strata-split-2`, `split_moe_tile_test`, `split_fnx_run`, and the nine split host-test targets. - `ctest --test-dir build-ws1-sm70 --output-on-failure --no-tests=error -R '^split_(expert_residency_test|batch_plan_test|pf_ring_plan_test|card_check_test|rope_test|sfnx_input_test|peer_policy_test|rccl_policy_test|selftest_policy_test)$'`: **9/9 passed**. - `python -m pytest tests/split tests/terminal/test_split_engine_flag.py tests/terminal/test_split_parallel.py -q`: **92 passed, 5 subtests passed**. - Real-model load through `serve/server.py`, which launched this engine command with the same environment as the failed control: ```sh strata-split-2 --serve --native "$MODEL_FIRST_SHARD" --mtp "$MTP_DIR" \ --draft-vocab "$MTP_DIR/draft_vocab.bin" --max-context 131072 \ --spec 6 --lookup 15 --conversation-cache-mib 1024 --batch 4 --layer-split auto ``` - Private API acceptance harness: four simultaneous short requests each completed 512 tokens; two simultaneous fresh 32,333-token requests and one fresh 129,001-token request completed and each recalled all three exact values placed at the beginning, middle and end. The full-context request emitted 1,138 tokens and ended normally. These are functional checks, not a broad answer-quality qualification. **Failed:** - Unmodified control: expert-cache pool failure above. - The unmodified V100 tile oracle fails strict Q4_K/Q5_K equality. Independent reconstruction reproduces the observed values exactly using the existing half-scale rounding. This allocation-only patch does not change that arithmetic or mark the strict oracle passed. - Separately, the parser generated in the 128K answer failed four of its own five unit tests: its regular expression did not accept indentation used in its fixtures. This is a retained single-answer quality observation, not evidence that the allocation fix caused a quality change. **Not run / incomplete:** - HIP build/device validation is unavailable locally; targeted HIP validation on this draft would help. - Full model-answer quality and Hermes workflow qualification are not complete. ## Limits This is an allocation fix, not a throughput claim. V100 integration uses the existing experimental host-exchange split path; this PR adds no peer transport or architecture support. Keep this PR as a draft until required backend validation is resolved. Prepared with AI assistance; claims were checked against source, retained test output, and the real before/after load result. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:34:23 +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#5327
No description provided.