[PR #600] [CLOSED] DS4: optional shape-preserving whole-chunk prompt skip #620

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

📋 Pull Request Information

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

Base: main ← Head: upstream/ds4-whole-chunk-skip


📝 Commits (1)

  • 86ca987 DS4: add optional whole-chunk prompt skipping

📊 Changes

5 files changed (+77 additions, -4 deletions)

View changed files

📝 CMakeLists.txt (+2 -0)
📝 docs/SETTINGS.md (+8 -0)
📝 src/ds4/ds4_model.cu (+13 -4)
➕ src/ds4/ds4_prompt_skip.hpp (+12 -0)
➕ tests/ds4_prompt_skip_test.cpp (+42 -0)

📄 Description

In earlier matrix-prefill tests, whole-chunk skipping preserved all 195 checked full-vocabulary states while reducing prompt latency by 17.6% at 8K and 38.4% at 32K versus running every layer on every token. Upstream now already skips that unnecessary work. This draft adds only the remaining option: keep the original chunk shapes by skipping complete chunks and retaining the entire chunk at the cut.

For example, an 8,192-token prompt with a 4,096-row chunk cap normally has two chunks. A cut after 5,524 rows makes only 2,668 rows of the second chunk run through the later layers. With this option, the cut moves back to 4,096: the entire second chunk runs through them. More rows are computed, but its original shape is retained. On several GPU groups, the original chunk schedule is kept rather than being rebuilt around the cut.

Enable MAYA_DS4_YOCO_WHOLE_CHUNKS=1 (default off; STRATA/native aliases supported). It applies only to existing mode 1 skip eligibility. Mode 0, the shorter mode 2 replay, unsupported placements, chunk-cap settings and expert policies are unchanged. The boundary uses the actual balanced chunk width: 10,000 tokens at cap 4,096 form widths 3,334/3,334/3,332, so rounding to the configured cap itself would be wrong. The option adds no allocations.

This is a shape-preservation choice, not a claim of faster execution than upstream's default skip. Keeping an extra partial chunk can cost performance or eliminate the skip on short prompts. Shape preservation also does not by itself guarantee bit-exact model output: expert grouping and other runtime choices can still change arithmetic.

Current-base checks (249f9a8):

  • Release HIP maya-ds4 production build and help smoke, HIP API mapping check.
  • 84,396 CPU scheduling cases over thirteen chunk caps (including non-powers of two), uneven prompt lengths and six retained-suffix sizes. Tests independently enumerate original chunk boundaries, verify the retained dependency suffix is not shortened, check less than one additional chunk is retained, and cover zero/invalid and integer-limit inputs.
  • No new full-model parity or performance run on this port. Existing serving is unchanged. The current-base multi-GPU flow, prefix reuse, cancellation and numerical comparisons remain follow-up work.

Historical evidence is intentionally scoped: the earlier controlled matrix-prefill run used frozen expert residency and warm caches, an older stack, and two R9700s plus a 9070 XT. All195 snapshots matched; all three synthetic retrieval answers were correct. Timing retained all 24 scheduled samples: 8K means 19.462→16.036s (four paired blocks), 32K 71.307→43.911s (two paired blocks). These within-session blocks do not establish cross-load precision, broad quality, decode gains or improvement over current upstream. A later 4K-chunk checkpoint also matched 195 states; changing the overall chunk cap from 2K to 4K itself was not bit exact.

This ports the remaining option from fork #32, with historical matrix measurements recorded in fdded54 and 4K numerical checks in fork #37.

cmake -S . -B build-hip -DSTRATA_BUILD_TESTS=ON # plus normal HIP build settings
cmake --build build-hip --target ds4_prompt_skip_test maya-ds4 -j4
ctest --test-dir build-hip -R '^ds4_prompt_skip_test$' --output-on-failure

🔄 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/600 **Author:** [@LostVector](https://github.com/LostVector) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `upstream/ds4-whole-chunk-skip` --- ### 📝 Commits (1) - [`86ca987`](https://github.com/mw00/project-maya/commit/86ca987786fc6ebdfa1b3ba14bfe5bf879f7a9da) DS4: add optional whole-chunk prompt skipping ### 📊 Changes **5 files changed** (+77 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+2 -0) 📝 `docs/SETTINGS.md` (+8 -0) 📝 `src/ds4/ds4_model.cu` (+13 -4) ➕ `src/ds4/ds4_prompt_skip.hpp` (+12 -0) ➕ `tests/ds4_prompt_skip_test.cpp` (+42 -0) </details> ### 📄 Description In earlier matrix-prefill tests, whole-chunk skipping preserved all 195 checked full-vocabulary states while reducing prompt latency by 17.6% at 8K and 38.4% at 32K **versus running every layer on every token**. Upstream now already skips that unnecessary work. This draft adds only the remaining option: keep the original chunk shapes by skipping complete chunks and retaining the entire chunk at the cut. For example, an 8,192-token prompt with a 4,096-row chunk cap normally has two chunks. A cut after 5,524 rows makes only 2,668 rows of the second chunk run through the later layers. With this option, the cut moves back to 4,096: the entire second chunk runs through them. More rows are computed, but its original shape is retained. On several GPU groups, the original chunk schedule is kept rather than being rebuilt around the cut. Enable `MAYA_DS4_YOCO_WHOLE_CHUNKS=1` (default off; STRATA/native aliases supported). It applies only to existing mode 1 skip eligibility. Mode 0, the shorter mode 2 replay, unsupported placements, chunk-cap settings and expert policies are unchanged. The boundary uses the actual balanced chunk width: 10,000 tokens at cap 4,096 form widths 3,334/3,334/3,332, so rounding to the configured cap itself would be wrong. The option adds no allocations. This is a shape-preservation choice, **not a claim of faster execution than upstream's default skip**. Keeping an extra partial chunk can cost performance or eliminate the skip on short prompts. Shape preservation also does not by itself guarantee bit-exact model output: expert grouping and other runtime choices can still change arithmetic. Current-base checks (249f9a8): - Release HIP `maya-ds4` production build and help smoke, HIP API mapping check. - 84,396 CPU scheduling cases over thirteen chunk caps (including non-powers of two), uneven prompt lengths and six retained-suffix sizes. Tests independently enumerate original chunk boundaries, verify the retained dependency suffix is not shortened, check less than one additional chunk is retained, and cover zero/invalid and integer-limit inputs. - No new full-model parity or performance run on this port. Existing serving is unchanged. The current-base multi-GPU flow, prefix reuse, cancellation and numerical comparisons remain follow-up work. Historical evidence is intentionally scoped: the earlier controlled matrix-prefill run used frozen expert residency and warm caches, an older stack, and two R9700s plus a 9070 XT. All195 snapshots matched; all three synthetic retrieval answers were correct. Timing retained all 24 scheduled samples: 8K means 19.462→16.036s (four paired blocks), 32K 71.307→43.911s (two paired blocks). These within-session blocks do not establish cross-load precision, broad quality, decode gains or improvement over current upstream. A later 4K-chunk checkpoint also matched 195 states; changing the overall chunk cap from 2K to 4K itself was not bit exact. This ports the remaining option from [fork #32](https://github.com/LostVector/project-maya/pull/32), with historical matrix measurements [recorded in fdded54](https://github.com/LostVector/project-maya/commit/fdded5422b2baa58c858811fcb697a14fad0fe3c) and 4K numerical checks in [fork #37](https://github.com/LostVector/project-maya/pull/37). ```sh cmake -S . -B build-hip -DSTRATA_BUILD_TESTS=ON # plus normal HIP build settings cmake --build build-hip --target ds4_prompt_skip_test maya-ds4 -j4 ctest --test-dir build-hip -R '^ds4_prompt_skip_test$' --output-on-failure ``` --- <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:33 +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#620
No description provided.