﻿# llama.cpp Vulkan batched copies: prompt-save time is a state-transfer metric

The b12306 Vulkan batched-copy API targets state-transfer work; keep prompt-save latency, restore correctness and token generation as separate evidence.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-vulkan-batched-copy-prompt-save/
Language: en

llama.cpp b12306 adds Vulkan support for the batched tensor-copy API. The upstream benchmark concerns multi-slot unified-KV prompt-save time. This is a concrete state-transfer optimization, and its reported improvements should remain attached to that operation rather than being relabelled as ordinary token-generation throughput.

## Batching copies changes submission work

A state save can involve many tensor-copy requests. Supporting a batched API allows the backend to handle that collection through a different submission path. The release also avoids staging allocation for copies that do not need it. Neither change implies a different language-model arithmetic result. The practical question is how much state-transfer overhead remains in the application’s actual save pattern, including its slot count and bytes per slot.

## The benchmark has an explicit unit of work

Upstream reports prompt-save timings with state size and model configuration. Those units are important because they describe an operation that may occur occasionally rather than every generated token. A local comparison should hold the save trigger and state size fixed, then measure generation without saves as a control. Counting an occasional pause reduction as a constant decode-speed improvement would misstate what the API changed.

## Restore validates the meaning of the copy

Successful copy completion does not fully validate a checkpoint. Restore the saved state and compare continuation behaviour with the equivalent unsaved execution, using a deterministic or appropriately controlled setup. Include multiple slots with distinguishable contents so accidental cross-slot association is visible. This checks the semantic purpose of the batch, not only that a transfer API returned success and moved the expected aggregate number of bytes.

## Do not infer universal copy coverage

The PR distinguishes the new API support from possible future unification of other copy paths. It should not be described as proof that every one-dimensional or two-dimensional transfer now uses the same implementation. Record the actual route when investigating a local result. This article reports the published backend addition and a qualification design, without claiming independent reproduction of the upstream timing table on another GPU.

## Sources

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

## Related reading

- [Validate llama.cpp slot prompt-cache save and restore files](/journal/llama-cpp-slot-cache-persistence/)
- [Reconcile llama.cpp unified KV pools and per-slot context limits](/journal/llama-cpp-unified-kv-slot-limits/)
