[PR #470] HIP EXL3: specialize single-row decode by default #547

Open
opened 2026-10-29 21:26:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/470
Author: @LostVector
Created: 10/25/2026
Status: 🔄 Open

Base: main ← Head: upstream/hip-exl3-single-row


📝 Commits (3)

  • 3584172 HIP EXL3: add opt-in single-row decode kernel
  • 978c589 docs: scope current single-row decode measurements and numerical checks
  • 2c395ec HIP: select the EXL3 single-row kernel by default with explicit opt-out

📊 Changes

4 files changed (+147 additions, -22 deletions)

View changed files

📝 CMakeLists.txt (+6 -0)
📝 docs/SETTINGS.md (+25 -0)
📝 src/kernels/cuda/exl3.cu (+57 -22)
📝 tests/exl3_test.cu (+59 -0)

📄 Description

A controlled DS4 screen on three R9700s measured 4.4% higher token-generation throughput with draft proposals disabled (3.4–5.0% across three workloads). MTP improved about 0.7%. This gives one-token EXL3 matrix calls a smaller GPU kernel: their shared-memory buffers and accumulators hold one activation row instead of eight. On HIP, eligible one-row batches now select this kernel automatically.

No setting is needed on HIP. Set DS4_EXL3_MV1=0 to force the generic path; unset it or use 1 to restore automatic single-row selection. Every job in a batch must have one row to select the specialization. A batch containing any multi-row job keeps the generic kernel. Routed-expert kernels keep their existing path, and the input-split planner and partial-sum order stay unchanged. There is no new expanded-weight cache, quantization change, or expert-capacity change.

Measured on upstream 4615f34 (v1.1.27), Ryzen 9950X / 256 GB RAM, three R9700s, ROCm 7.14/gfx1201:

Workload Decode with proposals disabled, flag 0 → 1 Gain MTP gain
Coding 17.88 → 18.50 tok/s +3.43% +0.73%
Async coding 18.28 → 19.15 tok/s +4.75% +0.62%
16K agent context 17.46 → 18.32 tok/s +4.96% +0.82%

The native-driver test used one loaded model, fixed expert placement (--no-expert-cache), and four adjacent counterbalanced on/off pairs per workload and drafting mode. Each measured request produced 128 tokens; all 12 pairs without proposals improved. The same 4-bit drafter stayed loaded on GPU2 in both modes to preserve VRAM allocation; spec=0 suppresses proposals and may still maintain drafter state. The target was DeepSeek-V4.1-Flash-1017 EXL3 3.5bpw, TP2 split 36/4, CPU 16, confidence 0.65 / cumulative 0.5, maximum context 262144, prefill chunks 4096. Tested prompts extend to 16K, not the maximum context.

The benchmark model also included draft #464's optional drafter placement. A private host-only diagnostic selector chose the existing generic/single-row entry points between requests; production GPU kernel code was unchanged. That selector and the diagnostic dump toggle are not part of this PR. Full-logit dumps ran separately after timed requests. An initial four-load ABBA comparison was not accepted as confirmation because its controls drifted substantially; the same-residency follow-up controls reload-related variation but is not an independent fresh-load performance replication or production API acceptance.

Validation:

  • Clean HIP Release CMake builds of maya-ds4 and exl3_test pass. HIP CTest entries cover default selection, explicit enable and generic opt-out; rollback is documented.
  • Nine expanded operator-suite runs pass: stock, candidate off, candidate on across all three cards, with zero failures and launch errors. Includes 27 guarded mixed one-/three-row cases with strided inputs, integer bitrate/codebook combinations, and supported half-integer bitrates.
  • Representative operator benchmark outputs match stock bit for bit in all modes: 346,112 finite floats per saved output. Projection/shared-layer operator gains are larger than the model gain; two noisy timing cells are retained rather than used for precise claims.
  • All 48 timed model requests have matching output tokens, accepted/offered counts, and cache-hit/lookup totals across paired flag states. No request-time eviction or process/host swap was observed, including warmups and diagnostics.
  • Full-vocabulary dumps for 24 reference states match across off/on and both repeats: 96 snapshots, 12,410,880 finite float values examined. These are bounded numerical checks, not a broad-quality proof.

NVIDIA/Windows runtime and other GPU architectures remain unvalidated. The observed MTP benefit is small; the measured benefit is primarily ordinary one-token decoding. The HIP single-row default changes in this proposal; the running serving configuration was not changed. Earlier experiments are retained in fork PR https://github.com/LostVector/project-maya/pull/51; their older API measurements do not validate this newer engine.

Current-base rebase validation (f031a23, v1.1.36): rebased while preserving upstream high-bitrate batch and MoE coverage. The HIP operator test compiles and links for gfx1100 and gfx1201. Both full operator suites, with DS4_EXL3_MV1=0 and 1, pass on an R9700 with zero failures and launch errors, including the mixed-row fallback checks. No fresh whole-model throughput or quality comparison is claimed, and RDNA3/NVIDIA/Windows hardware were not tested in this preparation.

Automatic selection and rollback validation

Eligible HIP batches now select the single-row specialization by default. Every job must have exactly one activation row; mixed or multi-row batches retain the generic kernel. DS4_EXL3_MV1=0 forces the generic path, while unset or 1 permits automatic selection. Code comments document the batch-wide guard and unchanged input-split/reduction ordering.

The updated operator binary builds for gfx1100 and gfx1201. On an R9700, all three full CTest suites pass: default environment, explicit DS4_EXL3_MV1=1, and explicit 0. Each reports zero failures and launch errors, retaining existing CPU-reference tolerances, exact comparisons, mixed-row fallback checks and output guards. No tolerance was relaxed. This validates the default change and fallback; the throughput figures above remain the historical model measurements, not a new performance benchmark. The running serving process was not changed.


🔄 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/470 **Author:** [@LostVector](https://github.com/LostVector) **Created:** 10/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `upstream/hip-exl3-single-row` --- ### 📝 Commits (3) - [`3584172`](https://github.com/mw00/project-maya/commit/3584172194644c17e515251a71199e32ea104495) HIP EXL3: add opt-in single-row decode kernel - [`978c589`](https://github.com/mw00/project-maya/commit/978c58950748b4e7b0eac1dd24337f2b732969e7) docs: scope current single-row decode measurements and numerical checks - [`2c395ec`](https://github.com/mw00/project-maya/commit/2c395ec3a8e93bf9d560ac8e26800cc47eed21c3) HIP: select the EXL3 single-row kernel by default with explicit opt-out ### 📊 Changes **4 files changed** (+147 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+6 -0) 📝 `docs/SETTINGS.md` (+25 -0) 📝 `src/kernels/cuda/exl3.cu` (+57 -22) 📝 `tests/exl3_test.cu` (+59 -0) </details> ### 📄 Description A controlled DS4 screen on three R9700s measured **4.4% higher token-generation throughput with draft proposals disabled** (3.4–5.0% across three workloads). MTP improved about 0.7%. This gives one-token EXL3 matrix calls a smaller GPU kernel: their shared-memory buffers and accumulators hold one activation row instead of eight. On HIP, eligible one-row batches now select this kernel automatically. No setting is needed on HIP. Set `DS4_EXL3_MV1=0` to force the generic path; unset it or use `1` to restore automatic single-row selection. Every job in a batch must have one row to select the specialization. A batch containing any multi-row job keeps the generic kernel. Routed-expert kernels keep their existing path, and the input-split planner and partial-sum order stay unchanged. There is no new expanded-weight cache, quantization change, or expert-capacity change. Measured on upstream **4615f34 (v1.1.27)**, Ryzen 9950X / 256 GB RAM, three R9700s, ROCm 7.14/gfx1201: | Workload | Decode with proposals disabled, flag 0 → 1 | Gain | MTP gain | | --- | ---: | ---: | ---: | | Coding | 17.88 → 18.50 tok/s | +3.43% | +0.73% | | Async coding | 18.28 → 19.15 tok/s | +4.75% | +0.62% | | 16K agent context | 17.46 → 18.32 tok/s | +4.96% | +0.82% | The native-driver test used one loaded model, fixed expert placement (`--no-expert-cache`), and four adjacent counterbalanced on/off pairs per workload and drafting mode. Each measured request produced 128 tokens; all 12 pairs without proposals improved. The same 4-bit drafter stayed loaded on GPU2 in both modes to preserve VRAM allocation; `spec=0` suppresses proposals and may still maintain drafter state. The target was DeepSeek-V4.1-Flash-1017 EXL3 3.5bpw, TP2 split 36/4, CPU 16, confidence 0.65 / cumulative 0.5, maximum context 262144, prefill chunks 4096. Tested prompts extend to 16K, not the maximum context. The benchmark model also included draft #464's optional drafter placement. A **private host-only diagnostic selector** chose the existing generic/single-row entry points between requests; production GPU kernel code was unchanged. That selector and the diagnostic dump toggle are not part of this PR. Full-logit dumps ran separately after timed requests. An initial four-load ABBA comparison was **not accepted as confirmation** because its controls drifted substantially; the same-residency follow-up controls reload-related variation but is not an independent fresh-load performance replication or production API acceptance. Validation: - Clean HIP Release CMake builds of `maya-ds4` and `exl3_test` pass. HIP CTest entries cover default selection, explicit enable and generic opt-out; rollback is documented. - Nine expanded operator-suite runs pass: stock, candidate off, candidate on across all three cards, with zero failures and launch errors. Includes 27 guarded mixed one-/three-row cases with strided inputs, integer bitrate/codebook combinations, and supported half-integer bitrates. - Representative operator benchmark outputs match stock bit for bit in all modes: 346,112 finite floats per saved output. Projection/shared-layer operator gains are larger than the model gain; two noisy timing cells are retained rather than used for precise claims. - All 48 timed model requests have matching output tokens, accepted/offered counts, and cache-hit/lookup totals across paired flag states. No request-time eviction or process/host swap was observed, including warmups and diagnostics. - Full-vocabulary dumps for 24 reference states match across off/on and both repeats: 96 snapshots, 12,410,880 finite float values examined. These are bounded numerical checks, not a broad-quality proof. NVIDIA/Windows runtime and other GPU architectures remain unvalidated. The observed MTP benefit is small; the measured benefit is primarily ordinary one-token decoding. The HIP single-row default changes in this proposal; the running serving configuration was not changed. Earlier experiments are retained in fork PR https://github.com/LostVector/project-maya/pull/51; their older API measurements do not validate this newer engine. Current-base rebase validation (`f031a23`, v1.1.36): rebased while preserving upstream high-bitrate batch and MoE coverage. The HIP operator test compiles and links for gfx1100 and gfx1201. Both full operator suites, with `DS4_EXL3_MV1=0` and `1`, pass on an R9700 with zero failures and launch errors, including the mixed-row fallback checks. No fresh whole-model throughput or quality comparison is claimed, and RDNA3/NVIDIA/Windows hardware were not tested in this preparation. ### Automatic selection and rollback validation Eligible HIP batches now select the single-row specialization by default. Every job must have exactly one activation row; mixed or multi-row batches retain the generic kernel. `DS4_EXL3_MV1=0` forces the generic path, while unset or `1` permits automatic selection. Code comments document the batch-wide guard and unchanged input-split/reduction ordering. The updated operator binary builds for gfx1100 and gfx1201. On an R9700, all three full CTest suites pass: default environment, explicit `DS4_EXL3_MV1=1`, and explicit `0`. Each reports zero failures and launch errors, retaining existing CPU-reference tolerances, exact comparisons, mixed-row fallback checks and output guards. No tolerance was relaxed. This validates the default change and fallback; the throughput figures above remain the historical model measurements, not a new performance benchmark. The running serving process was not changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#547
No description provided.