mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #280] Very slow Deepseek V4.1-flash prefill = 2x of decode #108
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#108
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 @byphilipp on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/280
My config:
2*4090 48Gb (modded)
64-core EPYC 7713P
The prefill is very slow - only 2-2.5x faster then decode !
maya-report.txt
@jettoblack commented on GitHub (Oct 20, 2026):
Same here.
4x3090 24GB + 1x 5060Ti 16GB (Total 112GB)
56-core EPYC 7663 Zen3 - 512GB DDR4
Maybe a Zen3 thing? Lack of AVX512? Or lack of FP4 on GPU?
prefill only ~100t/s but decode ~40t/s.
maya-bench.txt:
maya-report.txt:
@21387A commented on GitHub (Oct 20, 2026):
Having some issues too. The report down below was primarily composed by the agent, my personal insight on this matter is limited:
I have the same picture on a smaller box, and it is not the number of GPUs.
2x RTX 3090 24 GB, Threadripper 3990X, 256 GB DDR4, Windows 11, NVMe. Maya v1.1.16, DeepSeek-V4.1-Flash-1017 in LibertAIDAI's EXL3 2.9 bpw with DeepSeek's Engram tables, context 131072.
--tp 2 --mmap-experts on: a 4,618-token prompt is read in 74 seconds (62 tokens/s); a 700-token answer is written at 18.8 tokens/s. A 553-token prompt takes 52-62 seconds (8-10 tokens/s).--tp 1(no chunked prompts): a 4,618-token prompt is read in 97 seconds (47.6 tokens/s); the answer is written at 18.7 tokens/s.The two-GPU mode does not start on this PC:
maya-ds4: pinning the CPU lane's experts (3974 MiB) failed(with a build that prints the CUDA error:out of memory (2)after 117 GB in 40 maps), with 46 GB of VRAM in use. A small test that pins 160 GB withcudaHostRegisterand no VRAM allocated succeeds, so together it is about 165 GB. That is why the two-GPU numbers above are with--mmap-experts on(the--tp 1numbers need no pinning).So the prompt path is slow on 2x3090 as well, not only on 4-5 GPUs. Is this the expected speed for now, or is there a setting I am missing?
Logs:
--tp 2 --mmap-experts on, the 4,618-token prompt (62.0 tokens/s prefill) and the 700-token answer (18.75 tokens/s decode).--tp 1, the 4,618-token prompt (47.6 tokens/s prefill) and the answer (18.73 tokens/s decode).pinning ... failedstop with--tp 2.Details:
--pack <model>\maya-ds4 --max-context 131072 --tp 2 --dspark none --vision off --mmap-experts on; two RTX 3090s, 256 GB of RAM, Windows 11.--mmap-experts onis not a speed setting here: it is what lets the two-GPU mode start, because the engine cannot pin the CPU lane on this PC. The--tp 1numbers need no pinning.--calibrate/--speed-calibrationreport "nothing to tune"; only the DSpark drafter is calibrated, and it is off here.@21387A commented on GitHub (Oct 20, 2026):
One more data point from the same server, a longer prompt:
The prefill rate depends on the prompt length: 8-10 tokens/s at 553 tokens, 62 at 4,618, 106.6 at 30,690. The engine reads prompts in chunks of 8192, and the CPU lane (161 GB) is read in place once per chunk, so short prompts pay the same read for fewer tokens.
...so while it's NOT 2x of decode speed in my case, it is quite slow indeed.
updated 1.1.16 to 1.1.17 --> prefill situation stays roughly the same, and the decode speed is same~ish too, but I'm not sure whether it was this dynamic previously - rising quickly from ~13 t/s to ~18 t/s, and afterwards to consistent 21 - 24 t/s in a few messages;
@jerem91150 commented on GitHub (Oct 20, 2026):
One more data point, on a single GPU, with a cause for that case and a workaround.
v1.1.16 (
abc09c7), Windows 11, one RX 7900 XTX 24 GB (gfx1100, HIP build fromtools\hip\build_maya_windows.bat), Ryzen 9 7900X3D, 64 GB RAM, model files on a PCIe 4 NVMe. DeepSeek-V4.1-Flash-1017 Maya-S, set up withmaya.py --setup --backend hip --gpu 1 --model DeepSeek-V4.1-Flash-1017 --ds4-quant maya-s.The config the setup wrote has
--tp 2and no--threads. On one GPU the engine drops to tp 1, sopar = o.threads || tp > 1is false andchunkstays 0 (ds4_model.cu, around line 1683). The startup line says it:A fresh 26K prompt then read at about 4 tok/s (1,280 of 26,149 tokens after 333 s, I stopped it).
With
--threads onadded to the config's args, the same line saysprompts in chunks of 8192, and the same 26,151-token prompt is read in 224 s (116.7 tok/s), right answer. Second run 116.5 tok/s. Decode is about the same: median 5.4 tok/s without--threads(3 stories of ~480 tokens), 5.15 tok/s with it (6 stories over two runs).So on a single-GPU box the config from the setup reads prompts about 25x slower than it could. Maybe the setup should write
--threads onwhen there is one GPU, or chunked prefill shouldn't depend onthreads/tp. I haven't checked CUDA single-GPU, but it's the same code path.Short prompts stay slow even with chunks of 8192 (34-99 tokens read at 4-7 tok/s), which fits what @21387A saw: every chunk pays one pass over the CPU-side experts.
Side note in case it's useful: DSpark is slower than no draft on this box. Alternated, two runs each,
--threads on:reasoning_efforthigh)Drafts were accepted at 64-77%, but with DSpark loaded about 10 GB more of the experts are outside VRAM (163.7 GB against 153.1 GB), and that costs more than the drafts save on one 24 GB card.
@jerem91150 commented on GitHub (Oct 20, 2026):
Follow-up to my comment above: I posted it about 35 minutes after v1.1.17 was out, sorry, I had missed #279. Re-tested on v1.1.17 (
8d9a9b5, HIP build for gfx1100 only), same PC, same Maya-S files from v1.1.16, the config exactly as the setup writes it (--tp 2 --dspark none, no--threads):So the fix works on a single AMD card too, no
--threads onneeded any more. Alternated runs, fresh server each:--threads onThe 26K answer was right every time. So on this box 1.1.17 by default is as fast as 1.1.16 with
--threads on, but I expected more from "long prompts read each expert once". I ran two more sessions withDS4_FLOW_STATS=1, one with the default and one withDS4_LAYER_MAJOR=0(one run each, so take the exact times with some noise):Layer-major does what it says: 152 GB read from the files instead of 579, and here it was 197 s against 254 s. But the read rate drops from ~2.3 GB/s to 0.77 GB/s, and the compute still waited 108 s of the 197 s for reads. So the 3.8x fewer bytes give only ~1.3x. My guess, not checked: with one layer at a time there are fewer reads in flight per layer than when the chunks run through all the layers. Also, everything goes through the page cache (
0.0 GB from the disk unbuffered) on this Windows box, on a PCIe 4 NVMe that does a lot more than 2.3 GB/s raw.Happy to run anything else you want measured on this setup (one RX 7900 XTX, 64 GB RAM, Windows).
@byphilipp commented on GitHub (Oct 20, 2026):
v1.1.17
with --tp 2 --prefill-chunk 8192
@mw00 commented on GitHub (Oct 20, 2026):
Thanks, everyone, for the reports and logs! This was fixed in v1.1.17: DeepSeek prompts now run in 8K chunks by default (the 2 -> 1 tensor-parallel fallback had switched the chunked path off, so prompts ran in windows of 16), and long prompts read each expert once per layer. The results posted here on v1.1.17 confirm it: prefill is now many times the decode speed, without
--threads on. Closing as fixed; if you still see prefill near decode speed on v1.1.17 or later, please open a new issue with yourmaya-report.txt.