Skip to content
AIBRAINWORX / OpenSourceCoder.comLOCAL-FIRST. BUILT IN THE OPEN.
Inference & Quantization / Text & Coding LLMs

llama.cpp b12676 Replaces GDN Rollback Snapshots with State Replay Across Backends

llama.cpp release b12676 (#31669) removes snapshot-based rollback for Gated Delta Net models in favor of single-state token replay across CUDA, Metal, Vulkan, WebGPU, OpenCL, and Hexagon backends.

Listen to this articleBrowser Voice
Ready
Official company logo or product image for llamacpp-b12676-gdn-state-replay-replaces-rollback
Official image or organization logo from github.com; identification only, no endorsement.
Event / context: 2026-11-23. Source check: October 28, 2026.

llama.cpp Replaces GDN Rollback Snapshots with State Replay in b12676

The llama.cpp b12676 release (commit d35dc4d), tagged on November 23, 2026 by contributor am17an, replaces snapshot-based rollback with token replay for Gated Delta Net (GDN) recurrent attention models under pull request #31669. Instead of maintaining multiple historical state snapshots to rewind sequences during speculative or aborted token evaluations, delta-net models now retain a single committed state and replay pending tokens whenever n_rs_seq > 0.

This architectural shift removes the LLAMA_RS_REPLAY environment flag, including the LLAMA_RS_REPLAY=2 configuration, along with the replay probe, rs_replay_fused, the rep_mask input, the graph-level replay fallback, and the snapshot branch of build_recurrent_attn. The release introduces ggml_gated_delta_net_ext to accept optional replay inputs while always emitting one state, restoring ggml_gated_delta_net(..., K) to its prior master signature and marking it deprecated. Both functions construct the same underlying operator, preserving backend compatibility while eliminating multi-snapshot K > 1 complexity from test-backend-ops.

Kernel Architecture, Memory Mechanics, and Backend Specifications

Previously, the graph fallback executed replay as two separate GDN operations, copying the committed state from the replay operation when keep was active and from the main operation otherwise. On backends whose graph_optimize pass reorders compute nodes—specifically Metal and Vulkan—keep and non-keep micro-batches produced different node sequences despite having identical node counts. That divergence forced the GGML scheduler to reallocate buffers on every switch and triggered aborts under GGML_SCHED_DEBUG_REALLOC. Embedding replay directly inside the GDN operator eliminates graph-level branching; any backend lacking native replay support now delegates the operator to the CPU via the scheduler.

Across hardware targets, b12676 implements replay natively inside device kernels and shaders. In CUDA, the KDA main loop now loads expf(g) into registers to match the replay loop; previously, dual inline calls caused nvcc on sm_89 GPUs to fuse the two loops differently, introducing a few ULPs of divergence that register staging removes without altering sm_120 output. Metal implements replay via a pipeline function constant and a keep kernel argument, falling back to src0 for pending buffers when replay is unused. Vulkan uses a pipeline specialization constant and push constant for keep, binds q when replay is absent, clamps buffer-supplied replay counts to n_pend pending rows following review feedback from 0cc4m, and updates ggml_vk_fill to support view fills at arbitrary misaligned offsets.

Additional backend updates extend replay to WebGPU, OpenCL, and Qualcomm Hexagon. WebGPU defines replay at the pipeline level, passes keep as a parameter, routes the replay count through workgroupUniformLoad so loops around workgroup barriers remain uniform, and constrains GDN replay within storage buffer limits. Hexagon's hex-gdn implementation enables replay across both HVX and HMX paths. At the memory-management layer, find_slot now transfers rs_max alongside pos, src, rs_pend, and seq_id when relocating cells, resolving issue #31656 where stale rollback depths caused seq_rm rejections or erroneous snapshot restores. Furthermore, rs_rep_cols convolution window views for delta-net and PLE layers are constructed once per graph rather than per layer, avoiding repeated host-input split uploads, while build_inp_mem_hybrid_iswa_rel receives hparams and cparams to populate hybrid replay inputs.

Developer Workflow and Multi-Architecture Model Impact

For developers deploying hybrid and linear-attention models, b12676 consolidates rollback behavior across several recently added architectures. Replay now covers qwen35, qwen35moe, qwen4exp, and clover-moe—which shares the Qwen 3.5 layout and required only an architecture gate—alongside KDA-family models including Kimi K3, Kimi K3.1, GLM5-Next, and BailingMoE3. For the KDA models, build_conv_state_replay gathers channels-first convolution histories laid out sequentially for q, k, and v in [d_inner, window + pending] rows, pairs pending gate rows holding S_v gates per head, and adds -sm tensor-split rules for GLM5-Next.

In practice, moving from multi-state snapshots to single-state replay reduces runtime configuration overhead and simplifies cache fusion, which now copies only one state. Developers no longer need to toggle LLAMA_RS_REPLAY or diagnose scheduler reallocation crashes when switching between keep and standard batches on Metal or Vulkan GPUs. The release also cleans up unused auto_fgdn fused-GDN probe parameters left over from an earlier rebase of build_delta_net, aligning the codebase back to master.

Compatibility Caveats, Deprecations, and Verification Scope

Several operational caveats remain for downstream integrators and custom backend maintainers. Downstream callers still referencing ggml_gated_delta_net(..., K) face deprecation, and any external test suites relying on K > 1 snapshot modes must adapt to single-state replay. On RISC-V hardware using the SpacemiT RVV kernel in ggml-cpu, the specialized kernel does not read replay inputs and explicitly returns false when op parameter 1 (n_pend) is set, handing execution back to the generic CPU kernel—a fallback pattern that can affect throughput on unaccelerated targets. WebGPU users also remain bound by storage buffer size constraints during replay.

Regarding validation, all correctness claims in this update come directly from the release notes rather than independent third-party benchmarking. According to the contributor's report, test-llama-archs models produced logits matching prior snapshots bit-for-bit under randomized rollbacks across CUDA, Vulkan, and CPU without graph re-plans, and test-llama-context passed in both modes.

EXPLORE THE SOURCE

GitHub repositories

Automated Vertex AI (gemini-4-hydrogen) primary-source report; reviewed 2026-11-24.

Follow your curiosity.

Pass the signal.