mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #447] MAYA_DS4_TP_GGUF_UNEVEN: cublasGemmEx fails on the first long prompt, then illegal memory access (4x RTX 3090, Maya-S) #185
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#185
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?
Originally created by @mgabor3141 on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/447
v1.1.26, DeepSeek-V4.1-Flash Maya-S, 4x RTX 3090 (Gen3, no P2P, driver 615.78.08, CUDA 13.4).
Args:
--tp 2 --dspark on --mmap-experts off --cpu-threads 16Env:
MAYA_DS4_TP_GGUF_UNEVEN=1 DS4_FLOW_TP=1 MAYA_DS4_TP_CHECK=1 DS4_REQUIRE_ALL_RAM=1The TP check passes and decode works. The first prompt that reaches the busy experts' path fails, and every request after it fails the same way:
CUDA1 is the group's part 1. We have not tried it without
DS4_FLOW_TP. Without the TP setting, the same box runs fine.Placement. Only CUDA0 and CUDA1 form a group, and CUDA1 is left with 8.5 GB free:
That puts 863 more experts on the CPU lane than without the setting (10,042 vs 9,179), and free RAM drops from ~13 GB to 5.2 GB. Is this the intended placement?
Decode before the failure (tok/s, 5 runs each):
On prose the CPU-lane share is the same (~8%), so we take the ~6% loss to be the all-reduce through host memory. On code the extra CPU-lane experts add to it (10-12.5% vs 7-8%).
Happy to rerun with other settings or a debug build.
@pepuscz commented on GitHub (Oct 24, 2026):
This looks like the same overrun as #439, which #446 fixes.
DS4_FAT_ROWS sizes its FP16 buffers at first use, from whichever layer reaches the busy-experts path first. With MAYA_DS4_TP_GGUF_UNEVEN the members' FFN widths alternate between layers (1280 / 1024 on Maya-S), so a wider layer later writes past them: the cublasGemmEx failure, then the illegal access. #446 sizes the buffers for the widest FFN a device's layers give it. Until it is merged, DS4_FAT_ROWS=0 should avoid the crash, at the busy experts' old speed.
On the placement: a tensor parallel group holds the same experts on both members (each its share of every expert's rows), so the group's VRAM experts are capped by the member with less room. Here CUDA0 also carries the DSpark blocks and layers 40-42, so it fills first, and CUDA1's 8.5 GB stays unused by experts. #412 (DS4_DRAFT_DEV, open) lets the blocks sit on other devices, which should give the group back that room. We have not measured that on a 3090 box, though.
@mw00 commented on GitHub (Oct 24, 2026):
v1.1.27 includes #446, which fixes a buffer overrun in the same path under
MAYA_DS4_TP_GGUF_UNEVEN(#439). It very likely fixes this too - could you try your 4x RTX 3090 setup on v1.1.27 and tell us? Until then,DS4_FAT_ROWS=0avoids that path.@mgabor3141 commented on GitHub (Oct 24, 2026):
Thanks, that explained both. I retested on v1.1.26 + #446 + #412, 4x RTX 3090 (Gen3, no NVLink):
Why only one pair formed. Groups are built from neighbouring GPUs with exactly equal
totalmemory. The GPU the firmware uses for POST reserves 402 MiB, its three twins 400 MiB, so that GPU never matched its neighbour and GPUs 2 and 3 each ran alone. Comparing totals within 1% instead of exactly gives two pairs: GPUs 0+1 on layers 0-18 and 2+3 on layers 19-39.#446 fixes the crash on CUDA. No failures over ~40 requests, including 11K and 101K prompts.
#412 with
DS4_DRAFT_DEV=1,1,0moves two drafter blocks to the lead's partner. That frees room on the lead for experts. With both pairs and #412, 9,556 experts are on the CPU lane, against 10,042 in my first run (one pair, no #412) and 9,179 with the layer split. I did not run two pairs without #412, so I cannot split that gain between the two changes.P2P. A two-member group's all-reduce goes through host memory: each member writes its partial to pinned host memory, and the other reads it back, so every row crosses PCIe twice. I added an opt-in
DS4_TP_P2P=1: each member writes its partial straight into an inbox in the other's VRAM and waits on a flag there, so the row crosses PCIe once and is read locally. The sum is the same two FP32 adds asar_sum_kernel. It needs a driver with peer access (we used the aikitoria P2P patch), and the inboxes take 321 MiB of VRAM per member. Without peer access it logs that and keeps the host path.All three on the same driver, speeds from the engine's timings, fresh prompts each time (C source code):
Decode is the same in all three within noise. On prompts, P2P makes TP 16-22% faster, which shows the all-reduce is a real part of TP's cost. But TP with P2P is still 24-36% slower than the layer split, so most of the gap lies elsewhere. We stay on the layer split.
Happy to send PRs for the 1% match and for
DS4_TP_P2Pif either is wanted.@mw00 commented on GitHub (Oct 27, 2026):
Closing: the crash was the busy-experts buffer overrun fixed by #446 (commit
f46e395c, in v1.1.27), and your retest confirmed it. Thanks for the 1%-equal grouping finding and theDS4_TP_P2Pnumbers - noted.