Skip to content

qwen4exp : fix graph reallocation from the n-gram table scale - #32483

Merged
am17an merged 3 commits into
ggml-org:masterfrom
am17an:qwen4exp-ple-scale-realloc
Nov 17, 2026
Merged

am17an merged 3 commits into
ggml-org:masterfrom
am17an:qwen4exp-ple-scale-realloc

Conversation

@am17an

@am17an am17an commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Overview

Fixes the test-llama-context abort on the CUDA and ROCm CI since #32476 (my change):

ggml_backend_sched_alloc_splits: unexpected graph reallocation (graph size = 429, nodes = 429, leafs = 107), debug_realloc = 1

#32476 applied per_layer_token_embd.scale with ggml_mul. The scale is a host weight, and the scheduler offloads an op with a host weight to the GPU only when the backend's offload_op agrees, which for CUDA means at least 32 rows. So the node changed backend with the batch size, and the reserved graph did not fit the small batches.

The scale is now read as a value and applied with ggml_scale, which has no weight. The tensor must be F32.

Additional information

Tested on RTX PRO 6000, Debug build, GGML_SCHED_DEBUG_REALLOC=1, generated qwen4exp-moe.gguf: test-llama-context aborts before, all cases pass after.

Not tested: a real model with this change (the multiply uses the same value as before), ROCm.

Requirements

@am17an
am17an marked this pull request as ready for review November 17, 2026 16:07
@am17an
am17an requested review from a team and CISC as code owners November 17, 2026 16:07

@ServeurpersoCom ServeurpersoCom 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

@am17an
am17an merged commit ad9d9e8 into ggml-org:master Nov 17, 2026
22 checks passed
@github-actions github-actions Bot added the model Model specific label Nov 17, 2026
gabe-l-hart added a commit to gabe-l-hart/llama.cpp that referenced this pull request Nov 17, 2026
* origin/master: (138 commits)
qwen4exp : fix graph reallocation from the n-gram table scale (ggml-org#32483)
server : return 400 when grammar and ignore_eos are on (ggml-org#32377)
ggml-cuda: disable quantized matvec fusion on all Pascal GPUs (ggml-org#32239)
Title: CUDA: few-row MMQ for MUL_MAT_ID (ggml-org#32065)
ui: turn the live markdown preview off by default (ggml-org#32469)
CUDA: use block reductions for whole-row pool_1d (ggml-org#31855)
ggml : decode F8_E4M3 to fp32 without ldexpf (ggml-org#32477)
llama : keep the k-pool layout prefix on sequence edits (ggml-org#32137)
vocab : speed up PLaMo-2/3 tokenizer table build (ggml-org#32249)
convert : fix FP8 qwen4exp checkpoints (n-gram table scale, block-scaled FP8) (ggml-org#32476)
ui: Llama UI design system: tokens, surfaces and fonts (ggml-org#32468)
mtmd: support Minimax-Music3 (ggml-org#32435)
chat: add tts_dict for kokoro G2P template (ggml-org#32397)
Rotate K/V read order for better L2 cache hit rates (ggml-org#32407)
ui: turn conversation tabs off by default (ggml-org#32402)
ui: move Llama Chat to SvelteKit 3 and its built-in service worker (ggml-org#32463)
qwen3next : apply output projection weight scale (ggml-org#32393)
cuda : raise shared mem limit only for the launched kernel (ggml-org#32392)
nix: expose a SYCL package (ggml-org#31066)
vulkan: disable flip Flash Attention shader on AMD Windows due to a driver bug (ggml-org#32415)
...
dzannotti added a commit to halo-box/strix-llama.cpp that referenced this pull request Nov 17, 2026
Upstream: ggml-org/llama.cpp 8777c0c..ad9d9e8 (3 commits)

No conflicts. Upstream ggml-org#32483 replaces the PLE scale multiply with ggml_scale and a value read once after load; it lands on the fork placement from the previous step (after the gather, on both the graph and the host-gather path).

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
fencerJP pushed a commit to fencerJP/llama-apu that referenced this pull request Nov 21, 2026
…rg#32483)

* qwen4exp : apply the n-gram table scale with ggml_scale

* read the scale once after load

* remove comment
Annieren pushed a commit to Annieren/llama.cpp-upstream that referenced this pull request Nov 23, 2026
…rg#32483)

* qwen4exp : apply the n-gram table scale with ggml_scale

* read the scale once after load

* remove comment
Mr-J-369 pushed a commit to Mr-J-369/llama.cpp-Android that referenced this pull request Nov 25, 2026
…rg#32483)

* qwen4exp : apply the n-gram table scale with ggml_scale

* read the scale once after load

* remove comment

(cherry picked from commit ad9d9e8)
Nindaleth pushed a commit to Nindaleth/llama.cpp that referenced this pull request Nov 26, 2026
…rg#32483)

* qwen4exp : apply the n-gram table scale with ggml_scale

* read the scale once after load

* remove comment
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.

3 participants