[PR #411] [CLOSED] ds4: opt-in tensor parallel with uneven heads for GGUF packs #518

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

📋 Pull Request Information

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

Base: main ← Head: pr/ds4-tp-uneven-heads


📝 Commits (1)

  • 3f5bcd2 ds4: opt-in tensor parallel with uneven heads for GGUF packs

📊 Changes

2 files changed (+27 additions, -5 deletions)

View changed files

📝 docs/SETTINGS.md (+10 -0)
📝 src/ds4/ds4_model.cu (+17 -5)

📄 Description

Follow-up to #377, which mentioned this patch under Next.

Problem

A GGUF pack only forms a tensor parallel group whose width divides the attention heads (64) and the output groups
(8). For Maya-S and Maya-XS that leaves no group at all:

--tp heads (64) / groups (8) experts (n_ff 2304, 256-value blocks) result on main
2 split 1152 rows a member = 4.5 blocks falls back to 1
3 do not split 768 rows a member = 3 blocks falls back to 1
4 split 576 rows a member = 2.25 blocks falls back to 1

So these packs always run as a plain layer split: one GPU computes each layer while the others wait.

Change

DS4_TP_UNEVEN_HEADS=1 (experimental, default off) keeps a width that the heads do not divide. The group then takes
the heads the way a non-GGUF pack's group already does (head_members): the heads go over the most members they
split among evenly (64 over 3: 2 members of 32), and the remaining member computes only its FFN share. The head
(vocabulary 129280) does not split in 3 either, so a BF16 / Q8_0 head whose vocabulary does not split evenly takes
split128 shares (337 / 337 / 336 blocks of 128), as an EXL3 head does.

Unset, nothing changes: the width check is the old one, and the two split changes are only reachable where main
fails the load ("... do not split in 3 parts"). A short section in docs/SETTINGS.md describes the setting.

Why it matters

On 6x RTX 3090 / 256 GB RAM, DeepSeek V4.1 Flash 1017 Maya-S (DSpark on, --mmap-experts off, DS4_FLOW_TP=1), this
branch's --tp 3 (two groups of three GPUs; measured on v1.1.24) against main's layer split over the same six GPUs, in a replay of an
agent coding session at 20K / 100K / 180K context:

layer split (main v1.1.24) --tp 3, this PR (two runs)
decode, weighted over 6 replies 63.5 tok/s 74.5 tok/s (+17%)
the session's next turn read at 20K / 100K / 180K 501 / 395 / 645 tok/s 732 / 449 / 677 tok/s (+46 / +14 / +5%)
an 8K-token turn read at 20K / 100K / 180K 498 / 732 / 625 tok/s 726 / 800 / 622 tok/s (+46 / +9 / 0%)
a fresh 20K / 100K / 180K prompt 1114 / 1564 / 1315 tok/s 1053 / 1200 / 1022 tok/s (-5 / -23 / -22%)

So it helps what an agent session does: decode, and the turn reads that follow a cached prefix. Only a long prompt
read from an empty cache (a new server, or a long session resumed on one) is slower, since the layer split reads it
through six pipelined stages instead of two; an agent session does that at most once. It is also the plain patch: the group's lead also
holds the DSpark drafter, so with even FFN shares the other two members of that group keep 7.3 GB of VRAM each
unused. The follow-up below fills it.

Validation

Engine CLI logits of 1,024 fixed tokens on this branch (v1.1.25 + this commit; the same figures on v1.1.24), Maya-S over 6 GPUs, --mmap-experts off,
--window 1024, compared with main's layer split:

KLD mean top-1 agreement
reference noise: main's layer split, 1 chunk vs 4 chunks (DS4_CHUNK=256) 0.0086 96.9%
this PR, --tp 3 + DS4_TP_UNEVEN_HEADS=1 + DS4_FLOW_TP=1 0.0100 96.2%
this PR, layer split (--tp 1) vs main bit-identical
this PR, --tp 3 with the setting unset vs main (both fall back to one GPU a layer group) bit-identical

All logits finite. On v1.1.20 the same patch gave KLD 0.0096 - 0.0103; the tokens that differ sit at near-ties (top-1
margin median 0.13 - 0.16).

CI-equivalent: HIP name mapping passes; server tests 342 OK (10 skipped); tools tests 384 OK (28 skipped).

Not tested: HIP at runtime; widths other than 3; EXL3 packs (they do not use this check).

Next

  • Uneven FFN shares per group member (DS4_TP_SHARES) - the lead takes a smaller share and the others fill their
    VRAM: in the same replay decode 83.0 tok/s (+31% over the layer split), turn reads +11 - 57%.

🤖 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/411 **Author:** [@NenadSteric](https://github.com/NenadSteric) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/ds4-tp-uneven-heads` --- ### 📝 Commits (1) - [`3f5bcd2`](https://github.com/mw00/project-maya/commit/3f5bcd2f0c50e533a8e7b6c20f8801e475da5eed) ds4: opt-in tensor parallel with uneven heads for GGUF packs ### 📊 Changes **2 files changed** (+27 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/SETTINGS.md` (+10 -0) 📝 `src/ds4/ds4_model.cu` (+17 -5) </details> ### 📄 Description Follow-up to #377, which mentioned this patch under *Next*. ### Problem A GGUF pack only forms a tensor parallel group whose width divides the attention heads (64) and the output groups (8). For Maya-S and Maya-XS that leaves no group at all: | `--tp` | heads (64) / groups (8) | experts (n_ff 2304, 256-value blocks) | result on main | |---|---|---|---| | 2 | split | 1152 rows a member = 4.5 blocks | falls back to 1 | | 3 | do not split | 768 rows a member = 3 blocks | falls back to 1 | | 4 | split | 576 rows a member = 2.25 blocks | falls back to 1 | So these packs always run as a plain layer split: one GPU computes each layer while the others wait. ### Change `DS4_TP_UNEVEN_HEADS=1` (experimental, default off) keeps a width that the heads do not divide. The group then takes the heads the way a non-GGUF pack's group already does (`head_members`): the heads go over the most members they split among evenly (64 over 3: 2 members of 32), and the remaining member computes only its FFN share. The head (vocabulary 129280) does not split in 3 either, so a BF16 / Q8_0 head whose vocabulary does not split evenly takes `split128` shares (337 / 337 / 336 blocks of 128), as an EXL3 head does. Unset, nothing changes: the width check is the old one, and the two split changes are only reachable where main fails the load ("... do not split in 3 parts"). A short section in `docs/SETTINGS.md` describes the setting. ### Why it matters On **6x RTX 3090 / 256 GB RAM, DeepSeek V4.1 Flash 1017 Maya-S** (DSpark on, `--mmap-experts off`, `DS4_FLOW_TP=1`), this branch's `--tp 3` (two groups of three GPUs; measured on v1.1.24) against main's layer split over the same six GPUs, in a replay of an agent coding session at 20K / 100K / 180K context: | | layer split (main v1.1.24) | `--tp 3`, this PR (two runs) | |---|---|---| | decode, weighted over 6 replies | 63.5 tok/s | **74.5 tok/s (+17%)** | | the session's next turn read at 20K / 100K / 180K | 501 / 395 / 645 tok/s | 732 / 449 / 677 tok/s (+46 / +14 / +5%) | | an 8K-token turn read at 20K / 100K / 180K | 498 / 732 / 625 tok/s | 726 / 800 / 622 tok/s (+46 / +9 / 0%) | | a fresh 20K / 100K / 180K prompt | 1114 / 1564 / 1315 tok/s | 1053 / 1200 / 1022 tok/s (-5 / -23 / -22%) | So it helps what an agent session does: decode, and the turn reads that follow a cached prefix. Only a long prompt read from an empty cache (a new server, or a long session resumed on one) is slower, since the layer split reads it through six pipelined stages instead of two; an agent session does that at most once. It is also the plain patch: the group's lead also holds the DSpark drafter, so with even FFN shares the other two members of that group keep 7.3 GB of VRAM each unused. The follow-up below fills it. ### Validation Engine CLI logits of 1,024 fixed tokens on this branch (v1.1.25 + this commit; the same figures on v1.1.24), Maya-S over 6 GPUs, `--mmap-experts off`, `--window 1024`, compared with main's layer split: | | KLD mean | top-1 agreement | |---|---|---| | reference noise: main's layer split, 1 chunk vs 4 chunks (`DS4_CHUNK=256`) | 0.0086 | 96.9% | | this PR, `--tp 3` + `DS4_TP_UNEVEN_HEADS=1` + `DS4_FLOW_TP=1` | 0.0100 | 96.2% | | this PR, layer split (`--tp 1`) vs main | bit-identical | | | this PR, `--tp 3` with the setting unset vs main (both fall back to one GPU a layer group) | bit-identical | | All logits finite. On v1.1.20 the same patch gave KLD 0.0096 - 0.0103; the tokens that differ sit at near-ties (top-1 margin median 0.13 - 0.16). CI-equivalent: HIP name mapping passes; server tests 342 OK (10 skipped); tools tests 384 OK (28 skipped). Not tested: HIP at runtime; widths other than 3; EXL3 packs (they do not use this check). ### Next - **Uneven FFN shares per group member** (`DS4_TP_SHARES`) - the lead takes a smaller share and the others fill their VRAM: in the same replay decode 83.0 tok/s (+31% over the layer split), turn reads +11 - 57%. 🤖 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:26:20 +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#518
No description provided.