mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #408] [MERGED] ds4: MAYA_DS4_TP_GGUF_UNEVEN - tensor parallel 2 on Maya's quants (whole blocks, as even as they go), with DS4_FLOW_TP on its groups #517
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#517
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/408
Author: @pepuscz
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @mw00
Base:
main← Head:pr/ds4-tp-uneven📝 Commits (2)
6c3f554ds4: MAYA_DS4_TP_GGUF_UNEVEN - tensor parallel 2 on Maya's quants, the experts split in whole blocks as even as they gobfcc751ds4: DS4_FLOW_TP on MAYA_DS4_TP_GGUF_UNEVEN's groups - each member streams its own part, the down gathered on the device📊 Changes
5 files changed (+759 additions, -80 deletions)
View changed files
📝
docs/SETTINGS.md(+19 -0)📝
src/ds4/ds4_kernels.cu(+14 -0)📝
src/ds4/ds4_kernels.cuh(+2 -0)📝
src/ds4/ds4_model.cu(+632 -80)➕
tools/test_ds4_tp_uneven.py(+92 -0)📄 Description
What. A GGUF's experts split between a tensor-parallel group's GPUs only in whole blocks of their type. Maya's quants
use 256-value blocks (n_ff 2304 = 9 blocks), so
--tp 2(or 4, 8) falls back to 1: "tensor parallel 2 -> 1", eachGPU its own layers. With
MAYA_DS4_TP_GGUF_UNEVEN=1a member takes whole blocks as even as they go, 5 + 4 for twoGPUs, the odd block going round the members layer by layer, as EXL3's split128 does.
splitb: split128's rule for any block size; split128 is splitb in 128s, unchanged.load_experts_mx,swap_in_mx,DS4_CHECK_SWAPS);chunk_dimssizes for the widest member.mat_bf16takes an explicit one); the load is refused if it isnot as wide as the routed experts.
room from the same snapshot, a slot fewer at a time (
trim_to_fit), else the load is refused.DS4_FLOW_TP=1the members take the prompt flow too: each reads its own gate / up rows (#377's staging, with themember's range), and an uneven member's down is copied whole into a device scratch and gathered (
gather_cols) - a2D copy of its rows cost 34.5-35.3 ms a call against 0.65-0.73 ms on an RX 7900 XTX. Off the flow, a group's prompt
chunks stream every slot-less expert through the group's windows, which on a disk-streaming box is much slower
(3,981 tokens: 431.6 s against 37.8 s on the flow, on our earlier build).
MAYA_DS4_TP_CHECK=1(at load, before any request), for each expert format and rotation: one token through everymember's parts as decode runs them, summed on the host and compared with the whole (the CPU lane's sums, the shared
expert with the GPU's int8 rounding), and, with the flow, one expert through the flow's copy into a guarded buffer,
byte for byte. More than 1e-3 of the largest output, a value that is not finite, a CUDA error or no end fails the
start.
Changes.
src/ds4/ds4_model.cu,src/ds4/ds4_kernels.cu/.cuh(gather_cols),docs/SETTINGS.md, andtools/test_ds4_tp_uneven.py(compiles the engine'ssplitb/split128, CPU only). Unset, every path is as before.The engine reads
STRATA_DS4_TP_GGUF_UNEVEN/STRATA_DS4_TP_CHECK(andDS4_*), as for the otherMAYA_DS4_*settings.
Verified. The load (
MAYA_DS4_TP_GGUF_UNEVEN=1 MAYA_DS4_TP_CHECK=1 DS4_FLOW_TP=1,--tp 2):The four parts-against-the-whole checks came to 1.0e-07 - 2.1e-07 of the largest output (routed) and 0.9e-07 -
1.6e-07 (shared). Perplexity,
--pplover 23 sequences / 47,081 tokens: main's--tp 2(its fallback to 1)7.2526, with the setting 7.2519 (0.01% apart).
Speed, tok/s - one 2,048-token prompt and 512 greedy tokens, a cold and a warm pass a load, two loads a side (load 1,
load 2):
--tp 2MAYA_DS4_TP_GGUF_UNEVEN=1,DS4_FLOW_TP=1Decode +4% cold and +12% warm (means), prefill 3% slower. About a fifth of the experts fit in VRAM either way (3,166
of 15,360 split by layers, 3,014 in two parts), so both are mostly the CPU lane and the disk; the gain is both GPUs
on every layer. The greedy streams part at the second token, a near tie: main's own two loads split there too (and at
199), its cold and warm passes differ, and with the setting both loads' streams are identical.
Test setup. Measured on v1.1.23 + main's commits after it (#382, #380, #379, #377, #370, #369, #381, #368; main at
c9683e3) + this branch. Rebased onto v1.1.24 (25deec5) without conflicts; the change's lines are the same, and main'sengine change since (
df7e8b9) is Windows-only. HIP build (ROCm 7.2.4,gfx1100;gfx1151), 2x RX 7900 XTX (gfx1100), theengine CLI. Model: DeepSeek-V4.1-Flash-1017 Maya-S (the IQ2_XXS / IQ2_S experts with IQ3_XXS / IQ3_S down, the pack's
four shards; not the newer Maya-XS, which this did not test).
Same binary both ways:
--tp 2as main runs it (its fallback to 1) against--tp 2withMAYA_DS4_TP_GGUF_UNEVEN=1MAYA_DS4_TP_CHECK=1DS4_FLOW_TP=1;--dspark none, 128K context, the same expert profile, an emptyMAYA_DS4_LT_STOREeach run. Perplexity as #344 measured it:--pplover 23 sequences of 2048 tokens (this repo'sdocs and DS4 sources). Speed on a 2,048-token prompt: a 16K one on main's fallback (its CPU lane, 16 threads, on
8,192-token chunks) took this box's CPU to its 95 °C limit. This is a correctness check and one same-binary speed
comparison, not a quality or DSpark qualification.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.