[PR #297] [CLOSED] perf(ds4): opt-in HIP prefill transfer pruning #454

Closed
opened 2026-10-29 21:25:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/297
Author: @LostVector
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: perf/ds4-skip-unpicked


📝 Commits (1)

  • 6f72b39 ds4: skip unselected HIP batch-prefill transfers on current upstream

📊 Changes

6 files changed (+186 additions, -1 deletions)

View changed files

📝 CMakeLists.txt (+2 -0)
📝 README.md (+6 -0)
➕ docs/ds4-skip-unpicked.md (+42 -0)
📝 src/ds4/ds4_model.cu (+56 -1)
➕ src/ds4/ds4_ram_slice.hpp (+28 -0)
➕ tests/ds4_ram_slice_test.cpp (+52 -0)

📄 Description

On our multi-GPU batch-loader setup, skipping unused expert transfers reduced copied payload by 18.7% and increased warm 4K prefill throughput by 3.6–3.9% in a current-upstream EXL3 integration. The reviewer's default single-GPU configuration used Maya's other loader, flow, which bypasses this change.

In plain terms, the batch loader can deliver weights for experts that no token needs. This option waits for routing and skips those deliveries. Applicability depends on the loader, quant, RAM mode and topology; GPU count alone does not determine whether it runs. Flow already makes most deliveries according to routing and is unchanged.

Enable DS4_SKIP_UNPICKED=1 in the native engine environment. It is off by default, HIP only, and does not change decode. Set DS4_FLOW_STATS=1 and check for "unpicked experts skipped" before comparing speed or answers: without that message, this optimization was not exercised. No GPU IDs, VRAM budgets, CPU thread counts or cache policies become defaults.

The implementation preserves virtual slots, batches, kernels and accumulation order. Explicit RAM-copy mode stages only the TP member's gate/up rows into the existing blob offsets, retaining full down rows for strided DMA. File-backed layout is unchanged. Copies still overlap computation within each layer; deferring cross-layer copies may hurt broad-routing workloads, which is why this remains opt-in.

Current-upstream integration evidence

On 8b4b39f (v1.1.29), a separate helper/packed-transfer EXL3 integration measured the following fixed-residency warm 4,096-token coding-agent prefix:

Disabled before Enabled Disabled after
Prefill time 8.690 s 8.389 s 8.716 s

Each cell averages two warm requests, with identical inputs, copied initial profiles and fixed placement. Throughput improved 3.58–3.89%; control drift was 0.30%. Reported expert payload copied per target TP member per pass fell from 141,250,490,880 to 114,879,022,848 bytes (18.67%). These are payload counters, not PCIe protocol measurements.

Two short coding/async prompts were also checked, with little timing change. All twelve sampled full-vocabulary checkpoints (three workloads, four each) matched the disabled reference byte-for-byte in every mode-0/3/0 trial; repeats also matched. Matching combine modes were compared separately. The drafter was loaded but drafting was not executed. This is not a normal-runtime MTP/decode benchmark or a standalone clean-branch timing claim.

That measured configuration used three R9700s, TP2 target layers plus a resident helper/DSpark GPU, CPU threads 8, context 262,144, chunk 4,096 and mmap off. Those are benchmark settings, not feature requirements. This clean PR includes none of the helper, drafter-placement, packed-transfer or matrix-kernel changes. Its model/header/unit-test pruning changes are identical to that validated integration port.

Earlier Q8 measurements on abc09c7 observed 2.16–2.44x faster fresh 1K–2K prefill on a different three-card setup. All 512 x 129280 float32 logits were bit-identical to the original, with an independent repeat. Those historical results do not establish a current-Q8 or general speedup. The exact settings and limitations are retained in docs/ds4-skip-unpicked.md.

Current clean-branch checks

Rebased on 8b4b39f; updated the GGUF member reader to the current mx_read_len(layer, member, projection) signature. No behavioral tuning was added.

  • Clean Release Linux HIP/gfx1201 maya-ds4 build passed.
  • CMake ds4_ram_slice_test and independent ASan/UBSan test passed: TP 1/2/4, RAM parts 1/2, gate/up and full-down spans, destination guards and invalid bounds.
  • HIP CUDA-name mapping and git diff --check passed.
  • Model added/removed lines and header/unit-test contents match the validated integration port exactly.

A new full-model standalone run on this clean branch has not been performed; integration evidence is labeled separately above. Windows/HIP Strix Halo and NVIDIA runtime validation remain outstanding. The unchanged default and flow/CUDA paths are intentional. See docs/ds4-skip-unpicked.md for reproduction and limitations.


🔄 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/mw00/project-maya/pull/297 **Author:** [@LostVector](https://github.com/LostVector) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/ds4-skip-unpicked` --- ### 📝 Commits (1) - [`6f72b39`](https://github.com/mw00/project-maya/commit/6f72b39cd0a793f5e4cd6037d37fe348dc7cdc4d) ds4: skip unselected HIP batch-prefill transfers on current upstream ### 📊 Changes **6 files changed** (+186 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+2 -0) 📝 `README.md` (+6 -0) ➕ `docs/ds4-skip-unpicked.md` (+42 -0) 📝 `src/ds4/ds4_model.cu` (+56 -1) ➕ `src/ds4/ds4_ram_slice.hpp` (+28 -0) ➕ `tests/ds4_ram_slice_test.cpp` (+52 -0) </details> ### 📄 Description **On our multi-GPU batch-loader setup, skipping unused expert transfers reduced copied payload by 18.7% and increased warm 4K prefill throughput by 3.6–3.9% in a current-upstream EXL3 integration. The reviewer's default single-GPU configuration used Maya's other loader, flow, which bypasses this change.** In plain terms, the batch loader can deliver weights for experts that no token needs. This option waits for routing and skips those deliveries. Applicability depends on the loader, quant, RAM mode and topology; GPU count alone does not determine whether it runs. Flow already makes most deliveries according to routing and is unchanged. Enable `DS4_SKIP_UNPICKED=1` in the native engine environment. It is **off by default**, HIP only, and does not change decode. Set `DS4_FLOW_STATS=1` and check for **"unpicked experts skipped"** before comparing speed or answers: without that message, this optimization was not exercised. No GPU IDs, VRAM budgets, CPU thread counts or cache policies become defaults. The implementation preserves virtual slots, batches, kernels and accumulation order. Explicit RAM-copy mode stages only the TP member's gate/up rows into the existing blob offsets, retaining full down rows for strided DMA. File-backed layout is unchanged. Copies still overlap computation within each layer; deferring cross-layer copies may hurt broad-routing workloads, which is why this remains opt-in. ### Current-upstream integration evidence On `8b4b39f` (v1.1.29), a separate helper/packed-transfer EXL3 integration measured the following fixed-residency warm 4,096-token coding-agent prefix: | | Disabled before | Enabled | Disabled after | | --- | ---: | ---: | ---: | | Prefill time | 8.690 s | 8.389 s | 8.716 s | Each cell averages two warm requests, with identical inputs, copied initial profiles and fixed placement. Throughput improved **3.58–3.89%**; control drift was 0.30%. Reported expert payload copied per target TP member per pass fell from 141,250,490,880 to 114,879,022,848 bytes (**18.67%**). These are payload counters, not PCIe protocol measurements. Two short coding/async prompts were also checked, with little timing change. All twelve sampled full-vocabulary checkpoints (three workloads, four each) matched the disabled reference byte-for-byte in every mode-0/3/0 trial; repeats also matched. Matching combine modes were compared separately. The drafter was loaded but drafting was not executed. This is not a normal-runtime MTP/decode benchmark or a standalone clean-branch timing claim. That measured configuration used three R9700s, TP2 target layers plus a resident helper/DSpark GPU, CPU threads 8, context 262,144, chunk 4,096 and mmap off. Those are benchmark settings, not feature requirements. This clean PR includes **none** of the helper, drafter-placement, packed-transfer or matrix-kernel changes. Its model/header/unit-test pruning changes are identical to that validated integration port. Earlier Q8 measurements on `abc09c7` observed 2.16–2.44x faster fresh 1K–2K prefill on a different three-card setup. All 512 x 129280 float32 logits were bit-identical to the original, with an independent repeat. Those historical results do not establish a current-Q8 or general speedup. The exact settings and limitations are retained in `docs/ds4-skip-unpicked.md`. ### Current clean-branch checks Rebased on `8b4b39f`; updated the GGUF member reader to the current `mx_read_len(layer, member, projection)` signature. No behavioral tuning was added. - Clean Release Linux HIP/gfx1201 `maya-ds4` build passed. - CMake `ds4_ram_slice_test` and independent ASan/UBSan test passed: TP 1/2/4, RAM parts 1/2, gate/up and full-down spans, destination guards and invalid bounds. - HIP CUDA-name mapping and `git diff --check` passed. - Model added/removed lines and header/unit-test contents match the validated integration port exactly. A new full-model standalone run on this clean branch has not been performed; integration evidence is labeled separately above. Windows/HIP Strix Halo and NVIDIA runtime validation remain outstanding. The unchanged default and flow/CUDA paths are intentional. See `docs/ds4-skip-unpicked.md` for reproduction and limitations. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:25:36 +07:00
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#454
No description provided.