Skip to content

models : fix dflash wo_a reshape on load - #26577

Merged
ggerganov merged 1 commit into
masterfrom
gg/dsv4-fix-dflash-load
Aug 4, 2026
Merged

models : fix dflash wo_a reshape on load#26577
ggerganov merged 1 commit into
masterfrom
gg/dsv4-fix-dflash-load

Conversation

@ggerganov

Copy link
Copy Markdown
Member

Overview

fix #26576
cont #26531

Missed a reshape in the dflash implementation.

Requirements

@ggerganov
ggerganov requested a review from CISC as a code owner August 4, 2026 13:42
@github-actions github-actions Bot added the model Model specific label Aug 4, 2026
@ggerganov
ggerganov merged commit 1c3c967 into master Aug 4, 2026
20 of 26 checks passed
Nathanw1014 added a commit to Nathanw1014/llama.cpp that referenced this pull request Aug 9, 2026
TENSOR_ALLOW_RESHAPE (ggml-org#26531) recomputes nb from the caller's shape as

    nb[dim] = dim == 0 ? ggml_type_size(type) : ne[dim-1]*nb[dim-1]

so nb[1] comes out as ne[0]*nb[0]. A row of a block-quantised tensor is
ne[0]/blck_size blocks, not ne[0] elements, so for q8_0 with ne[0]=4096 the
stride is 4096*34 = 139264 instead of 128*34 = 4352. F16/F32 are unaffected
because their block size is 1, which is why this went unnoticed.

The malformed meta is what buft_supported() probes the backend with, so the
weight looks non-contiguous: ggml_vk_dim01_contiguous() is false, the Vulkan
supports_op refuses the mul_mat (quantised src0 has no F32/F16/BF16 bypass),
and the loader falls back to a CPU buffer for that weight.

Reachable since ggml-org#26577 gave dflash and deepseek4 a 3d wo_a. On
DeepSeek-V4-Flash UD-IQ3_XXS + DSpark, gfx1151/RADV, that put attn_wo_a on the
CPU backend for all 43 attention layers, moved 1462 MiB of weights off the GPU
(Vulkan0 model buffer 6624.99 -> 5162.99 MiB) and took decode splits from 88 to
174, which is a large host-side cost per token with the GPU idle.

With this patch the load-time probe sees nb=[34,4352,...], the demotion is gone,
splits are back to 88 (bs=1) and 2 for the draft context, and generation is
unchanged. The same expression in the dummy-tensor path above is corrected too;
it is latent there, not reached by this path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
brittlewis12 pushed a commit to brittlewis12/llama.cpp that referenced this pull request Aug 17, 2026
thecodacus pushed a commit to thecodacus/llama.cpp that referenced this pull request Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: deepseek4 (DeepSeek-V4-Flash) GGML_ASSERT abort in build_attention_impl with speculative decoding after #26531 (wo_a load-time reshape)

1 participant