[PR #591] [CLOSED] ds4: DS4_TP_SHARES - uneven FFN shares on a GGUF group's member ranges #612

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/591
Author: @NenadSteric
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: pr/ds4-tp-shares-v1134


📝 Commits (1)

  • 3f3873a ds4: DS4_TP_SHARES on DS4_TP_GGUF_UNEVEN's member ranges

📊 Changes

1 file changed (+78 additions, -4 deletions)

View changed files

📝 src/ds4/ds4_model.cu (+78 -4)

📄 Description

Follow-up to #411, as mentioned there: with --tp 3 the group whose lead also holds the DSpark drafter splits every
expert evenly, so that lead caps the group and its two other members leave VRAM unused.

Problem

Maya-S, --tp 3 with uneven heads on 6x RTX 3090, DSpark on, v1.1.34: the first group's lead (drafter + its part of
the experts) has 417 MiB free, while its two other members keep 7.1 GB each unused. Every member holds the same
experts, so the group keeps 3,229 / 7,296 expert slots in VRAM.

Change

DS4_TP_SHARES (experimental, unset = unchanged) sets each member's share of a GGUF group's FFN on #408's member
ranges (DS4_TP_GGUF_UNEVEN's ff0 / ffn): w0,w1,.. per group (groups separated by /), member m taking w_m of
sum(w) equal parts of n_ff, in whole blocks of the experts' type. Patterns separated by : go round the group's
layers by index, so 2,3,4:2,4,3 gives the two other members 3.5 parts each on average. A group without an entry, or
whose pattern is not its width, keeps the whole-block split; a share that does not fall on whole blocks is refused at
load. Setting it turns on the member-range paths as DS4_TP_GGUF_UNEVEN=1 does; the chunk buffers take the widest
share, and the slot planner counts each member's room in units of its own part, so the lead's smaller part gets more
slots. One file, +78 / -4.

Every path that reads, stages or copies a member's part already takes member(l, m).ff0 / ffn (mx_read_off,
mx_read_len, down_cut, the helper's pool, TP_BORROW's slots, --parallel's batched step); none assumes an even
split. DS4_EXL3_PACKED_HOST requires one and falls back by itself (EXL3 only).

Speed

v1.1.34 + this commit, same machine, 220 W + locked clocks, DSpark on, --mmap-experts off, DS4_FLOW_TP=1, a replay
of an agent coding session at 20K / 100K / 180K context (six replies, temperature 1.0, seed 1234):

--tp 3, whole-block split --tp 3, DS4_TP_SHARES=2,3,4:2,4,3 (two runs)
first group's expert slots, lead / others 3,613 / 3,229 4,739 / 4,355
free VRAM on the first group's other members 7.1 GB each 0.5 - 0.7 GB
decode, weighted over the six replies 73.4 tok/s 85.1 / 92.2 tok/s (+16% / +26%)
the session's turn reads at 20K / 100K / 180K 865 / 503 / 758 tok/s 793 / 451 / 716 tok/s (-5 .. -10%)
a fresh 21K / 59K / 60K prompt 1085 / 1305 / 1107 tok/s 1070 / 1275 / 1067 tok/s (-1 .. -4%)

The replies are sampled, so they differ between runs (and with the prompt lookup on by default, between versions); the
two shares runs differ by 8% in weighted decode. On v1.1.27 the same pair measured 80.6 (whole blocks) vs 92.4 / 94.5
tok/s (shares). Shares cost 5 - 10% on turn reads and 1 - 4% on fresh prompts here.
The setting is for the drafter's lead: with --dspark none the same 2,3,4 leaves the lead room to spare.

Validation

Engine CLI logits of 1,024 fixed tokens (v1.1.34 + this commit, Maya-S, 6 GPUs, --dspark none, --window 1024):

KLD mean top-1 agreement
noise floor: main's layer split, 1 chunk vs 4 chunks 0.0101 97.3%
main, --tp 3 + uneven heads, vs main's layer split 0.0104 97.4%
layer split, and --tp 3 with DS4_TP_SHARES unset, vs main bit-identical
--tp 3 + DS4_TP_SHARES=2,3,4:2,4,3, vs main's layer split 0.0098 97.1%
+ DS4_TP_BORROW=1 (the members lend 3.3 - 6.3 GB), vs main's layer split 0.0093 96.5%
+ DS4_TP_BORROW=1 + DS4_FLOW_DOWN_PART=1 + DS4_FLOW_DOWN_SHARE=1, --mmap-experts on (experts streamed from the files, both switches engaged per the log) bit-identical to the borrow run with the experts in RAM

The last row is the check that the member-cut paths follow the uneven ranges: the files' rows, compacted to each
member's columns, give the same bits as the RAM copies.

--parallel 4 --multi-check (4 conversations x 32 greedy tokens): on this rig it reports 0 bit-identical rows and
different tokens from token 6 - 30 on, on main's --tp 3 as well as with shares (here ~5,400 of the experts run on
the CPU lane, whose rounding the docs allow to change the last bits). Main's layer split shows the same (0 of 60
rows, a conversation's tokens differ from token 1 on), and so does main's --tp 3 with DS4_STREAM=0 (0 of 101) - so
it comes with the CPU lane here, not with tensor parallel or this setting.

CI-equivalent: HIP name mapping passes; serve tests 463 OK (11 skipped); tools tests 576 OK (31 skipped).

Not tested: HIP at runtime; widths other than 3; the helper GPU (DS4_HELPER) beside shares (needs a 7th GPU here);
EXL3 packs (not affected: GGUF groups only).

🤖 Generated with Claude Code


🔄 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/591 **Author:** [@NenadSteric](https://github.com/NenadSteric) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/ds4-tp-shares-v1134` --- ### 📝 Commits (1) - [`3f3873a`](https://github.com/mw00/project-maya/commit/3f3873ab3ba7854928a53b6750fc0623ffc30f0d) ds4: DS4_TP_SHARES on DS4_TP_GGUF_UNEVEN's member ranges ### 📊 Changes **1 file changed** (+78 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/ds4/ds4_model.cu` (+78 -4) </details> ### 📄 Description Follow-up to #411, as mentioned there: with `--tp 3` the group whose lead also holds the DSpark drafter splits every expert evenly, so that lead caps the group and its two other members leave VRAM unused. ### Problem Maya-S, `--tp 3` with uneven heads on 6x RTX 3090, DSpark on, v1.1.34: the first group's lead (drafter + its part of the experts) has 417 MiB free, while **its two other members keep 7.1 GB each unused**. Every member holds the same experts, so the group keeps 3,229 / 7,296 expert slots in VRAM. ### Change `DS4_TP_SHARES` (experimental, unset = unchanged) sets each member's share of a GGUF group's FFN on #408's member ranges (`DS4_TP_GGUF_UNEVEN`'s `ff0` / `ffn`): `w0,w1,..` per group (groups separated by `/`), member m taking `w_m` of `sum(w)` equal parts of n_ff, in whole blocks of the experts' type. Patterns separated by `:` go round the group's layers by index, so `2,3,4:2,4,3` gives the two other members 3.5 parts each on average. A group without an entry, or whose pattern is not its width, keeps the whole-block split; a share that does not fall on whole blocks is refused at load. Setting it turns on the member-range paths as `DS4_TP_GGUF_UNEVEN=1` does; the chunk buffers take the widest share, and the slot planner counts each member's room in units of its own part, so the lead's smaller part gets more slots. One file, +78 / -4. Every path that reads, stages or copies a member's part already takes `member(l, m).ff0 / ffn` (`mx_read_off`, `mx_read_len`, `down_cut`, the helper's pool, `TP_BORROW`'s slots, `--parallel`'s batched step); none assumes an even split. `DS4_EXL3_PACKED_HOST` requires one and falls back by itself (EXL3 only). ### Speed v1.1.34 + this commit, same machine, 220 W + locked clocks, DSpark on, `--mmap-experts off`, `DS4_FLOW_TP=1`, a replay of an agent coding session at 20K / 100K / 180K context (six replies, temperature 1.0, seed 1234): | | `--tp 3`, whole-block split | `--tp 3`, `DS4_TP_SHARES=2,3,4:2,4,3` (two runs) | |---|---|---| | first group's expert slots, lead / others | 3,613 / 3,229 | **4,739 / 4,355** | | free VRAM on the first group's other members | 7.1 GB each | 0.5 - 0.7 GB | | decode, weighted over the six replies | 73.4 tok/s | **85.1 / 92.2 tok/s (+16% / +26%)** | | the session's turn reads at 20K / 100K / 180K | 865 / 503 / 758 tok/s | 793 / 451 / 716 tok/s (-5 .. -10%) | | a fresh 21K / 59K / 60K prompt | 1085 / 1305 / 1107 tok/s | 1070 / 1275 / 1067 tok/s (-1 .. -4%) | The replies are sampled, so they differ between runs (and with the prompt lookup on by default, between versions); the two shares runs differ by 8% in weighted decode. On v1.1.27 the same pair measured 80.6 (whole blocks) vs 92.4 / 94.5 tok/s (shares). Shares cost 5 - 10% on turn reads and 1 - 4% on fresh prompts here. The setting is for the drafter's lead: with `--dspark none` the same `2,3,4` leaves the lead room to spare. ### Validation Engine CLI logits of 1,024 fixed tokens (v1.1.34 + this commit, Maya-S, 6 GPUs, `--dspark none`, `--window 1024`): | | KLD mean | top-1 agreement | |---|---|---| | noise floor: main's layer split, 1 chunk vs 4 chunks | 0.0101 | 97.3% | | main, `--tp 3` + uneven heads, vs main's layer split | 0.0104 | 97.4% | | layer split, and `--tp 3` with `DS4_TP_SHARES` unset, vs main | bit-identical | | | `--tp 3` + `DS4_TP_SHARES=2,3,4:2,4,3`, vs main's layer split | 0.0098 | 97.1% | | + `DS4_TP_BORROW=1` (the members lend 3.3 - 6.3 GB), vs main's layer split | 0.0093 | 96.5% | | + `DS4_TP_BORROW=1` + `DS4_FLOW_DOWN_PART=1` + `DS4_FLOW_DOWN_SHARE=1`, `--mmap-experts on` (experts streamed from the files, both switches engaged per the log) | bit-identical to the borrow run with the experts in RAM | | The last row is the check that the member-cut paths follow the uneven ranges: the files' rows, compacted to each member's columns, give the same bits as the RAM copies. `--parallel 4 --multi-check` (4 conversations x 32 greedy tokens): on this rig it reports 0 bit-identical rows and different tokens from token 6 - 30 on, **on main's `--tp 3` as well as with shares** (here ~5,400 of the experts run on the CPU lane, whose rounding the docs allow to change the last bits). Main's layer split shows the same (0 of 60 rows, a conversation's tokens differ from token 1 on), and so does main's `--tp 3` with `DS4_STREAM=0` (0 of 101) - so it comes with the CPU lane here, not with tensor parallel or this setting. CI-equivalent: HIP name mapping passes; serve tests 463 OK (11 skipped); tools tests 576 OK (31 skipped). Not tested: HIP at runtime; widths other than 3; the helper GPU (`DS4_HELPER`) beside shares (needs a 7th GPU here); EXL3 packs (not affected: GGUF groups only). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:27:28 +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#612
No description provided.