Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3217633
ci : build only the ggml-hip backend for windows-rocm release (#27753)
harkgill-amd Aug 27, 2026
1844325
server: add ctx-per-slot (--kv-unified-per-slot) (#24124)
bartowski1182 Aug 27, 2026
83d855c
hex-unary: fix RMS_NORM_MUL weight-offset bugs for grouped/broadcast …
aparmp-quic Aug 27, 2026
e70802a
ggml-hexagon: add HTP unary ops for ABS and LOG (#27786)
cqderek Aug 27, 2026
5f37106
llama: LLAMA_GRAPH_TIMING, where the CPU time of a decode goes (#4)
dzannotti Aug 27, 2026
542ff66
qwen4exp: --ngram-on-disk, forge ngram on ssd (#3)
dzannotti Aug 27, 2026
ca3d5a3
model: add DSpark support for Nemotron3.5 (#27804)
ruixiang63 Aug 27, 2026
4e97ac8
tests : run test-save-load-state across all architectures (#27755)
ggerganov Aug 28, 2026
6d6b697
metal : add fa-vec tunings for M4 Pro (#27824)
infinitewarp Aug 28, 2026
dfb1328
speculative: keep DFlash draft blocks the same width across sequences…
Nathanw1014 Aug 28, 2026
8963a9b
metal : add fa-vec tunings for M3 Max, M5 and M5 Pro (#27863)
ggerganov Aug 28, 2026
be87620
sycl: bind the f16 KV cache in place for the oneDNN SDPA path (#27468)
Titaniumtown Aug 28, 2026
d077b4c
sycl: use TILE for quantized KV decode on BMG (#26689)
johnkarlhill Aug 28, 2026
b19cbe9
convert: prevent ndarray conversion in LazyChunkedTensor (#27869)
ngxson Aug 28, 2026
511f9c1
OpenVINO: Update OV to 2026.3.1, whisper.cpp support, Qwen3.5 on NPU,…
wine99 Aug 28, 2026
906bb3b
Merge branch 'ggml-org:master' into master
dzannotti Aug 28, 2026
f5e85d4
metal : add fa-vec tunings for M4 (#27875)
Strongtut Aug 28, 2026
8663224
context : disable non-fused GDN and LID ops (#27877)
ggerganov Aug 28, 2026
90c26fc
Vulkan: add hoisting support for row IDs and expert count in shaders …
ravel7524 Aug 28, 2026
a43c398
ggml : fix conv_transpose_2d for multiple batches (#26132)
tekinertekin Aug 28, 2026
b387ddf
vulkan: fix missing view-alias dependencies in ggml_vk_graph_optimize…
Eric-A-Stalee Aug 28, 2026
6fe7498
model: qwen4exp: reduce number of graph splits (#27880)
ngxson Aug 28, 2026
50f068f
bench: add --tensor-read-lazy (#27881)
ngxson Aug 28, 2026
da33563
Merge branch 'ggml-org:master' into master
LaurentZuijdwijk Aug 28, 2026
d7bd3bf
snapdragon: python SDK setup (Windows) (#27903)
kurquhar Aug 28, 2026
77f132c
vulkan: Change mul_mat_id to pad K rather than N (#27925)
jeffbolznv Aug 29, 2026
5ea1b12
metal : add fa-vec tunings for M1 Max (#27932)
jhen0409 Aug 29, 2026
c9ca51c
vulkan: combine duplicated fastdiv functions, rename the one optimizi…
jeffbolznv Aug 29, 2026
cc83d7b
sycl: make --fit respect --fit-target better (#27629)
nicois Aug 29, 2026
17252c7
metal : add remaining fa-vec tunings for M4 Pro (#27915)
nikwen Aug 29, 2026
3173a56
metal : assert shared memory padding (#27951)
ggerganov Aug 29, 2026
c77efac
Merge branch 'ggml-org:master' into master
dzannotti Aug 29, 2026
c841aee
opencl: use a better matmul path on two Adreno GPU generations (#27640)
wanghqc Aug 29, 2026
c589f0e
metal : add fa-vec tunings for M2 (#27940)
ring2003 Aug 29, 2026
57291f2
ggml: allow passing alloc dependencies in graph_optimize (#27301)
am17an Aug 30, 2026
bdf3955
memory : copy Hadamard matrix to k_rot tensor only if it has buffer a…
fairydreaming Aug 30, 2026
d882575
metal : fix null-pipeline crash for F16 src1 mul_mat/mul_mat_id (#25648)
QuintinShaw Aug 30, 2026
370cb12
sycl: split long rows in TOP_K instead of one work-group per row (#27…
Titaniumtown Aug 30, 2026
9e54e68
hexagon: support for device discovery and create sessions on demand (…
max-krasnyansky Aug 30, 2026
2bf0415
rpc : fix pre-rdma macOS versions (#27815)
ryan5rdx Aug 30, 2026
dc7aecf
vendor : update cpp-httplib to 0.54.0 (#27919)
cabelo Aug 30, 2026
b8b743c
metal : Add fa-vec tuning for M3 Pro (#27963)
addianto Aug 30, 2026
093adb2
metal: add fa-vec tunings for M3 Ultra (#27999)
ngladitz Aug 30, 2026
742347b
rpc: fix apple rdma error spew on teardown (#27908)
ryan5rdx Aug 30, 2026
73f56d1
ggml : add ggml_backend_op_alloc_size_may_expand, use it in RPC (#27960)
ggerganov Aug 30, 2026
bebc935
common: rename --tensor-read-lazy to --lazy-mode, add -lzm shorthand …
ggerganov Aug 30, 2026
cc231cb
dflash: pass missing NVFP4 scales to attention operations (#28000)
JamePeng Aug 30, 2026
e422148
hip : optimize Q2_0 dot-product path for gfx1201 (#26753)
LunalFresh Aug 30, 2026
0b5be7e
hip: tune rdna 3 mmq config (#26284)
itterative Aug 30, 2026
f1793c1
CUDA: use the fast mm_ids_helper path for any n_expert_used (#27978)
ServeurpersoCom Aug 30, 2026
2578138
llama: improve TENSOR_READ_LAZY handling (#27837)
ngxson Aug 30, 2026
0190529
ggml: add SWIGLU_CLAMP (#27930)
am17an Aug 30, 2026
62acc89
kv-cells: stop the sequence scan once all sequences are seen (#28011)
ServeurpersoCom Aug 30, 2026
5bb0dc2
Merge branch 'ggml-org:master' into master
LaurentZuijdwijk Aug 30, 2026
6d1479c
ggml : fix ggml_backend_buft_get_alloc_size() guard (#28038)
ggerganov Aug 30, 2026
a7cc83b
rpc: avoid serializing buffers from other servers (#26500)
hmirin Aug 30, 2026
bd55e6a
metal : add remaining Q4_1/Q5_0/Q5_1 fa-vec tunings for M2 (#28017)
ring2003 Aug 30, 2026
9723942
hexagon: fix CPY fence bug (#28033)
yshsharke Aug 30, 2026
dd2c3d6
qwen4exp: MTP draft head for speculative decoding (#9)
LaurentZuijdwijk Aug 30, 2026
bb10d08
qwen4exp: fix --ngram-on-disk, which crashes on every model (#8)
dzannotti Aug 30, 2026
46c6e45
Merge branch 'ggml-org:master' into master
LaurentZuijdwijk Aug 30, 2026
afd0627
server : add a `hidden` preset option to omit a model from GET /model…
LaurentZuijdwijk Aug 31, 2026
1c30551
ui: build the embed host tool with flags the host compiler understand…
LaurentZuijdwijk Aug 31, 2026
c4c03d9
vulkan: handle batch sizes > 4 for IQ3_S mat-vec (register spill at N…
LaurentZuijdwijk Aug 31, 2026
4b5fe5f
vulkan: gate the UMA bulk readback on host-cached mappings (#12)
LaurentZuijdwijk Aug 31, 2026
db1ae40
speculative-prefill : port upstream PR 27692
Sep 2, 2026
a4d8e83
vulkan: driver-gate the coopmat LDS stride pad (#14)
LaurentZuijdwijk Sep 3, 2026
ca062e9
Halo/vulkan topk radix (#17)
LaurentZuijdwijk Sep 3, 2026
fa25724
Merge halo-box/llama.cpp master into strix-llama.cpp
dzannotti Sep 3, 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
2 changes: 2 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ add_library(${TARGET}
reasoning-budget.h
sampling.cpp
sampling.h
speculative-prefill.cpp
speculative-prefill.h
speculative.cpp
speculative.h
subproc.cpp
Expand Down
136 changes: 133 additions & 3 deletions common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ static bool spec_types_is_default(const common_params & params) {
common_models_handler common_models_handler_init(const common_params & params, llama_example curr_ex) {
common_download_hf_plan plan;
common_download_hf_plan plan_spec;
common_download_hf_plan plan_prefill;
common_download_opts opts;

const bool spec_type_draft_mtp = std::find(params.speculative.types.begin(),
Expand Down Expand Up @@ -413,7 +414,11 @@ common_models_handler common_models_handler_init(const common_params & params, l
plan_spec = common_download_get_hf_plan(params.speculative.draft.mparams, opts_spec);
}

return common_models_handler{plan, plan_spec, opts};
if (!params.speculative.prefill.model.hf_repo.empty()) {
plan_prefill = common_download_get_hf_plan(params.speculative.prefill.model, opts);
}

return common_models_handler{plan, plan_spec, plan_prefill, opts};
}

bool common_models_handler_is_preset_repo(const common_models_handler & handler) {
Expand Down Expand Up @@ -461,8 +466,9 @@ static std::vector<common_download_task> build_url_tasks(const common_params_mod
void common_models_handler_apply(common_models_handler & handler, common_params & params, common_download_callback * callback) {
std::vector<common_download_task> tasks;

auto & plan = handler.plan;
auto & plan_spec = handler.plan_spec;
auto & plan = handler.plan;
auto & plan_spec = handler.plan_spec;
auto & plan_prefill = handler.plan_prefill;

auto opts = handler.opts; // copy
opts.callback = callback;
Expand All @@ -478,6 +484,7 @@ void common_models_handler_apply(common_models_handler & handler, common_params
handle_url(params.model);
handle_url(params.mmproj);
handle_url(params.speculative.draft.mparams);
handle_url(params.speculative.prefill.model);

// optionally, if docker repo is set, resolve it
if (!params.model.docker_repo.empty()) {
Expand Down Expand Up @@ -513,6 +520,13 @@ void common_models_handler_apply(common_models_handler & handler, common_params
tasks.push_back(task);
had_spec_url = true;
}
if (!params.speculative.prefill.model.url.empty()) {
common_download_task task;
task.url = params.speculative.prefill.model.url;
task.local_path = params.speculative.prefill.model.path;
task.opts = opts;
tasks.push_back(task);
}

// handle hf_plan tasks
auto add_tasks = [&opts, &tasks](const hf_cache::hf_files & model_files,
Expand Down Expand Up @@ -626,6 +640,11 @@ void common_models_handler_apply(common_models_handler & handler, common_params
had_spec_url = true;
}

// handle plan_prefill (e.g. --spec-prefill-hf)
if (!plan_prefill.model_files.empty()) {
add_tasks(plan_prefill.model_files, plan_prefill.primary, params.speculative.prefill.model);
}

if (!plan.model_files.empty()) {
add_tasks(plan.model_files, plan.primary, params.model);
}
Expand Down Expand Up @@ -4382,6 +4401,111 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
params.speculative.draft.mparams.hf_file = value; // will be used if --spec-draft-hf is set
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_DRAFT_MODEL"));
add_opt(common_arg(
{"--spec-prefill", "--speculative-prefill"},
"enable speculative prefill using draft model to filter prompt tokens",
[](common_params & params) {
params.speculative.prefill.enabled = true;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL"));
add_opt(common_arg(
{"--spec-prefill-draft-model", "--spec-prefill-model", "-mpd", "--speculative-prefill-model", "--speculative-prefill-draft-model"}, "FNAME",
"draft model for speculative prefill (default: unused)",
[](common_params & params, const std::string & value) {
params.speculative.prefill.model.path = value;
params.speculative.prefill.model.hf_file = value; // will be used if --spec-prefill-hf is set
params.speculative.prefill.enabled = true;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL_MODEL"));
add_opt(common_arg(
{"--spec-prefill-draft-hf", "--spec-prefill-hf", "-hfpd", "--speculative-prefill-hf", "--speculative-prefill-draft-hf"}, "<user>/<model>[:quant]",
"Hugging Face model repository for speculative prefill draft model (default: unused)",
[](common_params & params, const std::string & value) {
params.speculative.prefill.model.hf_repo = value;
params.speculative.prefill.enabled = true;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL_HF"));
add_opt(common_arg(
{"--spec-prefill-draft-ngl", "--spec-prefill-ngl", "-nglpd", "--speculative-prefill-ngl", "--speculative-prefill-draft-ngl"}, "N",
string_format("max. number of speculative prefill draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: %s)",
params.speculative.prefill.n_gpu_layers == -1 ? "auto" : "all"),
[](common_params & params, const std::string & value) {
if (value == "auto") {
params.speculative.prefill.n_gpu_layers = -1;
} else if (value == "all") {
params.speculative.prefill.n_gpu_layers = -2;
} else {
params.speculative.prefill.n_gpu_layers = std::stoi(value);
}
if (!llama_supports_gpu_offload()) {
fprintf(stderr, "warning: no usable GPU found, --spec-prefill-ngl option will be ignored\n");
fprintf(stderr, "warning: one possible reason is that llama.cpp was compiled without GPU support\n");
fprintf(stderr, "warning: consult docs/build.md for compilation instructions\n");
}
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL_N_GPU_LAYERS"));
add_opt(common_arg(
{"--spec-prefill-draft-device", "--spec-prefill-device", "-devpd", "--speculative-prefill-device", "--speculative-prefill-draft-device"}, "<dev1,dev2,..>",
"comma-separated list of devices to use for offloading the speculative prefill draft model (none = don't offload)\n"
"use --list-devices to see a list of available devices",
[](common_params & params, const std::string & value) {
params.speculative.prefill.devices = parse_device_list(value);
params.speculative.prefill.enabled = true;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL_DEVICE"));
add_opt(common_arg(
{"--spec-prefill-draft-ctx", "--spec-prefill-ctx", "--spec-prefill-ctx-size", "--spec-prefill-max-ctx", "-cpd", "--speculative-prefill-ctx", "--speculative-prefill-max-ctx"}, "N",
string_format("context size for speculative prefill draft model (default: %d, 0 = draft training limit or main context)", params.speculative.prefill.n_ctx),
[](common_params & params, int value) {
if (value < 0) {
throw std::invalid_argument("spec-prefill context size must be >= 0");
}
params.speculative.prefill.n_ctx = value;
params.speculative.prefill.enabled = true;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL_CTX_SIZE"));
add_opt(common_arg(
{"--spec-prefill-p", "--spec-prefill-percentage"}, "P",
string_format("fraction of prompt tokens to retain during speculative prefill (default: %.2f)", (double) params.speculative.prefill.percentage),
[](common_params & params, const std::string & value) {
const float val = std::stof(value);
if (val <= 0.0f || val > 1.0f) {
throw std::invalid_argument("spec-prefill percentage must be between 0.0 (exclusive) and 1.0 (inclusive)");
}
params.speculative.prefill.enabled = true;
params.speculative.prefill.percentage = val;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}).set_env("LLAMA_ARG_SPEC_PREFILL_P"));
add_opt(common_arg(
{"--spec-prefill-chunk", "--spec-prefill-chunk-size"}, "N",
string_format("chunk grouping size for speculative prefill (default: %d, 0 to disable)", params.speculative.prefill.chunk_size),
[](common_params & params, int value) {
if (value < 0) {
throw std::invalid_argument("spec-prefill chunk size must be >= 0");
}
params.speculative.prefill.chunk_size = value;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}));
add_opt(common_arg(
{"--spec-prefill-lookahead", "--spec-prefill-lah"}, "N",
string_format("number of lookahead decode steps on draft model for attention estimation (default: %d)", params.speculative.prefill.look_ahead_cnt),
[](common_params & params, int value) {
if (value < 1) {
throw std::invalid_argument("spec-prefill lookahead count must be >= 1");
}
params.speculative.prefill.look_ahead_cnt = value;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}));
add_opt(common_arg(
{"--spec-prefill-pool-kernel"}, "N",
string_format("1D average pooling kernel size for attention smoothing (default: %d, 0 to disable)", params.speculative.prefill.pool_kernel_size),
[](common_params & params, int value) {
if (value < 0) {
throw std::invalid_argument("spec-prefill pool kernel size must be >= 0");
}
params.speculative.prefill.pool_kernel_size = value;
}
).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI}));
add_opt(common_arg(
{"--spec-type"}, common_speculative_all_types_str(),
string_format("comma-separated list of types of speculative decoding to use (default: %s)\n",
Expand Down Expand Up @@ -4896,6 +5020,12 @@ void common_params_add_preset_options(std::vector<common_arg> & args) {
[](common_params &, const std::string &) { /* unused */ }
).set_env(COMMON_ARG_PRESET_DEDUP_CACHE_MODELS).set_preset_only());

args.push_back(common_arg(
{"hidden"}, "0|1",
"in server router mode, omit this model from GET /models (it can still be loaded by name)",
[](common_params &, const std::string &) { /* unused */ }
).set_env(COMMON_ARG_PRESET_HIDDEN).set_preset_only());

// args.push_back(common_arg(
// {"pin"},
// "in server router mode, do not unload this model if models_max is exceeded",
Expand Down
2 changes: 2 additions & 0 deletions common/arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define COMMON_ARG_PRESET_LOAD_ON_STARTUP "__PRESET_LOAD_ON_STARTUP"
#define COMMON_ARG_PRESET_STOP_TIMEOUT "__PRESET_STOP_TIMEOUT"
#define COMMON_ARG_PRESET_DEDUP_CACHE_MODELS "__PRESET_DEDUP_CACHE_MODELS"
#define COMMON_ARG_PRESET_HIDDEN "__PRESET_HIDDEN"

//
// CLI argument parsing
Expand Down Expand Up @@ -138,6 +139,7 @@ void common_params_add_preset_options(std::vector<common_arg> & args);
struct common_models_handler {
common_download_hf_plan plan;
common_download_hf_plan plan_spec;
common_download_hf_plan plan_prefill;
common_download_opts opts;
};

Expand Down
19 changes: 19 additions & 0 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,20 @@ struct common_params_speculative_ngram_cache {
std::string lookup_cache_dynamic; // path of dynamic ngram cache file for lookup decoding
};

struct common_params_speculative_prefill {
bool enabled = false; // enable speculative prefill
common_params_model model; // draft model for speculative prefill
int32_t n_ctx = 0; // context size for draft model (0 = default/target context size)
int32_t n_gpu_layers = -1; // max draft model layers to store in VRAM (-1 - use default)
std::vector<ggml_backend_dev_t> devices; // devices to use for offloading the draft model
float percentage = 0.3f; // fraction of prompt tokens to retain (0.0 < p <= 1.0)
int32_t chunk_size = 32; // chunk grouping size (0 to disable chunking)
int32_t look_ahead_cnt = 8; // lookahead decode steps on draft model
int32_t pool_kernel_size = 13; // 1D average pooling kernel size for smoothing
bool keep_bos = true; // preserve first token (BOS)
bool keep_last = true; // preserve last token / tail chunk
};

struct common_params_speculative {
std::vector<enum common_speculative_type> types = { COMMON_SPECULATIVE_TYPE_NONE };

Expand All @@ -405,6 +419,8 @@ struct common_params_speculative {

common_params_speculative_ngram_cache ngram_cache;

common_params_speculative_prefill prefill;

bool has_dft() const {
return !draft.mparams.empty();
}
Expand All @@ -413,6 +429,9 @@ struct common_params_speculative {
return synth_len != -1.0 || !synth_rates.empty();
}

bool has_prefill() const {
return prefill.enabled && !prefill.model.empty();
}
uint32_t need_n_rs_seq() const {
bool needs_rs_seq = std::any_of(types.begin(), types.end(), [&](auto t) {
return t == COMMON_SPECULATIVE_TYPE_DRAFT_MTP || t == COMMON_SPECULATIVE_TYPE_DRAFT_EAGLE3 || t == COMMON_SPECULATIVE_TYPE_DRAFT_DFLASH || t == COMMON_SPECULATIVE_TYPE_DRAFT_DSPARK;
Expand Down
Loading
Loading