mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #558] [CLOSED] DeepSeek --parallel N: several conversations at once on a two-GPU layer split #594
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#594
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/558
Author: @somnergy
Created: 10/27/2026
Status: ❌ Closed
Base:
main← Head:pr/ds4-parallel📝 Commits (1)
2f00f7dDeepSeek --parallel N: several conversations at once on a two-GPU layer split📊 Changes
9 files changed (+2522 additions, -91 deletions)
View changed files
📝
docs/SETTINGS.md(+43 -3)📝
maya.py(+38 -8)📝
serve/server.py(+23 -2)📝
src/ds4/ds4_kernels.cu(+407 -10)📝
src/ds4/ds4_kernels.cuh(+23 -0)📝
src/ds4/ds4_main.cpp(+615 -3)📝
src/ds4/ds4_model.cu(+1287 -33)📝
src/ds4/ds4_model.hpp(+51 -0)📝
tools/test_maya_parallel.py(+35 -32)📄 Description
DeepSeek-V4.1-Flash gets
--parallel N: several conversations at once on a two-GPU layer split. maya-ds4 has served one conversation at a time ( #332, #409). The default stays one conversation, and nothing changes unless--parallelis given.What it does
One state per conversation. Each has its own window rings, compressors, the KV sources' compressed KV and index keys, Engram rows and sampler history. The decode loop pipelines conversations across the split's two stages: GPU 0 runs layers 0-19 for some while GPU 1 runs 20-39 and the head for others. A request that arrives while every conversation is busy waits its turn instead of failing.
Prefix reuse across requests. Each conversation keeps checkpoints:
MAYA_DS4_SEQ_CK_EVERYprompt tokens;A new request goes back to the latest checkpoint its tokens agree with and reads only the rest. A continued conversation reuses its whole state.
cached_tokensand theDONEline report the reuse.Prompts and decode together. A prompt read gives each GPU up between its chunks, so the conversations that are writing get steps during a long read.
Row groups (
MAYA_DS4_ROWS_BATCH=1, opt-in). The writing conversations go through the stages as two groups.Split decode attention (
DS4_ATTN_SPLITK=1, opt-in). A decoded token's sparse attention is split over its selected rows across more blocks, and the parts are combined with the sink once. Same math, different summation order.Start-up checks.
--parallelneeds--tp 1, two GPUs,--dspark noneand no vision tower; a start that breaks one of these fails and says which. The start also fails, and names what to lower, if a GPU would have less thanMAYA_DS4_SEQ_RESERVE_MIB(256) free next to the states. Buffers allocated at first use need that room.Launcher.
maya.pyaccepts--parallelfor a DeepSeek config, but not with a calibration, which measures one request at a time and tunes tensor parallel groups. MiniMax is still rejected; #525's tests are adjusted to match.--benchnow works with an engine that announcesmulti=.Docs.
docs/SETTINGS.mdhas a new section, "DeepSeek: several conversations at once".Results
Verdict by hardware class:
--parallelneeds a two-GPU layer split).Setup: 2× RTX PRO 5000 72 GB (Blackwell), Core Ultra 9 285K, 188 GB RAM. DeepSeek-V4.1-Flash-1017, IQ2_XXS experts with IQ4_NL Engram, every expert in VRAM (
--vram-experts 1.0),--tp 1,--dspark none,--vision off,--prefill-chunk 2048.Maya's
--bench(3 answers × 256 tokens, greedy, thinking off; prefill at 2K / 8K):--parallel(Measured on v1.1.32. The branch is rebased on v1.1.33, which changes only
tools/mm3/pack_gguf.pybesides the version.)Several conversations through the server. These are 700-token essays at temperature 0.7, started together; pooled tokens/s is all completion tokens over the wall time. Settings:
--parallel 4,MAYA_DS4_SEQ_CTX=819200,MAYA_DS4_ROWS_BATCH=1,DS4_ATTN_SPLITK=1.Three conversations run one by one through the pipeline: a group of 2 + 1, or one group of 3, left a GPU waiting and measured slower.
How much each part adds at 4 conversations, measured on a v1.1.28 base before rebasing (pooled tok/s; not re-measured part by part on main):
MAYA_DS4_ROWS_BATCH=1)DS4_ATTN_SPLITK=1)Shared-prefix matrix (token_bench
essay-matrix-reuse): every stream of a cell shares one long prefix and differs only in its final request. Contexts 32K-512K × 1/2/4 streams, 512 tokens each. Config and full results:github.com/somnergy/token_bench@fec0ebd629/results/2026-10-27_essay-matrix-reuse_ds4-parallel4_2x-rtx-pro-5000-72gb_core-ultra-9-285k_188gb(config:configs/matrix/essay-matrix-reuse.json; 15 cells, 0 failed requests)At 4 streams, the first token comes about as soon as one stream's would: the shared prefix is read once, and the other three take it from the checkpoints.
Content checks (the same build):
All checks pass. Exact greedy token parity between a conversation run alone and one run beside others is not claimed: chunk boundaries and the group kernels change the summation order.
Against upstream's best single-conversation setup (TP2 + DSpark)
Upstream's fastest setting for one conversation on two GPUs is tensor parallel 2 with the DSpark drafter. That setting can't run with
--parallel, so the honest comparison is between the two setups. Measured on the same two cards in a second host (Threadripper 7980X, 251 GB RAM, GPU peer copies at 54 GB/s each way).--parallelmeasured the same there as on the Core Ultra host (229.0 vs 227.8 tok/s at 4). TP2's all-reduce, though, depends on GPU peer copies, which ran at ~5 GB/s on the Core Ultra board. On a typical consumer board, expect TP2 + DSpark to be slower than the figures below.maya
--bench(greedy, 3 × 256 tokens; DSpark keeps 83-98% of its drafts on these answers):--tp 2 --dspark on--parallel 4Through the server (700-token essays at temperature 0.7, started together; main queues the requests it can't serve at once):
--tp 2 --dspark on--parallel 4For one user at a time, DSpark on TP2 stays the better setting: 1.2× at temperature 0.7 and about 2.3× on greedy code. From two concurrent users up,
--parallelgives 1.5× at two and 2.2× at four. A drafter for a conversation writing alone, inside--parallel, would combine the two; that is follow-up work, not in this PR.Suggested settings
--parallel 2(pipelined; row groups add nothing at 2)--parallel 4 MAYA_DS4_ROWS_BATCH=1 DS4_ATTN_SPLITK=1Context per conversation: at 4 × 1M, the second GPU (layers 20-39 + head) was left with 148 MiB, below the reserve, and the start refuses. 4 × 800K leaves 530 MiB.
Not in this PR
--parallel(rejected at start).Checks
tools/check_hip_compat.pypasses; server tests (456) pass; tools tests show the same 4 failures as main in this environment. Built for sm_120.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.