mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #598] [CLOSED] HIP: optional sparse-row expert combination #618
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#618
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/598
Author: @LostVector
Created: 10/28/2026
Status: ❌ Closed
Base:
main← Head:upstream/hip-sparse-expert-combine📝 Commits (1)
df90078HIP: add optional sparse-row expert combination📊 Changes
6 files changed (+220 additions, -4 deletions)
View changed files
📝
CMakeLists.txt(+4 -0)📝
docs/SETTINGS.md(+19 -0)📝
src/ds4/ds4_kernels.cu(+41 -2)📝
src/ds4/ds4_kernels.cuh(+2 -1)📝
src/ds4/ds4_model.cu(+1 -1)➕
tests/ds4_sparse_combine_test.cu(+153 -0)📄 Description
This optional HIP change makes the last step of sparse expert batches much cheaper: instead of starting work for every prompt token, it visits the rows that the batch actually computed. On an R9700, current-base synthetic tests reduced this combination operator's latency by 73–93% when one matching pick touched 1–10% of a 4,096-token prompt. Earlier whole-model tests showed a much smaller 0.42–0.47% lower warm 4K prefill latency, with mixed results on other prompts. Those model numbers are historical, not a new result on this port.
Upstream already avoids reading untouched accumulators (#344 /
68c0f31). This PR adds only the distinct sparse-row dispatch; it does not claim that existing optimization as new.Enable with
MAYA_DS4_SPARSE_COMBINE=1(default off; STRATA/native aliases supported). The existing sorted row-to-token map is passed tomoe_combine. If a batch has fewer rows than prompt tokens, its first matching pick owns each token's output and adds all matching picks in their original FMA order. Duplicate token rows therefore produce one writer. Dense batches and callers without the row map retain the original kernel. CUDA retains its original execution path. There are no extra allocations, transfers, cache slots, or GPU-count assumptions.Current-base validation (
249f9a8, Release HIP, gfx1201):maya-ds4and standaloneds4_sparse_combine_testbuilds.std::fmareferences.Small/ragged cases are around launch overhead and show mixed noise. These measurements do not establish whole-model speedups or actual sparse-batch frequency. The historical model check compared 12 full-vocabulary states across three prompts and found exact outputs; frozen residency and no actual drafting limit that evidence. Current-base full-model parity/performance, adaptive-cache behavior and MTP interaction remain follow-up work. Existing serving has not been changed by this PR.
Build/run:
This is the focused current-main port of the remaining sparse-row part of fork experiment #46.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.