Skip to content

server: check draft context creation error#24922

Merged
ngxson merged 1 commit into
ggml-org:masterfrom
Kononnable:fix-24758
Jun 23, 2026
Merged

server: check draft context creation error#24922
ngxson merged 1 commit into
ggml-org:masterfrom
Kononnable:fix-24758

Conversation

@Kononnable

Copy link
Copy Markdown
Contributor

Overview

We don't check if context was properly created when loading draft model. If context does not fit into memory we write an error and continue without enabling speculative decoding. Unless user looks into logs they would be unaware of the situation.
With this change we will stop loading the model if context fails to be created.

I've also fixed trying to free uninitialized memory - introduced by a recent refactor (#24843).
free(): invalid pointer is thrown and process aborted when loading model is canceled before batch.init() is called - e.g. if user provide a path to an non-existent model.
I can remove that part if it is planned to be handled in some other way.

Fixes #24758

Requirements

@Kononnable Kononnable requested a review from a team as a code owner June 22, 2026 22:49
@ngxson ngxson merged commit be4a6a6 into ggml-org:master Jun 23, 2026
25 checks passed
Geminihaha pushed a commit to Geminihaha/llama.cpp that referenced this pull request Jun 25, 2026
papamoose pushed a commit to papamoose/llama.cpp that referenced this pull request Jun 27, 2026
sanmai added a commit to sanmai/llama.cpp that referenced this pull request Jun 30, 2026
The probe block collapsed from ~75 lines to ~30. Removed: spec_eagle3 detection, the try_set_stub_ctx_other lambda, stub_attempted, the 2-attempt retry loop, and the catch-fallback. What remains is the Sculpture-principle version:

if (has_draft && spec_mtp) {          // gemma4-assistant separate draft
    // build no_alloc target stub -> cparams_dft.ctx_other
}
try { /* probe + accumulate */ } catch { /* SRV_WRN, reserve nothing */ }

- Change 2 (null-check) dropped — it's upstream ggml-org#24922.
- EAGLE3 no longer special-cased — no stub, fails loudly via ggml-org#24922 under default --fit (= master status quo, --ctx-size escape hatch), no regression.

Validated post-simplification

- Gemma (has_draft + spec_mtp): stub built, estimate 5293 MiB, MTP active, 127 t/s, n_ctx→58880.
- Qwen (in-model MTP, has_draft=false): no stub, estimate 4256 MiB "MTP context", MTP active, 139 t/s, n_ctx→83968.
- Build + smoke test pass.
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: Gemma4 MTP is silently disabled in case of insufficient VRAM

2 participants