Skip to content

TP: fix entirely zero-sized slices per device - #23525

Merged
JohannesGaessler merged 1 commit into
ggml-org:masterfrom
JohannesGaessler:tp-fix-mtp-zero-slice
May 24, 2026
Merged

JohannesGaessler merged 1 commit into
ggml-org:masterfrom
JohannesGaessler:tp-fix-mtp-zero-slice

Conversation

@JohannesGaessler

Copy link
Copy Markdown
Contributor

Context: I was contacted by @am17an on an off-site communication channel about Qwen 3.6 MTP failing on 3+ GPUs with -sm tensor.

The problem on master is that with MTP the meta backend is allocating a buffer for at least one GPU based on a ggml_context where all contained tensors are zero-sized. The code in ggml-alloc.c ends up returning NULL for this edge case because it never needs to allocate any tensors at all which to it looks like all tensors are already allocated.

In the meta backend I think the correct way to handle this is to allocate a dummy buffer for the zero-sized tensors. I am not 100% sure what the correct behavior for ggml-alloc.c should be though. In this PR I've kept the behavior as-is (but documented it): for a ggml_context where all tensors are already allocated or zero-sized return NULL rather than a dummy buffer.

I would like to have this issue fixed on master before #22616 to avoid a situation where a fix is made relative to broken code.

Requirements

@am17an am17an left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label May 22, 2026
@JohannesGaessler
JohannesGaessler merged commit fff63b5 into ggml-org:master May 24, 2026
48 of 49 checks passed
nonml pushed a commit to nonml/llama.cpp that referenced this pull request May 24, 2026
spiritbuun referenced this pull request in spiritbuun/buun-llama-cpp May 25, 2026
turbo-tan pushed a commit to turbo-tan/llama.cpp-tq3 that referenced this pull request Jun 2, 2026
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants