[PR #343] [MERGED] ds4: prompt skip across a 2-GPU prefix layer split #476

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/343
Author: @Gazelle221B
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @mw00

Base: main ← Head: ds4-prompt-skip-layer-split


📝 Commits (2)

  • 3e1d4aa ds4: allow prompt skip across prefix layer splits
  • 18f2173 Merge main (#344's multi-GPU prompt skip) into ds4-prompt-skip-layer-split

📊 Changes

2 files changed (+203 additions, -7 deletions)

View changed files

📝 src/ds4/ds4_model.cu (+21 -7)
➕ tools/test_ds4_prompt_skip.py (+182 -0)

📄 Description

v1.1.19's prompt skip is disabled whenever the trunk spans devices (yoco_layer() requires every layer on L[0].dev). On a 2-GPU layer split the boundary is usually at or before layer 20, so the skipped suffix already sits on one GPU. This lets the skip run in that case.

Change

  • yoco_layer(): allow splits at or before the KV source layer; the source and every suffix layer must still share one device. Tensor-parallel layers and splits inside the suffix stay ineligible.
  • A group that starts at the source layer has only KV-only work before the cut, so nothing advances its expert stream there. Its stream is now seeded at the retained cut chunk and row count. Without this, an earlier version of the patch failed at 16K with an out-of-step stream error.
  • Verbose log line when the skip is active. Two GPU-free regression tests (tools/test_ds4_prompt_skip.py) compile the real eligibility/bootstrap source.

Single-GPU behaviour is unchanged. There are no kernel, backend-specific or settings changes. NVIDIA prefix splits become eligible too, but I could only test HIP.

Prefill, before/after

2x 32 GB AMD GPUs (HIP), Maya-S six-shard, v1.1.19 + this commit. Automatic split 19/21, DSpark on, zero prompt reuse, three alternating rounds, MAYA_DS4_PROMPT_SKIP=0 vs 1 on the same binary:

New tokens Skip off tok/s Skip on tok/s Speedup TTFT off → on
8,192 235.3 337.1 1.43x 34.8 → 24.3 s
16,384 305.4 402.2 1.32x 53.7 → 40.7 s
32,768 354.6 440.2 1.24x 92.4 → 74.4 s
65,536 384.5 459.3 1.20x 170.5 → 142.7 s

For reference, the same machine with the trunk on one GPU (upstream skip) reads 321 / 377 / 425 / 467 tok/s at these sizes, but decodes more slowly. The split keeps the 2-GPU decode speed and now gets most of the prefill gain.

Numerics

Fixed expert dispatch (DS4_STREAM=1 DS4_STREAM_FORCE=012345678 DS4_LANE_CAL=none), --no-expert-cache, greedy, identical starting profiles. Two skip-off processes produced byte-identical logits and answers at every size, so this is the noise floor. Prompt last-row logits, skip on vs off:

New tokens KL on→off (nats) Greedy answer (EOS, ≤256 tokens)
8,192 1.9e-5 identical
16,384 6.5e-6 identical
32,768 3.0e-6 identical
65,536 5.4e-7 identical for 47 tokens, then differs

The 64K split happens at a near-tie: the top-two logit margin is 0.04 with skip off and 0.16 with skip on, and both answers are complete and sensible. The KLs are below the 1.5e-4 quoted for the single-GPU skip in the v1.1.19 notes, so I read this as the same rounding-level change. You may prefer a stricter criterion, though.

Also checked: 20/20 known-answer prompts (arithmetic, facts, a 61K-token needle) with the skip on; the CI-equivalent checks pass (tools tests, server tests, HIP mapping check).

🤖 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/343 **Author:** [@Gazelle221B](https://github.com/Gazelle221B) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `ds4-prompt-skip-layer-split` --- ### 📝 Commits (2) - [`3e1d4aa`](https://github.com/mw00/project-maya/commit/3e1d4aa90d218324bfd48e9016bb55bd6c1938f2) ds4: allow prompt skip across prefix layer splits - [`18f2173`](https://github.com/mw00/project-maya/commit/18f2173e6ec5eaaf7af7f3bb9ecc91e345692171) Merge main (#344's multi-GPU prompt skip) into ds4-prompt-skip-layer-split ### 📊 Changes **2 files changed** (+203 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/ds4/ds4_model.cu` (+21 -7) ➕ `tools/test_ds4_prompt_skip.py` (+182 -0) </details> ### 📄 Description v1.1.19's prompt skip is disabled whenever the trunk spans devices (`yoco_layer()` requires every layer on `L[0].dev`). On a 2-GPU layer split the boundary is usually at or before layer 20, so the skipped suffix already sits on one GPU. This lets the skip run in that case. ## Change - `yoco_layer()`: allow splits at or before the KV source layer; the source and every suffix layer must still share one device. Tensor-parallel layers and splits inside the suffix stay ineligible. - A group that starts at the source layer has only KV-only work before the cut, so nothing advances its expert stream there. Its stream is now seeded at the retained cut chunk and row count. Without this, an earlier version of the patch failed at 16K with an out-of-step stream error. - Verbose log line when the skip is active. Two GPU-free regression tests (`tools/test_ds4_prompt_skip.py`) compile the real eligibility/bootstrap source. Single-GPU behaviour is unchanged. There are no kernel, backend-specific or settings changes. NVIDIA prefix splits become eligible too, but I could only test HIP. ## Prefill, before/after 2x 32 GB AMD GPUs (HIP), Maya-S six-shard, v1.1.19 + this commit. Automatic split 19/21, DSpark on, zero prompt reuse, three alternating rounds, `MAYA_DS4_PROMPT_SKIP=0` vs `1` on the same binary: | New tokens | Skip off tok/s | Skip on tok/s | Speedup | TTFT off → on | |---:|---:|---:|---:|---:| | 8,192 | 235.3 | 337.1 | 1.43x | 34.8 → 24.3 s | | 16,384 | 305.4 | 402.2 | 1.32x | 53.7 → 40.7 s | | 32,768 | 354.6 | 440.2 | 1.24x | 92.4 → 74.4 s | | 65,536 | 384.5 | 459.3 | 1.20x | 170.5 → 142.7 s | For reference, the same machine with the trunk on one GPU (upstream skip) reads 321 / 377 / 425 / 467 tok/s at these sizes, but decodes more slowly. The split keeps the 2-GPU decode speed and now gets most of the prefill gain. ## Numerics Fixed expert dispatch (`DS4_STREAM=1 DS4_STREAM_FORCE=012345678 DS4_LANE_CAL=none`), `--no-expert-cache`, greedy, identical starting profiles. Two skip-off processes produced byte-identical logits and answers at every size, so this is the noise floor. Prompt last-row logits, skip on vs off: | New tokens | KL on→off (nats) | Greedy answer (EOS, ≤256 tokens) | |---:|---:|---| | 8,192 | 1.9e-5 | identical | | 16,384 | 6.5e-6 | identical | | 32,768 | 3.0e-6 | identical | | 65,536 | 5.4e-7 | identical for 47 tokens, then differs | The 64K split happens at a near-tie: the top-two logit margin is 0.04 with skip off and 0.16 with skip on, and both answers are complete and sensible. The KLs are below the 1.5e-4 quoted for the single-GPU skip in the v1.1.19 notes, so I read this as the same rounding-level change. You may prefer a stricter criterion, though. Also checked: 20/20 known-answer prompts (arithmetic, facts, a 61K-token needle) with the skip on; the CI-equivalent checks pass (tools tests, server tests, HIP mapping check). 🤖 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:25:50 +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#476
No description provided.