Repository navigation
Conversation
(assisted by DeepSeek v4 Flash)
--split-mode tensor--split-mode tensor on CUDA
|
Hi @art-den, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
|
Bad news. VRAM usage for draft model is x4.4 of original I'm not sure yet if this MR is necessary (( |
Have you tried to set It is possible for me to run |
|
I think it's ready. I managed to reduce video memory consumption without a much rewriting. The current implementation produces ~73 t/s with dflash2 vs ~63 t/s with MTP for my x2 RTX 5060 Ti 16Gb. Please check that I haven't broken dflash2 and dspark in single-GPU mode. |
|
@ruixiang63 could you maybe take a look at this one? The diagnosis seems correct, but the code could use a look from a specdec expert. |
|
I don't have a good feeling about this PR, there are too much unnecessary changes.
This is the fix proposed in the description but there are so much irrlevant changes in the PR. Could you limit this PR to the changes required for the fix? |
|
I also have a bad feeling about my PR. I asked the agent to make as few changes as possible, but they ended up making far more than I expected. The minimum change that would solve the problem is the first commit. But it has some unresolved issues (too much VRAM usage for the draft model). This PR needs to be reviewed by someone familiar with llama.cpp. If these changes don't solve the problem correctly, I'll simply close the PR. |
|
The PR authors should be responsible for validating their own changes before requesting review. If you’re not confident in the implementation, please investigate and self-review it first. Asking an agent to write the code and then leaving reviewers or maintainers to determine whether it’s correct doesn't make any sense. |
|
/bot review |
Automated code reviewReviewed statically against the repo conventions; the PR touches Blocking
Will slow the review
Nits
This review was generated automatically by pi coding agent using |
|
/bot review |
|
Sorry @art-den, only members of the |
|
@ruixiang63, @pwilkin new changes for this PR:
|
|
Hm... |
|
Tested this branch on ROCm — it fixes the assert there too. Environment: 2× AMD Radeon AI PRO R9700 (gfx1201, 32 GiB each), ROCm 7.2.3, kernel 6.8, Before (master-based build without this branch): at With this branch: loads and runs at all three depths; ~15 loads, no NaNs, no crashes. Results (greedy,
Output is deterministic across reps and byte-identical (SHA-256 of the completion) at n3, n5 and n7, and identical to
Happy to re-run anything useful (f16 KV, other depths, |
Overview
Assertion is failed on llama-server startup if using dflash2 draft model and
--split-mode tensorflag:The changes in this PR address two issues:
--split-mode tensorAdditional information
Issue for this case: #27819
Root cause
The DFlash2 candidate selector runs
ggml_top_k()on the lm_head output (t_logits) inside the graph. Under tensor parallelismoutput.weightis split along the vocab axis, sot_logitsis split along axis 0, whichGGML_OP_TOP_K(a per-row op) cannot handle in the meta backend.Fix: When a DFlash2 draft is used with tensor parallelism, the lm_head must be replicated in full on every device (
GGML_BACKEND_SPLIT_AXIS_MIRRORED) so the whole vocabulary is available in-graph.Reducing the VRAM footprint
DFlash2's in-graph selector (
ggml_top_kover the lm_head output) cannot run on a vocab-split lm_head under--split-mode tensor. Rather than replicating the lm_head on every device (MIRRORED, ~+500 MiB/device), the selector now runs on the CPU from the gathered logits + decoder hidden states, so the lm_head stays split.VRAM savings for
https://huggingface.co/z-lab/Qwen3.8-27B-DFlash2-GGUF/blob/main/Qwen3.8-27B-DFlash2-Q4_K_M.gguf:TENSOR_SKIP'd under tensor parallelism and read from the GGUF at init: ~-68 MiB/device.[vocab x ubatch]compute buffer drops from ~539 MiB to ~67 MiB/device.Without these modifications, the amount of occupied VRAM was x4.4 of the gguf file size.
NOTE: No
ggml/changes; the non-tensor path (single GPU / layer split) keeps the original in-graph selector.Requirements