mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[PR #622] ds4 DSpark: the drafter head, markov steps and confidences only for the rows the round cut can keep (DS4_DSPARK_LAZY=0: all) #630
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#630
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/622
Author: @SeriousRising
Created: 10/28/2026
Status: 🔄 Open
Base:
main← Head:ds4-lazy-draft-head📝 Commits (1)
aed24dfds4 DSpark: the drafter head, markov steps and confidences only for the rows the round cut can keep (DS4_DSPARK_LAZY=0: all)📊 Changes
4 files changed (+97 additions, -38 deletions)
View changed files
📝
docs/SETTINGS.md(+1 -0)📝
src/ds4/ds4_main.cpp(+7 -3)📝
src/ds4/ds4_model.cu(+83 -34)📝
src/ds4/ds4_model.hpp(+6 -1)📄 Description
What. Today
draft_()(src/ds4/ds4_model.cu:13792, v1.1.35) runs the trunk's head over all 5 rows of the DSpark block, then 5 markov + argmax steps, then the confidence head for all 5 (:13979), andround()(src/ds4/ds4_main.cpp:273) throws away everything after the first cut confidence. In chat most rounds keep 0-2 drafts, so most of that head work (a 129280 x 5120 GEMV a row) is thrown away.With this PR, when the head is on one device (no TP head group, no
DS4_DSPARK_DUMP),draft_()works in up to three stages and evaluatesround()'s own cut on the host after each:x_0andy); if the first draft is cut, no head row runs at all;min(block, DS4_DSPARK_MAX, room - 1).A stage runs only if every confidence so far passed. The host test is
round()'s, with the same float operations in the same order (h_w[k] >= conf_min && (cum *= h_w[k]) >= cum_min).Model::draft()getsmax_n,conf_min,cum_minandmin_n; with the defaults (0) nothing is cut, so other callers keep the old behaviour.Prompt lookup:
round()compares the lookup proposal withdrafts[0]even when the drafter's first draft is cut, so the proposal is now made beforedraft(), and when there is onemin_n = 1makes the lazy head produce row 0 anyway.propose()only reads the suffix table, so moving it earlier changes nothing.Setting:
DS4_DSPARK_LAZY(read likeDS4_DSPARK_MAX/DS4_DSPARK_DUMP), on by default because it gives the same drafts and is measured faster (below);DS4_DSPARK_LAZY=0= the full head, as before. A row indocs/SETTINGS.md.Output: unchanged (same drafts, same tokens):
confidence_kernelis one block per row and reads onlyx_tandtok[t];markov_addandsample_tokens/sample_draftrun per row exactly as before.mv_kernel<kQ5_K, NC>on this pack) computes each column with the same lanes, order andwarp_sumwhatever the launch's column count; only the 4 + 1 split of rows into launches becomes 2 + up to 3.round()keeps the same count: the cut stops at the first failing confidence, atroom - 1, or at the block.Measured. 2x NVIDIA CMP 170HX 64 GB (GA100, sm_80, CUDA 12.8; card 0 PCIe Gen2 x16, card 1 Gen2 x4: a mining card's link, platform-specific), 16-vCPU Xeon E5-2697 v4 VM, 106 GiB RAM. DeepSeek-V4.1-Flash-1017 GSQ-RCO IQ2_XXS, layer split CUDA0 [0,20) / CUDA1 [20,40) + head,
--tp 1 --gpus 0,1 --dspark on --cpu-threads 14.The
maya-ds4CLI on this branch, 2000 fixed prompt ids + 256 greedy tokens,--suffix-draft 0, one binary, one run each (a quick check):DS4_DSPARK_LAZY=0With prompt lookup on (
--suffix-draft 3, andDS4_ASYNC_T=16from #608 so that a lookup window's rows do not depend on its size),=0and default give the same 256 ids (20 / 21 lookup rounds: the lookup's window choice follows wall-clock round times).Earlier, through the server on our v1.1.29-based fork (its other patches the same in both arms; 5 prompts x 512 tokens, temperature 0, thinking off; ms a verify window from the engine's timer; two repeats): lazy off 46.33 / 46.36 ms, 41.96 / 41.93 tok/s; lazy on 44.87 / 44.87 ms (-3.2 %), 43.32 / 43.32 tok/s; the same text hashes. The drafter there was 6.32 -> 5.40 ms a pass (5.00 -> 3.57 head rows a pass). Most of the saving is the head GEMV of rows the cut never keeps: the Q5_K head on dp4a costs ~0.68 ms a row on a CMP 170HX. Any single-device head should gain where the head GEMV is a visible share of a drafter pass; not measured on other GPUs. A TP head group /
mk_splitis unchanged (the lazy path is skipped).Costs and limits.
fmt != 0, split-K partials); the per-column argument was checked for the GGUF GEMV only.DS4_DSPARK_LAZY=0is the escape.DS4_DSPARK_SAMPLE=1at temperature > 0 (rows are drawn with the same per-row counter, so the draws should be the same).ds4_gguf_test(full suite): ALL OK.Checks (as
.github/workflows/tests.yml):tools/check_hip_compat.pyOK; server tests 463 OK (12 skipped); installer and tools tests 584 OK (31 skipped) - the same counts as v1.1.35.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.