Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d14138b
sched: pipeline the delivery of a host-resident KV cache
Piggidragon Aug 26, 2026
fbe9cdd
docs: record what tensor parallelism still needs, and fix the repro s…
Piggidragon Aug 26, 2026
22b865a
sched: report where the pipelined token goes, and fix the budget check
Piggidragon Aug 27, 2026
499c10a
sched : name what the ordered path still copies, and why it costs wha…
Piggidragon Aug 27, 2026
fac757c
repro : make the exactness tasks independent of each other
Piggidragon Aug 27, 2026
cc1afb7
sched: fix pipelined transport fallback paths
Piggidragon Aug 28, 2026
2ca196e
sched: fix pipelined transport review issues
Piggidragon Aug 30, 2026
6e2fe44
sched: allocate transport ring entries the way the backend would
Piggidragon Sep 1, 2026
df5f1f7
sched: never let the transport ring starve the graph
Piggidragon Sep 3, 2026
2811703
docs: re-measure the transport gates on the current head
Piggidragon Sep 3, 2026
9a12d97
docs: say where the transport stops paying, and why the budget is 128…
Piggidragon Sep 4, 2026
34851f6
sched: deliver a multi-stream KV window one stream at a time
Piggidragon Sep 4, 2026
9b92b9c
docs: measure the quant invariance, and what parallel sequences cost
Piggidragon Sep 4, 2026
f5971b6
sched: take a staged window's stream span from the whole tensor
Piggidragon Sep 5, 2026
9bcfcac
sched: wait for the previous graph before staging a window again
Piggidragon Sep 5, 2026
9b0d2f2
sched: wait for the consumer before freeing the transport ring
Piggidragon Sep 5, 2026
f619d58
llama: note that a cache sharing cells keeps no stable prefix
Piggidragon Sep 5, 2026
b87c74b
llama-bench: stop on an out-of-range -kvpd or -kvpb
Piggidragon Sep 5, 2026
499d2b9
sched: wait on the slot release events, not on the consumer backend
Piggidragon Sep 5, 2026
763f706
sched: deliver a staged window with ggml_backend_tensor_set_2d_async
Piggidragon Sep 5, 2026
feeb332
ggml: say what a stable prefix covers
Piggidragon Sep 5, 2026
950e7fb
repro: gate the multi-stream delivery on concurrent output
Piggidragon Sep 5, 2026
7edce45
docs, tests: unwrap the hard-wrapped comments
Piggidragon Sep 5, 2026
2ce9c7b
docs: re-measure on this head, and say which head each number is from
Piggidragon Sep 5, 2026
8eaa67c
sched: release an idle transport ring, and grow a slot in powers of two
Piggidragon Sep 5, 2026
c7b2e8e
arg, llama : bound --kv-pipeline-budget
Piggidragon Sep 5, 2026
56e8076
llama : do not clear the KV buffers under a running decode
Piggidragon Sep 5, 2026
7b9fdb2
llama : wait for the decode before clearing the memory buffers
Piggidragon Sep 6, 2026
ed6bc86
sched : fix the review issues of the pipelined transport
Piggidragon Sep 6, 2026
3f41a75
sched, llama: refinements to pipelined transport handling
Piggidragon Sep 6, 2026
bbdd08f
sched, llama : fix the second review of the pipelined transport
Piggidragon Sep 6, 2026
b0d9c49
sched, llama : fix the third review of the pipelined transport
Piggidragon Sep 6, 2026
f79205b
sched, llama : pack the multi-stream transport ring, make pipelining …
Piggidragon Sep 8, 2026
d359a23
sched, tests : reconcile the ring with the merged ordered range copy
Piggidragon Sep 8, 2026
da23680
docs : re-measure the parallel and packing tables on the rebased base
Piggidragon Sep 9, 2026
47347c0
sched, llama : fix the fourth review of the pipelined transport
Piggidragon Sep 10, 2026
1d10dc0
Merge llama/dev into kv/pipelined-transport
Piggidragon Sep 13, 2026
205cb8d
ggml : keep the source name of a scheduler copy
Piggidragon Sep 3, 2026
e1c5abe
ggml-meta : split a host-resident KV cache by head
Piggidragon Sep 3, 2026
fa56aca
llama : split a V tensor on its own head size
Piggidragon Sep 3, 2026
5719cbf
ggml : read back a strided row split from a meta buffer
Piggidragon Sep 3, 2026
5cdde60
llama : keep the recurrent state on device under split mode tensor
Piggidragon Sep 3, 2026
346b38b
tests : cover a host-resident KV cache split by tensor
Piggidragon Sep 3, 2026
1f90680
ggml-meta : write every stream of a head-split host KV cache
Piggidragon Sep 4, 2026
35c6243
ggml-meta : close the last subgraph on a host-resident cache
Piggidragon Sep 5, 2026
20b0891
ggml-meta : identify a scheduler copy by its name, not by its flags
Piggidragon Sep 7, 2026
50b379a
sched : write a multi-stream window to a meta backend in one copy
Piggidragon Sep 14, 2026
8fbfc78
Merge llama/dev into kv/pipelined-transport
Piggidragon Sep 14, 2026
9faffa9
tests : align the parallel check with the host KV rows
Piggidragon Sep 17, 2026
5d98b49
merge: host KV split by head (#66) into pipelined transport (#39)
Piggidragon Sep 17, 2026
a22c586
ggml-meta : add events and a ranged write for a head-split host cache
Piggidragon Sep 14, 2026
734bdd8
sched : pipeline the host KV delivery under split mode tensor
Piggidragon Sep 14, 2026
0f0f11e
docs : measure the pipelined transport under split mode tensor
Piggidragon Sep 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ function gg_run_test_llama_archs_tensor_split {
GGML_CUDA_DEVICES=2 ./build-ci-release/bin/test-llama-archs -s 1 2>&1
GGML_CUDA_DEVICES=3 ./build-ci-release/bin/test-llama-archs -s 1 2>&1
GGML_CUDA_DEVICES=4 ./build-ci-release/bin/test-llama-archs -s 1 2>&1
# the scheduler names a copy after its source, and 8 device names fill the name field
GGML_CUDA_DEVICES=8 ./build-ci-release/bin/test-llama-archs -s 1 -a llama 2>&1
fi

if [ ! -z ${GG_BUILD_METAL} ]; then
Expand All @@ -327,7 +329,7 @@ function gg_run_test_llama_archs_tensor_split {
function gg_sum_test_llama_archs_tensor_split {
gg_printf '### %s\n\n' "${ci}"

gg_printf 'Runs test-llama-archs with 1 to 4 devices\n'
gg_printf 'Runs test-llama-archs with 1 to 4 and 8 devices\n'
gg_printf '- status: %s\n' "$(cat $OUT/${ci}.exit)"
gg_printf '```\n'
gg_printf '%s\n' "$(cat $OUT/${ci}.log)"
Expand Down
35 changes: 35 additions & 0 deletions common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <filesystem>
#include <fstream>
#include <list>
#include <limits>
#include <numeric>
#include <regex>
#include <set>
Expand Down Expand Up @@ -2429,6 +2430,40 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
params.kv_cpu_pinned = value;
}
).set_env("LLAMA_ARG_KV_CPU_PINNED"));
add_opt(common_arg(
{"--kv-pipeline-depth"}, "N",
string_format("how many splits ahead the scheduler delivers a host-resident KV cache to the accelerator, so "
"that the transfer runs while the previous split computes. 0 keeps the ordered path, where a "
"decode token pays the transfer and the attention kernels in series; any other value turns the "
"pipeline on, and 1 is the value that measures best. Only takes effect with a host-resident "
"cache, e.g. --no-kv-offload or --kv-cpu-pinned, and costs (N + 2) * (largest staged split) of "
"device memory (default: %d)", params.kv_pipeline_depth),
[](common_params & params, int value) {
if (value < 0 || value > LLAMA_KV_PIPELINE_DEPTH_MAX) {
throw std::invalid_argument(string_format("--kv-pipeline-depth must be between 0 and %d", LLAMA_KV_PIPELINE_DEPTH_MAX));
}
params.kv_pipeline_depth = value;
}
).set_env("LLAMA_ARG_KV_PIPELINE_DEPTH"));
add_opt(common_arg(
{"--kv-pipeline-budget"}, "N",
string_format("hard cap, in MiB, on the device memory that pipelined delivery of a host-resident KV cache "
"may use. A staging slot holds one attention layer's K or V over the whole context, so the "
"requirement grows with the context; past this cap the scheduler declines and keeps the "
"ordered path, so a host-resident cache never quietly trades away the device memory it exists "
"to save. 0 removes the cap, %d is the largest accepted (default: %d)",
LLAMA_KV_PIPELINE_BUDGET_MIB_MAX, params.kv_pipeline_budget_mib),
[](common_params & params, int value) {
constexpr size_t mib = 1024u*1024u;
if (value < 0 || value > LLAMA_KV_PIPELINE_BUDGET_MIB_MAX) {
throw std::invalid_argument(string_format("--kv-pipeline-budget must be between 0 and %d MiB", LLAMA_KV_PIPELINE_BUDGET_MIB_MAX));
}
if ((size_t) value > std::numeric_limits<size_t>::max()/mib) {
throw std::invalid_argument("--kv-pipeline-budget is out of range for this platform");
}
params.kv_pipeline_budget_mib = value;
}
).set_env("LLAMA_ARG_KV_PIPELINE_BUDGET"));
add_opt(common_arg(
{"--recurrent-state-offload"},
{"--no-recurrent-state-offload"},
Expand Down
2 changes: 2 additions & 0 deletions common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,8 @@ struct llama_context_params common_context_params_to_llama(const common_params &
cparams.cb_eval_user_data = params.cb_eval_user_data;
cparams.offload_kqv = !params.no_kv_offload;
cparams.kv_cpu_pinned = params.kv_cpu_pinned;
cparams.kv_pipeline_depth = (uint32_t) params.kv_pipeline_depth;
cparams.kv_pipeline_budget_mib = (uint32_t) params.kv_pipeline_budget_mib;
cparams.recurrent_state_offload = params.recurrent_state_offload;
cparams.kv_gpu_layers = (uint32_t) std::max(0, params.kv_gpu_layers);
cparams.phase_aware_workspace = params.phase_aware_workspace;
Expand Down
2 changes: 2 additions & 0 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ struct common_params {
int32_t kv_gpu_layers = 0; // with no_kv_offload, keep this many attention KV layers device-resident
bool phase_aware_workspace = false; // resize compute schedulers between prompt and generation phases
bool live_context_workspace = false; // size supported attention workspaces from the padded live KV extent
int32_t kv_pipeline_depth = 0; // splits of look-ahead for pipelined delivery of a host-resident KV cache (0 = off)
int32_t kv_pipeline_budget_mib = 128; // hard cap on the device memory that delivery may use (0 = uncapped)
bool warmup = true; // warmup run
bool check_tensors = false; // validate tensor data
bool no_op_offload = false; // globally disable offload host tensor operations to device
Expand Down
Loading
Loading