[PR #279] [MERGED] ds4: warn at start when prompts run in 16-token windows (tensor parallel collapsed, threads off) #442

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/279
Author: @waxinz
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @mw00

Base: main ← Head: ds4-prefill-windows-warning


📝 Commits (1)

  • d458260 ds4: warn at start when prompts run in 16-token windows (tensor parallel collapsed, threads off)

📊 Changes

2 files changed (+11 additions, -2 deletions)

View changed files

📝 docs/SETUP.md (+5 -1)
📝 src/ds4/ds4_model.cu (+6 -1)

📄 Description

The problem

On a multi-GPU split whose tensor parallel collapses to one GPU per layer group, DS4 prefills every prompt in windows of 16 tokens — about 10x slower on long prompts than the chunked path — with almost no hint.

Maya-S GGUF hits this on every rig: the routed experts' FFN is n_ff 2304 wide, and 2304 does not split into 256-value blocks x2, so the setup's --tp 2 always falls back:

ds4: tensor parallel 2 -> 1: the experts' 256-value blocks split n_ff 2304 no other way (each GPU its own layers)

With tp effectively 1 and --threads off, par = o.threads || tp > 1 is false (src/ds4/ds4_model.cu, load()), so chunk = 0 — and Model::feed then sends every prompt, however long, to feed_windows (16 tokens a pass). The only hint is prompts in chunks of 0 buried at the end of the experts-in-place log line; a rig where every expert fits in VRAM prints nothing at all.

Measured (7x RTX 3090, Maya-S GGUF read in place, 262144 ctx, cold caches)

prefill path 8K prompt 32K prompt
windows of 16 (chunk 0) 115 tok/s 99 tok/s
--threads on -> chunks of 8192 461 tok/s 1009.9 tok/s

Decode unchanged (44-66 tok/s either way). Same answers either way — the flag only switches the prompt path (chunks vs windows compute the same feed; no quant or kernel change).

The change

  • src/ds4/ds4_model.cu: when the prompt chunk ends up 0, print a loud warning at start with the fix (--threads on for 8192-token chunks).
  • docs/SETUP.md: one sentence in the DeepSeek GGUF section.

No behavior change unless the operator acts on the warning; no new settings; no new CUDA calls (AMD mapping untouched).

Verification

  • ds4_model.cu compiles clean with the project's nvcc flags (CUDA 12.6, sm_86).
  • The warning condition (chunk 0 after a TP collapse) verified live on the affected rig before the patch; the --threads on fix side has been running production there since this morning.

Alternative worth considering (not in this PR)

maya.py could emit --threads on in the generated maya-ds4.json by default, since for the Maya-S GGUF the TP collapse is the rule rather than the exception. Left out to keep this change minimal — happy to add it here or as a follow-up if preferred.


🔄 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/279 **Author:** [@waxinz](https://github.com/waxinz) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `ds4-prefill-windows-warning` --- ### 📝 Commits (1) - [`d458260`](https://github.com/mw00/project-maya/commit/d4582608b1895ccb2401a89199b57ea15da4e5a4) ds4: warn at start when prompts run in 16-token windows (tensor parallel collapsed, threads off) ### 📊 Changes **2 files changed** (+11 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/SETUP.md` (+5 -1) 📝 `src/ds4/ds4_model.cu` (+6 -1) </details> ### 📄 Description ## The problem On a multi-GPU split whose tensor parallel collapses to one GPU per layer group, DS4 prefills **every prompt in windows of 16 tokens** — about 10x slower on long prompts than the chunked path — with almost no hint. Maya-S GGUF hits this on every rig: the routed experts' FFN is n_ff 2304 wide, and 2304 does not split into 256-value blocks x2, so the setup's `--tp 2` always falls back: ``` ds4: tensor parallel 2 -> 1: the experts' 256-value blocks split n_ff 2304 no other way (each GPU its own layers) ``` With tp effectively 1 and `--threads` off, `par = o.threads || tp > 1` is false (`src/ds4/ds4_model.cu`, `load()`), so `chunk = 0` — and `Model::feed` then sends every prompt, however long, to `feed_windows` (16 tokens a pass). The only hint is `prompts in chunks of 0` buried at the end of the experts-in-place log line; a rig where every expert fits in VRAM prints nothing at all. ## Measured (7x RTX 3090, Maya-S GGUF read in place, 262144 ctx, cold caches) | prefill path | 8K prompt | 32K prompt | |---|---|---| | windows of 16 (chunk 0) | 115 tok/s | 99 tok/s | | `--threads on` -> chunks of 8192 | 461 tok/s | 1009.9 tok/s | Decode unchanged (44-66 tok/s either way). Same answers either way — the flag only switches the prompt path (chunks vs windows compute the same feed; no quant or kernel change). ## The change - `src/ds4/ds4_model.cu`: when the prompt chunk ends up 0, print a loud warning at start with the fix (`--threads on` for 8192-token chunks). - `docs/SETUP.md`: one sentence in the DeepSeek GGUF section. No behavior change unless the operator acts on the warning; no new settings; no new CUDA calls (AMD mapping untouched). ## Verification - `ds4_model.cu` compiles clean with the project's nvcc flags (CUDA 12.6, sm_86). - The warning condition (chunk 0 after a TP collapse) verified live on the affected rig before the patch; the `--threads on` fix side has been running production there since this morning. ## Alternative worth considering (not in this PR) `maya.py` could emit `--threads on` in the generated `maya-ds4.json` by default, since for the Maya-S GGUF the TP collapse is the rule rather than the exception. Left out to keep this change minimal — happy to add it here or as a follow-up if preferred. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:25:27 +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#442
No description provided.