﻿# llama.cpp graph-result reuse: reset state when scheduler reservations change

The b12304 graph-result reuse changes object lifetime and reset behaviour; repeated reservation transitions need correctness checks beyond startup.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-graph-result-reuse-reset-contract/
Language: en

llama.cpp b12304 reuses graph-result instances across scheduler reservations instead of repeatedly destroying and recreating them. The upstream change moves allocation to context construction and uses reset with updated node capacity. This makes object reuse an explicit lifecycle contract, with stale-state handling more important than the mere absence of new allocations.

## Reuse preserves an object, not its meaning

Keeping an instance alive avoids reconstruction, but its previous graph data must not remain semantically active. The PR updates maximum-node capacity and resets existing instances during scheduler reservation. The useful review question is therefore what reset invalidates and what it deliberately retains. A lower allocation count is only one observation; the reused object still has to represent the current graph rather than a mixture of current and previous work.

## Transitions exercise the lifecycle

A proposed test alternates graph shapes or reservation requirements and returns to an earlier shape. This is more informative for reuse than running one fixed graph repeatedly. Compare every transition with an independently constructed context or trusted reference, where practical. A defect may appear only when capacity grows, shrinks logically, or switches between the arenas selected for different batches, so the transition sequence belongs in the reproducer.

## Construction now carries more responsibility

Upstream creates the graph-result instances unconditionally during context construction and specifically mentions vocabulary-only contexts. That broadens the set of contexts in which the objects exist, even if no ordinary inference follows. Qualification should therefore include lightweight context construction and destruction as well as full model execution. Lazy-allocation assumptions in integration code may no longer describe the actual lifecycle, even when the public task remains unchanged.

## Report the benefit at the right boundary

The PR includes upstream regression results on a specified system. They support the change’s tested coverage, not a universal latency improvement. To assess operational value locally, measure reservation frequency and host allocation work separately from token computation, then retain numerical checks over transitions. This release is a lifecycle refactor with potential overhead implications; this article does not supply new performance numbers or assert that every request triggers the changed reservation path.

## Sources

- [llama.cpp b12304 release](https://github.com/ggml-org/llama.cpp/releases/tag/b12304)
- [llama.cpp pull request #32089](https://github.com/ggml-org/llama.cpp/pull/32089)

## Related reading

- [Make llama.cpp automatic fit settings reproducible](/journal/llama-cpp-fit-reproducible-settings/)
- [Reconcile llama.cpp unified KV pools and per-slot context limits](/journal/llama-cpp-unified-kv-slot-limits/)
