]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
5 weeks agoExtended SYCL oneDNN SDPA to non-FP16 KV caches (Q4_0–Q8_0 and FP32) (#25874)
Ozymandias_EBON [Tue, 4 Aug 2026 02:07:23 +0000 (21:07 -0500)]
Extended SYCL oneDNN SDPA to non-FP16 KV caches (Q4_0–Q8_0 and FP32) (#25874)

* sycl: extend oneDNN SDPA to Q4_0-Q8_0 and F32 KV caches

Extends the oneDNN SDPA path (PR #25222) to handle non-F16 KV caches by
dequantizing or converting K/V to dense FP16 on-device before feeding
them into the SDPA graph. The fused systolic kernel then runs identically
to the native FP16 path.

Supported KV types:
  - Q4_0, Q4_1, Q5_0, Q5_1, Q8_0: to_fp16_sycl / to_fp16_nc_sycl
  - F32: cont_to_f16_sycl<float>
  - BF16 and IQ types are excluded (no conversion kernel available)

Gate: non-F16 requires K >= 1024 and Q >= 32 (prefill only).
F16 KV runs at any length (existing behavior).

Also includes the stream sync fix (stream->wait_and_throw() unconditional,
PR #25741 by @malsbat) and removal of V_is_K_view aliasing (K and V are
always dequantized to separate buffers).

Co-Authored-By: Claude <redacted>
* docs: drop GGML_SYCL_FA_DEBUG from SYCL.md (not shipped in this PR)
Co-Authored-By: Claude <redacted>
---------

Co-authored-by: Claude <redacted>
5 weeks agochat : add new template for DeepSeek V4 Flash 0731 (#26398)
Thiago Padilha [Mon, 3 Aug 2026 22:59:11 +0000 (19:59 -0300)]
chat : add new template for DeepSeek V4 Flash 0731 (#26398)

* common/chat: update DeepSeek V4 templates

Align the DeepSeek V4 templates with the official encoders while keeping parser behavior out of this change.

- Default drop_thinking for DeepSeek V4 history so prior thinking is omitted unless preserve_reasoning is requested or tools are present.
- Add structured output response-format instructions to the V4 templates and pass the schema into template rendering.
- Add a separate Flash 0731 template for the updated high and max reasoning effort mapping.
- Cover reasoning effort, drop_thinking, structured output prompts, preserved reasoning, continuations, and empty tool arguments in template rendering tests.

Official references:
https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash/blob/main/encoding/encoding_dsv4.py
https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731/blob/main/encoding/encoding_dsv4.py

Assisted-by: Codex
* Fix deepseek v4 0731 template selection

* remove unneeded lower normalization

* Fix DSML parser to consume the tool call separator

* address aldehir requests

* address aldehir comment

5 weeks agovendor : update cpp-httplib to 0.52.0 (#26485)
Alessandro de Oliveira Faria (A.K.A.CABELO) [Mon, 3 Aug 2026 22:30:42 +0000 (19:30 -0300)]
vendor : update cpp-httplib to 0.52.0 (#26485)

5 weeks agovendor : update BoringSSL to 0.20260803.0 (#26523)
Alessandro de Oliveira Faria (A.K.A.CABELO) [Mon, 3 Aug 2026 18:31:15 +0000 (15:31 -0300)]
vendor : update BoringSSL to 0.20260803.0 (#26523)

5 weeks agomodel : support MTP in GLM-4.7-Flash (#24868)
jacekpoplawski [Mon, 3 Aug 2026 18:27:52 +0000 (20:27 +0200)]
model : support MTP in GLM-4.7-Flash (#24868)

5 weeks agotests: add model resolution test on synthetic repo listings (#26172)
Pascal [Mon, 3 Aug 2026 16:58:15 +0000 (18:58 +0200)]
tests: add model resolution test on synthetic repo listings (#26172)

* tests: add model resolution test on synthetic repo listings

Include download.cpp and arg.cpp inside a namespace with hf_cache
monkey patched to serve hardcoded listings, so the resolution and the
model handler assembly are tested end-to-end through the real CLI
parsing, without modifying the tested code and without network access.

Covers the primary, shard, mmproj, sidecar and preset resolution on
layouts mimicking real vendor conventions, replays every case on
permutations of the listing to assert determinism, and asserts the
final wired paths for the spec type auto-selection, the -md precedence
and the fallback suppression.

* tests: keep model resolution checks active and let the handler resolve

Replace assert with a REQUIRE macro alive in Release builds, key the
fake hf_cache by repo id so the real handler init resolves every plan
itself, check the exact shard sets, restrict the permutation exception
to the order dependent picks, and cover dflash and eagle3.

* tests: fix model resolution build on fatal warnings CI and Windows

The namespaced copy of the sources leaves many static functions unused
in this TU, exempt it from the unused warnings. Pre-include the
windows headers so arg.cpp does not pull them inside the namespace.
Declare the renamed copies of the download.h functions, verbatim from
the header and renamed in sync by the macros, so missing declaration
and missing prototype warnings are satisfied on every toolchain.

* tests: fix winsock inclusion order for the model resolution test

WIN32_LEAN_AND_MEAN and winsock2.h before windows.h, so http.h does
not redefine the socket types afterwards.

* tests: link cpp-httplib to the model resolution test

The test compiles its own copy of download.cpp, which calls httplib
directly, and the private link of llama-common does not propagate the
symbols under lld-link.

* common_http_client

* common: finish the http client wrapper

Add the virtual Head, Get and Post methods and the passthrough
setters to the common_http_client skeleton, move follow_location
into the constructor, expose the underlying client for the ranged
pull path, and rename the missed common_http_client_init call sites.

* tests: rewrite model resolution on the http client stub

Replace the namespace inclusion of the sources by a plain TU: the
common_http_client factory returns a stub serving hardcoded HF API
responses, so the real hf_cache parsing, resolution and CLI handler
run against synthetic listings in an isolated cache directory.

Failures print the named case, the reordering and the actual versus
expected values, the assembly cases use the full command line as
context, and the empty result cases are checked once to keep the
logs short.

* tests: fix the model resolution on Windows and the builds without TLS

Assert the exact expected paths composed like the cache does instead of
suffix matching on forward slashes, set the environment portably, and
serve the stub through an http endpoint so the builds rejecting the
https scheme still reach it. Pause the log so the negative cases can be
replayed on every reordering.

* tests: make the model resolution failures self explanatory

Resume the paused log before the failure report so the CI shows why
the tested code bailed, and format the stub oids portably.

* common: hold the http client factory behind exported functions

The factory was an inline variable, and the Windows shared builds
export functions but not data, so the executable and the DLL each had
their own instance: the stub installed by the test was invisible to
the library, which reached for the real endpoint and resolved nothing.
Route the creation through functions compiled into the library and
format the stub oids portably.

* common: add the http client factory source missed in the previous commit

* common: typedef the http client factory callback

Address review from @ngxson

* tests: serve the model resolution repos over the loopback

Replace the client stub by a real httplib server bound to the
loopback, so no C++ object crosses the module boundary anymore and
the library exercises its own client and transport end to end. The
debug shared build on Windows crashed inside the stubbed path.

* common: add portable common_get_env and common_set_env helpers

Address review from @ngxson

* common: drop the http client factory left without a caller

The loopback server made the stub substitution unnecessary, the client
init builds the real client directly again.

* common: read the model endpoint through the env helpers

* nit: drop the stub leftovers from the model resolution test

* common: align common_set_env and isolate the test cache per run

The POSIX branch now behaves like _putenv_s, so the helper has a single
contract on every platform, and common_get_env already reads an unset and
an empty variable alike.

The model resolution test keys its cache directory on the loopback port,
where two concurrent runs on the same machine used to share one directory
and the initial cleanup of either wiped the other.

* tests: move the model resolution server into main

* tests: support the DSpark sidecar resolution

* common: revert the http client to the plain httplib client

address review from @ngxson

---------

Co-authored-by: Xuan Son Nguyen <redacted>
5 weeks agoserver: add get_info tool (#26522)
Xuan-Son Nguyen [Mon, 3 Aug 2026 16:51:02 +0000 (18:51 +0200)]
server: add get_info tool (#26522)

* server: add get_info tool

* fix --rpc in docs

* server: harden get_info probe result handling

Report the OS as unknown when the probe process fails to spawn or times
out, so the diagnostic text from run() is never returned as an OS name.
Strip the probe output on both ends, which also drops the blank line
that ver prints before the version on Windows. Name the output and
timeout limits, and report an unreadable working directory as unknown
instead of an empty string.

* server: simplify get_info result handling

Drop the named limits and the working directory error branch, keeping
the probe result handling to a single expression.

---------

Co-authored-by: Pascal <redacted>
5 weeks agovocab : validate default special token ids (#26506)
Sigbjørn Skjæret [Mon, 3 Aug 2026 15:40:53 +0000 (17:40 +0200)]
vocab : validate default special token ids (#26506)

5 weeks agoggml: use dynamic allocation for split graph inputs (#22789)
AgoraPete [Mon, 3 Aug 2026 15:03:14 +0000 (17:03 +0200)]
ggml: use dynamic allocation for split graph inputs (#22789)

* ggml: use dynamic allocation for split graph inputs

Replace fixed-size GGML_SCHED_MAX_SPLIT_INPUTS arrays with dynamically
allocated buffers in the backend scheduler. This fixes crashes when
loading wide MoE models (Gemma 4, Qwen MoE, Mixtral, DeepSeek) on
multi-backend setups where graph splits exceed 30 input tensors.

- split->inputs: dynamic array with grow-on-demand
- sched->graph_inputs: dynamic array with grow-on-demand
- graph_size calculation now uses actual input count instead of fixed constant

* cont : clean-up

---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agoopencl: route large q6_K lm_head to the flat GEMV (#26427)
Hongqiang Wang [Mon, 3 Aug 2026 14:36:19 +0000 (07:36 -0700)]
opencl: route large q6_K lm_head to the flat GEMV (#26427)

* add a direct size condition for `large` weights; the original
  dimension condition is insufficient -- q6_K lm_head for gemma-4 E2B
  has [1536, 262144], which is big enough to slowdown gemv_noshuffle but
  does not satisfy the dimension condition (ne0 >= 2048)

5 weeks agograph : fix unused input tensors in minimax m3 graph (#26519)
Georgi Gerganov [Mon, 3 Aug 2026 14:32:01 +0000 (17:32 +0300)]
graph : fix unused input tensors in minimax m3 graph (#26519)

5 weeks agomodel: M3: Move MSA into a new memory implementation (#26338)
timkhronos [Mon, 3 Aug 2026 13:30:08 +0000 (15:30 +0200)]
model: M3: Move MSA into a new memory implementation (#26338)

* Move MSA logic from llama-kv-cache into llama-kv-cache-msa

* cont : minor

* cont : ws fix

---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agollama : allocate indexer cache only in "full" indexer layers (#26474)
fairydreaming [Mon, 3 Aug 2026 12:56:30 +0000 (14:56 +0200)]
llama : allocate indexer cache only in "full" indexer layers (#26474)

Co-authored-by: Stanisław Szymczyk <redacted>
5 weeks agoCUDA: Add backend sampler for penalties sampler (#25262)
Konrad Moren [Mon, 3 Aug 2026 12:26:09 +0000 (14:26 +0200)]
CUDA: Add backend sampler for penalties sampler (#25262)

* sampling: enhance penalty handling in common_sampler_init

- Set default value for penalty_last_n based on model context if not specified.
- Ensure penalty_last_n and n_prev are non-negative.
- Update llama_sampler_penalties structure to inherit from llama_sampler_backend and add backend input handling for penalties.
- Implement backend initialization and application logic for penalties, including frequency and presence adjustments.

* tests: add backend penalties sampling tests and utility functions

- Introduced `accept_prompt` and `unique_prompt_tokens` functions to handle prompt acceptance and token uniqueness.
- Implemented `compare_penalties_logits` to compare logits from backend and CPU samplers with penalties.
- Added `test_backend_penalties_sampling` to validate backend penalties with various configurations.
- Enhanced the test suite for better coverage of penalty handling in sampling.

* sampling: add support for top-k penalties in backend sampling

* sampling: add fix to ensure  stable numerical results. Preserve masked logits as -Inf and no longer generate NaN.

* sampling: enhance penalty comparison tests with masking penalties logic

* add comments on padding

* sampling: add comments on modifications

* add the unit test to cover masked-out token as -INF

* validate repeat penalty to ensure it is finite and greater than 0; add tests for invalid values

* refactor: test functions to share logic and be less verbose

* add test to cover case where previously penalized token is not part of candidates

* remove comments

* remove redundant penalty_last_n initialization and validation in common_sampler_init

* add support for penalties in sampler chain with configurable positions

* add validation for penalty parameters and enhance tests for non-finite values

* add context parameter to common_sampler_init and set default for penalty_last_n

* add llama_n_ctx parameter to common_sampler_init for improved sampler initialization

* replace penalty_last_n x n_candidates comparison matrix with a vocabulary-sized count tensor

* add tests for backend penalties sampling without filler entries , token_count.size() == n_active == n_max == 64

* add test for backend penalties sampling  after top-p with large history window

* remove as unused

* add is_disabled method, tensor logits reshape, add rest review suggestions

* clarify comment

5 weeks agoCUDA: Fix data-races when reusing SMEM in block_reduce (#26385)
Oliver Simons [Mon, 3 Aug 2026 12:22:44 +0000 (14:22 +0200)]
CUDA: Fix data-races when reusing SMEM in block_reduce (#26385)

* CUDA: Fix data-races when reusing block_reduce

block_reduce currently doesn't resync after reading from SMEM, causing
potential data-races when reusing SMEM for multiple reductions.

One may consider simply always adding this in block_reduce, but this
comes at a potential perf cost

* double-buffering for single-row softmax

* double-buffering for norm as well

* Add comment

* Add explanatory comment to block_reduce

* Specify need for + do memory barrier only in multi-warp scenario

* Implement review-suggestion from @gaugarg-nv

5 weeks agoserver: add notice for upcoming default port change 8080 --> 9931 (#26508)
Xuan-Son Nguyen [Mon, 3 Aug 2026 10:45:24 +0000 (12:45 +0200)]
server: add notice for upcoming default port change 8080 --> 9931 (#26508)

* server: add notice for upcoming default port change 8080 --> 6631

* add link to PR

* correct to 9931

5 weeks agoserver: (tools) add x-tool-cwd header (#26420)
Xuan-Son Nguyen [Mon, 3 Aug 2026 08:47:21 +0000 (10:47 +0200)]
server: (tools) add x-tool-cwd header (#26420)

* server: (tools) add x-tool-cwd header

* reuse str_to_lower from server-models

5 weeks agomodel: MTP support for Qwen3-Next (#25589)
Masashi Yoshimura [Mon, 3 Aug 2026 08:15:01 +0000 (17:15 +0900)]
model: MTP support for Qwen3-Next (#25589)

* mtp for qwen3nex

* fix for python type-check

* Fix to compute num_mtp from directly mtp layer

* define opt_num_mtp_layers in _QwenMtpMixin and fix some comments

* Fix for python type check

* Update gguf-py/gguf/constants.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* rebase and add load_mtp flags

* Update src/models/qwen3next.cpp

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update src/models/qwen3next.cpp

Co-authored-by: Sigbjørn Skjæret <redacted>
---------

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agollama : MTP support for DeepSeek V3.2 (#26457)
fairydreaming [Mon, 3 Aug 2026 06:25:01 +0000 (08:25 +0200)]
llama : MTP support for DeepSeek V3.2 (#26457)

* llama : MTP support for DeepSeek V3.2

* model : no need to include MTP layers during DeepSeek V3.2 model type discovery

---------

Co-authored-by: Stanisław Szymczyk <redacted>
5 weeks agometal: implement DSv4 Lightning Indexer (#25893)
Thiago Padilha [Mon, 3 Aug 2026 04:33:37 +0000 (01:33 -0300)]
metal: implement DSv4 Lightning Indexer (#25893)

* metal: implement F16 Lightning Indexer

- Implement GGML_OP_LIGHTNING_INDEXER for 128-dimensional, 64-head inputs
  with F32 queries and weights plus F16 keys and masks.
- Add tiled and tail kernels and test KV lengths around 8- and 64-element
  boundaries.

llama-bench (--mmap 1, -fa 1, -p 512, -n 128; d=0/10k/20k/30k):

Before:
- pp512: 153.73 ± 0.87 t/s
- tg128: 8.91 ± 0.04 t/s
- pp512 @ d10000: 73.90 ± 0.39 t/s
- tg128 @ d10000: 8.66 ± 0.03 t/s
- pp512 @ d20000: 45.83 ± 0.18 t/s
- tg128 @ d20000: 8.26 ± 0.03 t/s
- pp512 @ d30000: 33.40 ± 0.21 t/s
- tg128 @ d30000: 7.94 ± 0.01 t/s

After:
- pp512: 155.19 ± 0.91 t/s
- tg128: 8.95 ± 0.04 t/s
- pp512 @ d10000: 86.95 ± 0.69 t/s
- tg128 @ d10000: 9.00 ± 0.05 t/s
- pp512 @ d20000: 62.01 ± 0.45 t/s
- tg128 @ d20000: 8.68 ± 0.04 t/s
- pp512 @ d30000: 49.18 ± 0.33 t/s
- tg128 @ d30000: 8.60 ± 0.02 t/s

Assisted-by: Codex
* metal: stage Lightning Indexer K tiles

- Stage and dequantize K in F16 threadgroup memory before simdgroup matrix loads.
- Zero-fill partial tiles and guard stores so all KV segments use the same numerical path.
- Support F32, F16, BF16, Q4_0, Q4_1, Q5_0, Q5_1, and Q8_0 K caches.

llama-bench (--mmap 1, -fa on, -p 512, -n 128; d=0/10k/20k):

- pp512: 160.38 +/- 1.01 t/s
- tg128: 9.08 +/- 0.03 t/s
- pp512 @ d10000: 88.37 +/- 0.46 t/s
- tg128 @ d10000: 9.07 +/- 0.04 t/s
- pp512 @ d20000: 62.53 +/- 0.46 t/s
- tg128 @ d20000: 8.84 +/- 0.03 t/s

Assisted-by: Codex
* dedup Lightning Indexer constants, fix flaky test

* cont : fix whitespace

---------

Co-authored-by: forforever73 <redacted>
Co-authored-by: Georgi Gerganov <redacted>
5 weeks agometal : add SILU_BACK (#25982)
Talha Adnan [Sun, 2 Aug 2026 19:39:28 +0000 (14:39 -0500)]
metal : add SILU_BACK (#25982)

* feat(silu_back): implemented silu_back op for f32

* fix(silu_back): removed redundant asserts in ggml-metal-ops.cpp function ggml_metal_op_silu_back.

5 weeks agometal : add F16 support for bin ops (#26465)
Georgi Gerganov [Sun, 2 Aug 2026 19:28:17 +0000 (22:28 +0300)]
metal : add F16 support for bin ops (#26465)

5 weeks agoopencl: limit local workgroup size for GLU operation (#26383)
mgroeber9110 [Sun, 2 Aug 2026 18:44:00 +0000 (20:44 +0200)]
opencl: limit local workgroup size for GLU operation (#26383)

5 weeks agometal: implement DeepSeek V4 hyper-connections (#26459)
Georgi Gerganov [Sun, 2 Aug 2026 18:06:02 +0000 (21:06 +0300)]
metal: implement DeepSeek V4 hyper-connections (#26459)

- Implement GGML_OP_DSV4_HC_COMB, GGML_OP_DSV4_HC_PRE, and
  GGML_OP_DSV4_HC_POST with SIMDgroup register and shuffle optimized kernels.
- Add Metal dispatch and support plumbing and test the production Sinkhorn
  iteration count and embedding width.

Assisted-by: Codex
Co-authored-by: Thiago Padilha <redacted>
5 weeks agocommon: support the DSpark sidecar resolution (#26458)
Pascal [Sun, 2 Aug 2026 17:25:27 +0000 (19:25 +0200)]
common: support the DSpark sidecar resolution (#26458)

The dspark- files resolve like the other speculative sidecars: the
-hfd tag applies to them, a requested sidecar resolves without a full
model at the tag, and an explicit -md selection disables the discovery.
When no type is requested, dspark outranks dflash in the auto-selection
since its sidecar carries the extra Markov head.

5 weeks agoconvert: add option to create separate dspark GGUF (#26452)
Aman Gupta [Sun, 2 Aug 2026 15:16:31 +0000 (23:16 +0800)]
convert: add option to create separate dspark GGUF (#26452)

* convert: add option to create separate dspark GGUF

* add --no-nextn

* fix convert bug

5 weeks agoopencl: bugfix increment ref_count in ggml_backend_opencl_init() (#26162)
akleine [Sun, 2 Aug 2026 13:43:00 +0000 (15:43 +0200)]
opencl: bugfix increment ref_count in  ggml_backend_opencl_init() (#26162)

Incrementing `ref_count` at the beginning is important later
in the `free()` method of the `ggml_backend_opencl_context` at program end.
If we do not increment the `ref_count`, the result would be -1 here,
and consequently, the profiling data would not be flushed and written.
( #ifdef GGML_OPENCL_PROFILING )

5 weeks agoDeepseekV4 MTP + DSpark (#25784)
Aman Gupta [Sun, 2 Aug 2026 12:55:34 +0000 (20:55 +0800)]
DeepseekV4 MTP + DSpark (#25784)

5 weeks agochat : add qwen3 specialized parser (#26252)
Aldehir Rojas [Sun, 2 Aug 2026 09:13:20 +0000 (04:13 -0500)]
chat : add qwen3 specialized parser (#26252)

* Add tagged thinking tool parser

* chat : refactor and add permute helper

* cont : add support for <tool_call> omission

* cont : update tool delimiters

* cont : add comment for qwen3-coder

* cont : fix trigger pattern for <function

---------

Co-authored-by: Bart de Boer <redacted>
5 weeks agosycl: fix classification of iGPUs (#26105)
KyleHagy [Sun, 2 Aug 2026 07:10:32 +0000 (00:10 -0700)]
sycl: fix classification of iGPUs (#26105)

5 weeks agomodel : load MiMo V2 MTP tensors only if used (#26412)
Sigbjørn Skjæret [Sun, 2 Aug 2026 07:03:05 +0000 (09:03 +0200)]
model : load MiMo V2 MTP tensors only if used (#26412)

5 weeks agoggml-webgpu: add support for f16 repeat (#26307)
Masashi Yoshimura [Sun, 2 Aug 2026 06:28:31 +0000 (15:28 +0900)]
ggml-webgpu: add support for f16 repeat (#26307)

5 weeks agotest: fix some CI errors (#26415)
Xuan-Son Nguyen [Sat, 1 Aug 2026 22:16:29 +0000 (00:16 +0200)]
test: fix some CI errors (#26415)

5 weeks agovulkan: extend topk_moe fusion to support sqrt(softplus) (#26124)
Jeff Bolz [Sat, 1 Aug 2026 19:18:07 +0000 (14:18 -0500)]
vulkan: extend topk_moe fusion to support sqrt(softplus) (#26124)

5 weeks agovendor : update BoringSSL to 0.20260730.0 (#26353)
Alessandro de Oliveira Faria (A.K.A.CABELO) [Sat, 1 Aug 2026 18:53:00 +0000 (15:53 -0300)]
vendor : update BoringSSL to 0.20260730.0 (#26353)

5 weeks agoagents: clarify comment style and jinja knowledge (#26405)
Xuan-Son Nguyen [Sat, 1 Aug 2026 16:45:46 +0000 (18:45 +0200)]
agents: clarify comment style and jinja knowledge (#26405)

* agents: clarify comment style and jinja knowledge

* improve Security review a bit

5 weeks agocli : persist reasoning_content in chat history (#26362)
Nico [Sat, 1 Aug 2026 16:03:32 +0000 (12:03 -0400)]
cli : persist reasoning_content in chat history (#26362)

* cli : persist reasoning_content in chat history

llama-cli collected reasoning from the stream for display but only
stored assistant content in messages, so --reasoning-preserve could
not re-inject prior thoughts on later turns.

5 weeks agomtmd: add minicpmv46 downsample (#25993)
tc-mb [Sat, 1 Aug 2026 11:38:36 +0000 (19:38 +0800)]
mtmd: add minicpmv46 downsample (#25993)

* add minicpmv46 downsample

Signed-off-by: tc-mb <redacted>
* put downsample mode inside gguf.

Signed-off-by: tc-mb <redacted>
* build mtmd_image_preprocessor_llava_uhd

Signed-off-by: tc-mb <redacted>
* fix code

Signed-off-by: tc-mb <redacted>
* add convert

Signed-off-by: tc-mb <redacted>
* add 4x ignore vit merger

Signed-off-by: tc-mb <redacted>
---------

Signed-off-by: tc-mb <redacted>
5 weeks agochat : enable tool call in thinking for DS4 (#26269)
Piotr Wilkin (ilintar) [Sat, 1 Aug 2026 05:13:07 +0000 (07:13 +0200)]
chat : enable tool call in thinking for DS4 (#26269)

5 weeks agovulkan: add POOL_1D op (#25431)
Anand Patil [Fri, 31 Jul 2026 14:48:58 +0000 (09:48 -0500)]
vulkan: add POOL_1D op (#25431)

* vulkan : add pool1d push constants and pipeline field

Declared data structures needed for POOL1D OP, which are the vk_op_pool1d_push_constants struct and pipeline_pool1d_f32 field.

* vulkan : add pool1d compute shader

Added pool1d.comp for Vulkan backend mirroring the existing pool2d shader.

* vulkan : add full GGML_OP_POOL_1D support

Added pipeline creation and op dispatch for 1D pooling in the Vulkan backend.

* vulkan : fix pool1d shader logic

Registered pool1d_f32 in vulkan-shaders-gen.cpp and fixed tensor dimension indices and avg pool scale.

* vulkan : fix pool1d end boundary crash and expand test coverage

Fixed an issue where the shader crashed when the end boundary was negative when k0 < p0. Also, added more test cases related to this fix.

5 weeks agovulkan: Introduce driver version check for Windows Intel GPU to mitigate crashing...
Masato Nakasaka [Fri, 31 Jul 2026 14:26:37 +0000 (23:26 +0900)]
vulkan: Introduce driver version check for Windows Intel GPU to mitigate crashing (#25192)

* Removed crash guard for Intel

Crash fixed from driver 32.0.101.8860

* Added driver version check for windows

* Change to convert from driverVersion rather than string

* No need to use signed

* Refactor

* allow GPU other than Xe2+

* adjusted function body position

5 weeks agomtmd: add n_embd_head (#26342)
Xuan-Son Nguyen [Fri, 31 Jul 2026 13:30:19 +0000 (15:30 +0200)]
mtmd: add n_embd_head (#26342)

Co-authored-by: Daniel Han <redacted>
5 weeks agoSupport rotated kv cache quant (#26180)
timkhronos [Fri, 31 Jul 2026 13:06:40 +0000 (15:06 +0200)]
Support rotated kv cache quant (#26180)

5 weeks agollama : load MTP tensors only if they are really used (#26296)
fairydreaming [Fri, 31 Jul 2026 12:57:02 +0000 (14:57 +0200)]
llama : load MTP tensors only if they are really used (#26296)

* llama : load MTP tensors only if they are really used

* llama : skip loading MTP (if not used) in remaining models that support MTP

---------

Co-authored-by: Stanisław Szymczyk <redacted>
5 weeks agovulkan: update vulkan sdk to 1.4.357.0 (#26303)
Jeff Bolz [Fri, 31 Jul 2026 12:27:03 +0000 (13:27 +0100)]
vulkan: update vulkan sdk to 1.4.357.0 (#26303)

5 weeks agoserver: correct accepted tokens when need draft token replay (#26320)
Ruixiang Wang [Fri, 31 Jul 2026 08:16:17 +0000 (10:16 +0200)]
server: correct accepted tokens when need draft token replay (#26320)

* spec: correct accepted tokens when need draft token replay

* cont : naming

---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agocuda: extract Q2_0 elements via __byte_perm (#25603)
David Friehs [Fri, 31 Jul 2026 08:15:44 +0000 (10:15 +0200)]
cuda: extract Q2_0 elements via __byte_perm (#25603)

5 weeks agoSYCL: add oneMKL GEMM flash attention for XMX-accelerated prompt proc… (#25025)
Ozymandias_EBON [Fri, 31 Jul 2026 07:43:16 +0000 (02:43 -0500)]
SYCL: add oneMKL GEMM flash attention for XMX-accelerated prompt proc… (#25025)

* SYCL: add oneMKL GEMM flash attention for XMX-accelerated prompt processing

* fattn-mkl: fix interleaved dst layout in normalize kernel

- Fix mkl_fa_normalize_head: use interleaved dst layout
  ((query * n_q_heads + head) * DV) matching TILE's
  flash_attn_combine_results. Previously used dense head-major
  layout which wrote head outputs to wrong addresses, corrupting
  attention for all models except Qwen3.6-27B (where GQA=6 heads
  were sparse enough to avoid visible overlap).

- Remove 7 redundant stream->wait() calls — SYCL in-order queue
  already serializes pure SYCL kernel dependencies. Retain only
  the 4 MKL GEMM ↔ SYCL handshake barriers (oneMKL GEMM uses its
  own internal queue that does not respect SYCL in-order).

- Remove unused dst_row_stride, diagnostic clutter, and dead
  K/V hex dump (fa_diag block in fattn-mkl.cpp).

- Add MKL_FA_DISABLE=1 env var for A/B testing.
- Add FA-DISP watchdog (MKL_FA_DEBUG=1) and FA-DIAG output
  fingerprint (MKL_FA_DIAG=1) in fattn.cpp.

Tested: Gemma-4-26B, Gemma-4-31B, Qwen3.6-27B, Qwen3.6-35B-A3B
Perf (B70/Battlemage, 32K, q8_0 KV):
  Gemma-4-26B:  1473 t/s MKL vs 746 TILE (1.97x)
  Qwen3.6-27B:   609 t/s MKL vs 330 TILE (1.85x)

Co-Authored-By: Claude Code on DeepSeek-v4-Pro
* Thank you for the review feedback: rename env vars, use GGML_LOG_INFO, document in SYCL.md

Completed the following:
- Rename MKL_FA_DISABLE → GGML_SYCL_ENABLE_MKL_FA (inverted: 0 to disable)
- Rename MKL_FA_DEBUG → GGML_SYCL_MKL_FA_DEBUG
- Rename MKL_FA_DIAG → GGML_SYCL_MKL_FA_DIAG
- Replace fprintf(stderr, ...) / fflush(stderr) with GGML_LOG_INFO() macro
- Document all three env vars in docs/backend/SYCL.md under Runtime
- Add comment explaining MKL FA activation trigger (flash-attn + quantized
  KV cache + batch-size >= 1024 + n_kv >= 1024)

Resolves review feedback from arthw.
Again, thank you!!!

Co-Authored-By: Claude Code on DeepSeek-v4-Pro
* Thank you for the review feedback round 2: use ggml_sycl_get_env, remove dup waits, gate perf macros

- Replace raw getenv() with ggml_sycl_get_env() in all 4 env-var checks
  (fattn.cpp: GGML_SYCL_ENABLE_MKL_FA, GGML_SYCL_MKL_FA_DEBUG,
   GGML_SYCL_MKL_FA_DIAG; fattn-mkl.cpp: GGML_SYCL_MKL_FA_DEBUG)
- Remove duplicated stream->wait() before ev.wait_and_throw() in GEMM
  KQ and GEMM VKQ — ev.wait_and_throw() already waits for completion
- Gate MKL_ACCUM macro behind do_print so timing accumulators are
  no-ops in normal operation
- Remove redundant MIT/Intel copyright header from fattn-mkl.cpp
- Remove unused #include <cfloat>
- Expand SYCL.md MKL FA docs with step-by-step activation trigger
  and example llama-cli command

Again, thank you!!!

Co-Authored-By: Claude Code on DeepSeek-v4-Pro
* fattn-mkl: enable MKL FA for all KV cache types

Remove the quantized-only restriction on MKL activation — the MKL
kernel converts any non-F16 K/V to F16 via to_fp16_sycl before GEMM,
so F16 (default), BF16, and F32 caches all benefit from XMX hardware
acceleration.  The type restriction was an unnecessary gate.

Before (F16/BF16 default cache + FA on at 32K prefill): ~356 t/s (TILE path)
After:  ~670 t/s (MKL path, matching quantized-cache baseline)

Minimal change: two conditions removed, one comment updated in fattn.cpp.
No kernel or conversion code changes — the dequant pipeline already
covers all types.

* fattn-mkl: rename mkl_disable -> mkl_enable for clarity

* fattn-mkl: refine MKL FA dispatch gates

Three changes:
1. Remove quantized-only restriction - MKL FA activates for all
   KV cache types (F16 default, BF16, F32, quantized).  The MKL
   kernel converts non-F16 K/V via to_fp16_sycl before GEMM.
2. Rename mkl_disable -> mkl_enable to match env var
   (GGML_SYCL_ENABLE_MKL_FA).
3. Replace batch-size threshold with Q->ne[1] >= 32 gate.
   Keeps TG (Q=1) and MTP drafts (Q=3-8) on VEC path where
   fused kernel beats MKL launch overhead.  Routes all
   multi-token prefill through XMX-accelerated GEMM.

Production data confirms Q patterns: 1-8 TG, 32-127 cache reuse,
128+ full reprocess.  At 32K F16/BF16 FA-on: 356 -> 670 t/s.

* ggml-sycl: fix F16 cache + MKL FA multi-turn corruption; add gate guards

Two changes:

1. Always copy F16 K/V to dense row-major buffers before MKL GEMM.
   Previously F16 was read in-place with raw tensor strides. During
   multi-turn conversations, the accumulated KV cache had different
   stride properties than a fresh prefill, producing corrupted outputs.
   Now dense F16 gets a fast memcpy; interleaved (Gemma) gets a strided
   copy kernel. This matches what the quantized paths already did through
   to_fp16_sycl.

2. Gate MKL FA on unsupported op params (max_bias, logit_softcap, batch
   dim mismatch) and pathological F16 strides (nb[1] not a multiple of
   ne[0]*2). These conditions would previously crash inside the MKL
   kernel. Pathological strides (test-only) and ALiBi/softcap fall
   through to TILE/VEC which handle them correctly.

The stride check uses modulo rather than equality, so both dense
(nb1 == ne0*2) and interleaved (nb1 == H * ne0*2) pass — all real
models use these layouts. Only test cases with overlapping rows
(nb1=32 or nb1=75 for ne0=40) are blocked.

Thanks to hmscider for the oneDNN FA PR (#25222) which surfaced the
same insight: always normalize inputs to contiguous F16 before GEMM.

Co-Authored-By: Claude Code using DeepSeek-V4-Pro <redacted>
* fattn-mkl: fix quant+GQA KV strides, tighten MKL gate, add K>=1024 tests

Adding K>=1024 flash-attn test cases surfaced several MKL bugs:

- Quant K/V with a padded seq-view (real KV cache) used the wrong
  strides in the dequant path... only the true Gemma interleave
  layout should reconstruct strides. nb[2] vs ne[1]*nb[1]
- Gate was firing on shapes the kernel doesn't handle: head_dim < 64
  or not a multiple of 64, MHA, attention sinks, and
  bf16 decode... fell through to vec which no bf16 case.

Gate MKL to the validated envelope: gqa>=2, head_dim 64 through 512
(has to be a multiple of 64) with matching K/V head size, mask,
no sinks/alibi/softcap... everything else falls back to tile.
Covers Qwen Dense/MoE and Gemma4 Dense/MoE

Ran test-backend-ops -o FLASH_ATTN_EXT: 3641/3641 pass.
Perplexity unchanged... 6.7267 MKL vs 6.7290 stock using
Qwen 27b q5_k_xl

* Update ggml/src/ggml-sycl/fattn.cpp

Co-authored-by: Neo Zhang <redacted>
* Update ggml/src/ggml-sycl/fattn.cpp

Co-authored-by: Neo Zhang <redacted>
* Update ggml/src/ggml-sycl/fattn.cpp

Co-authored-by: Neo Zhang <redacted>
* fattn-mkl: bound attention scratch so it doesn't grow with batch or context... also dropped the bf16 comment in fattn.cpp per arthw review.

* Update ggml/src/ggml-sycl/fattn-mkl.cpp

Co-authored-by: Neo Zhang <redacted>
* Update ggml/src/ggml-sycl/fattn-mkl.cpp

Co-authored-by: Neo Zhang <redacted>
* apply arthw suggestions: enum for dequant modes, macro for wg_size, env-var one-liners

---------

Co-authored-by: Claude Code using DeepSeek-V4-Pro <redacted>
Co-authored-by: Neo Zhang <redacted>
5 weeks ago[SYCL] support the missed types in cpy (#26005)
Neo Zhang [Fri, 31 Jul 2026 07:25:16 +0000 (15:25 +0800)]
[SYCL] support the missed types in cpy (#26005)

* support the missed types in cpy

* use correct funct

* rm unused code

5 weeks agollama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache...
fairydreaming [Fri, 31 Jul 2026 07:03:30 +0000 (09:03 +0200)]
llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized (#25871)

* llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized

* llama : enforce the same K and V cache types for MLA models

---------

Co-authored-by: Stanisław Szymczyk <redacted>
5 weeks agoggml-zendnn : group matmul direct API for mul_mat_id (#25918)
Sachin Sharma [Fri, 31 Jul 2026 06:40:52 +0000 (12:10 +0530)]
ggml-zendnn : group matmul direct API for mul_mat_id (#25918)

* ggml-zendnn : group matmul API for mul_mat_id

* ggml-zendnn : scale MUL_MAT_ID fallback threshold by expert count

5 weeks agosycl : support dev2dev memcpy by DEV2DEV_MEMCPY_FORWARD (#26234)
Neo Zhang [Fri, 31 Jul 2026 06:20:28 +0000 (14:20 +0800)]
sycl : support dev2dev memcpy by DEV2DEV_MEMCPY_FORWARD (#26234)

Co-authored-by: Neo Zhang Jianyu <redacted>
5 weeks ago[SYCL] Support q2 mul_mat (#26231)
Neo Zhang [Fri, 31 Jul 2026 06:19:41 +0000 (14:19 +0800)]
[SYCL] Support q2 mul_mat (#26231)

* support q2_0 in mul_mat

* support more q2_0 case

5 weeks agosycl: fuse RMS_NORM + MUL (#26015)
Titaniumtown [Fri, 31 Jul 2026 06:17:53 +0000 (23:17 -0700)]
sycl: fuse RMS_NORM + MUL (#26015)

5 weeks agoggml-webgpu: improve flash_attn_vec for quantized KV at long contexts (#25956)
Masashi Yoshimura [Fri, 31 Jul 2026 06:08:40 +0000 (15:08 +0900)]
ggml-webgpu: improve flash_attn_vec for quantized KV at long contexts (#25956)

* improve fa of quantized kv cache

* Fix some bugs and some comments.

* fix v type check and some comments

* Fix build error caused by rebasing

* editorconfig checking pass

5 weeks agomtmd: add lanczos resize method [no release] (#26341)
Xuan-Son Nguyen [Thu, 30 Jul 2026 19:59:49 +0000 (21:59 +0200)]
mtmd: add lanczos resize method [no release] (#26341)

5 weeks agoserver: support inp embd to generate next token (#26313)
Xuan-Son Nguyen [Thu, 30 Jul 2026 19:40:38 +0000 (21:40 +0200)]
server: support inp embd to generate next token (#26313)

* server: support embd for sampled token

* fix ~server_batch()

5 weeks agovulkan: Support quantized concat (#25684)
Jeff Bolz [Thu, 30 Jul 2026 18:11:32 +0000 (19:11 +0100)]
vulkan: Support quantized concat (#25684)

5 weeks agoTest support for alternative conv layout (#25617)
pmaybank [Thu, 30 Jul 2026 17:14:16 +0000 (18:14 +0100)]
Test support for alternative conv layout (#25617)

* add  bool cwhn = true to conv_2d test cases

* add layout check at graph building time

* extend layout checks for conv2d.cu kernel

* in CPU back-end kernel needs to be stored contiguously to prevent test failures with cwhn=1

* trim white space

* do op support check in vulkan backend

* fix CI failure and vulkan run-time assert failure by introducing new graph build-time check in ggml_backend_vk_device_supports_op

* add additional check in support_op function for Vulkan to fix run-time assert failure

5 weeks agollama-context : sync pending async copies before clearing embd_seq (#25676)
o7si [Thu, 30 Jul 2026 16:48:00 +0000 (00:48 +0800)]
llama-context : sync pending async copies before clearing embd_seq (#25676)

5 weeks agotests : avoid building get-model.cpp many times (#26317)
Georgi Gerganov [Thu, 30 Jul 2026 16:34:04 +0000 (19:34 +0300)]
tests : avoid building get-model.cpp many times (#26317)

* tests : remove get-model.cpp

* tests : fix quant type selection

5 weeks agoggml-cuda: Allow transpose-free gemmv computation (#26171)
Robert Esclapez [Thu, 30 Jul 2026 13:39:46 +0000 (15:39 +0200)]
ggml-cuda: Allow transpose-free gemmv computation (#26171)

When matrix's weights are shaped 1xK is leverage a transpose-free
computation to use mat_mul_vec_f.

5 weeks agoreadme : refresh (#26280)
Georgi Gerganov [Thu, 30 Jul 2026 13:14:37 +0000 (16:14 +0300)]
readme : refresh (#26280)

* docs : center badges and links, remove Hot topics

- Use <div align="center"> for GitHub-compatible centering
- Add dev branches and compile times links
- Remove Hot topics section

Assisted-by: llama.cpp:Qwen3.6-27B
* readme : remove sections

* docs : center badges, remove Hot topics, extract sections, remove tools

- Use <div align="center"> for GitHub-compatible centering
- Add dev branches and compile times links
- Add lib llama API and llama-server REST API links
- Remove Hot topics section
- Remove Recent API changes section
- Extract XCFramework section into docs/xcframework.md
- Extract Completions section into docs/completions.md
- Extract Obtaining and quantizing models into docs/models.md
- Remove tools usage sections (llama-cli, llama-server, etc.)
- Move Contributing section to the end

Assisted-by: llama.cpp:Qwen3.6-27B
* cont : arrange links

* cont : fix ws

* cont : remove seminal papers

* cont : change sample model

* cont : trim-down contributing section

* cont : sort backends alphabetically

* cont : words

* cont : add fig captions

* docs : models words

* readme : shorter caption

* cont : fix typo

* cont : add window frame to screenshot

5 weeks agosync : ggml
Georgi Gerganov [Thu, 30 Jul 2026 12:43:44 +0000 (15:43 +0300)]
sync : ggml

5 weeks agoggml : bump version to 0.18.0 (ggml/1576)
Georgi Gerganov [Thu, 30 Jul 2026 12:42:47 +0000 (15:42 +0300)]
ggml : bump version to 0.18.0 (ggml/1576)

5 weeks agoCUDA: add Q2_0 support (#25707)
Pasha Khosravi [Thu, 30 Jul 2026 09:33:25 +0000 (02:33 -0700)]
CUDA: add Q2_0 support (#25707)

5 weeks agoRemove custom cpu op from the M3 graph, express with stock ops (#26297)
timkhronos [Thu, 30 Jul 2026 08:30:18 +0000 (10:30 +0200)]
Remove custom cpu op from the M3 graph, express with stock ops (#26297)

5 weeks agometal: fix memory unwire if model is freed without any GPU operations (#26082)
Niklas Wenzel [Thu, 30 Jul 2026 08:11:27 +0000 (10:11 +0200)]
metal: fix memory unwire if model is freed without any GPU operations (#26082)

* metal: fix memory leak if model is freed without any GPU operations

* metal: run dummy work only if residency sets are used

* metal: wrap function in #if defined

* metal: measure system-wide wired memory in test

* metal: always build regression test

Co-authored-by: YiChen Lv <redacted>
---------

Co-authored-by: YiChen Lv <redacted>
5 weeks agoui: IndexedDB and Conversations data fixes (#26278)
Aleksander Grygier [Thu, 30 Jul 2026 08:10:37 +0000 (10:10 +0200)]
ui: IndexedDB and Conversations data fixes (#26278)

* fix: single-flight conversations store init

* refactor: remove unused legacy-migration util

* fix: make createSystemMessage transactional

* fix: delete message branches cascading on edit/regenerate

* fix: stop stamping lastModified on conversation metadata updates

* fix: count cascaded forks in bulk delete toast, bulkify deleteAll

* refactor: drop redundant conversation list respreads

* refactor: create conversation in a single write

* fix: use table constant in toggleConversationPin

* fix: keep the system message placeholder out of the edit form

* fix: keep focus in the system message editor after opening it

* fix: focus the main chat form after submitting a system message

* fix: update timestamp of the correct conversation on stream completion

5 weeks agoggml : Fix issue with kleidiai ci and stringop overflow warning (#26277)
Jonathan Clohessy [Thu, 30 Jul 2026 06:17:30 +0000 (07:17 +0100)]
ggml : Fix issue with kleidiai ci and stringop overflow warning (#26277)

Signed-off-by: Jonathan Clohessy <redacted>
5 weeks ago[UT] enhance UT to show all real unsupported backends (#25234)
Neo Zhang [Thu, 30 Jul 2026 06:04:58 +0000 (14:04 +0800)]
[UT] enhance UT to show all real unsupported backends (#25234)

* enhance UT to show real unsupported backends

* cont : simplify

---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agomimo2: address MTP review feedback (#26228)
Tunahan [Thu, 30 Jul 2026 03:55:58 +0000 (05:55 +0200)]
mimo2: address MTP review feedback (#26228)

Co-authored-by: tnhnyc <redacted>
5 weeks agofix: increase greeting spacing on md screens (#26287)
Aleksander Grygier [Wed, 29 Jul 2026 17:25:13 +0000 (19:25 +0200)]
fix: increase greeting spacing on md screens (#26287)

5 weeks agollama: move suppress_tokens handling to common/sampling (#26276)
Xuan-Son Nguyen [Wed, 29 Jul 2026 16:02:30 +0000 (18:02 +0200)]
llama: move suppress_tokens handling to common/sampling (#26276)

* llama: move suppress_tokens handling to common/sampling

* address security issues

* rm has_logit_bias

5 weeks agoggml-cuda : disable MMQ on devices with less than 48 KiB shared memory (#26141)
Kakaru [Wed, 29 Jul 2026 12:27:35 +0000 (20:27 +0800)]
ggml-cuda : disable MMQ on devices with less than 48 KiB shared memory (#26141)

ggml_cuda_should_use_mmq() selects MMQ purely from the quantization
type. The current MMQ configurations are designed and maintained against
a minimum of 48 KiB per-block shared memory, the limit provided by
NVIDIA Pascal GPUs and later. On devices that report less, no supported
MMQ tile fits and mul_mat_q_switch_J() aborts when every tile size
exceeds the device's per-block shared memory budget.

Disable MMQ when smpbo < 48 KiB so the caller falls back to the BLAS
path instead of hitting GGML_ABORT. Some current MUSA QY1 devices
report only 28 KiB and are covered by this guard.

Reproduced on a Moore Threads MTT S70 (arch mp_21, 28 KiB shared memory
per block) with an RWKV-7 0.1B Q8_0 model:

  $ llama-bench -m rwkv7-g1d-0.1b-Q8_0.gguf -p 128 -n 0
  J_best=0
  ggml/src/ggml-cuda/template-instances/../mmq.cuh:1521: fatal error
  (core dumped)

Only prefill (batch > 1) is affected; token generation is fine. After
the fix the same device falls back to the BLAS path:

  Q8_0    pp128 1470.7 t/s, tg8 55.3 t/s   (was: abort)
  FP16    unchanged
  Q4_K_M  unchanged

This matches a -DGGML_CUDA_FORCE_CUBLAS=ON build (pp128 1464.2 t/s),
which confirms the fallback path is the one being taken.

This is not MUSA-specific: any device with less than 48 KiB per-block
shared memory is affected.

Co-authored-by: KakaruHayate <redacted>
5 weeks agosycl: contiguous fast path + 32-bit index math for unary elementwise ops (#25946)
Titaniumtown [Wed, 29 Jul 2026 12:16:57 +0000 (05:16 -0700)]
sycl: contiguous fast path + 32-bit index math for unary elementwise ops (#25946)

* sycl: contiguous fast path + 32-bit index math for unary elementwise ops

* sycl: use fastdiv for elementwise index math

5 weeks agovendor: update BoringSSL to 0.20260728.0 (#26241)
Alessandro de Oliveira Faria (A.K.A.CABELO) [Wed, 29 Jul 2026 12:16:02 +0000 (09:16 -0300)]
vendor: update BoringSSL to 0.20260728.0 (#26241)

5 weeks agoserver : add trace logging for slot similarity checking (#26271)
Georgi Gerganov [Wed, 29 Jul 2026 11:59:44 +0000 (14:59 +0300)]
server : add trace logging for slot similarity checking (#26271)

Adds trace logging in server-context.cpp for slot similarity checking
during prompt cache slot selection, including skip reasons and similarity
calculation details.

Assisted-by: llama.cpp:Qwen3.6-27B
5 weeks agoconversion: fix Qwen2.5-Omni mmproj conversion regression (#26262)
Kaben Nanlohy [Wed, 29 Jul 2026 10:53:44 +0000 (04:53 -0600)]
conversion: fix Qwen2.5-Omni mmproj conversion regression (#26262)

6 weeks agoRPC: add tensor_memset (#25912)
Aman Gupta [Wed, 29 Jul 2026 07:04:30 +0000 (15:04 +0800)]
RPC: add tensor_memset (#25912)

6 weeks agoadd rdna3.5, and 3 to mmq configs so they can be tuned independently. (#26199)
Geramy Loveless [Wed, 29 Jul 2026 06:43:45 +0000 (23:43 -0700)]
add rdna3.5, and 3 to mmq configs so they can be tuned independently. (#26199)

6 weeks agomodel: add NextN/MTP speculative decoding support for GLM_DSA (GLM-5.2) (#25980)
Satinder Grewal [Wed, 29 Jul 2026 06:02:31 +0000 (18:02 +1200)]
model: add NextN/MTP speculative decoding support for GLM_DSA (GLM-5.2) (#25980)

* model: add NextN/MTP speculative decoding support for GLM_DSA (GLM-5.2)

Adds GLM-5.2 NextN/MTP as a --spec-type draft-mtp target: nextn tensor
loading via the qwen35moe/step35-style presence probe, a graph_mtp
builder (enorm/hnorm/eh_proj + dense MLA + sigmoid-gated MoE with
shared expert + shared head with fallbacks, _s scale tensors passed
for NVFP4), t_h_nextn extraction in the trunk graph, and MTP-context
KV setup: the draft head runs dense MLA, so the MTP context uses a
plain attention KV cache holding only the nextn layer(s) (same
pattern as the hybrid Qwen3.5 MTP context) while the main context
keeps the DSA cache, now filtered to trunk layers only.

Co-Authored-By: Claude Fable 5 <redacted>
* convert : support --mtp/--no-mtp export for GlmMoeDsaForCausalLM (GLM-5.2)

Opt GLM-5.2 into the supports_mtp_export contract (post-#25641 shape,
mirroring HYV3Model/Step35Model): --no-mtp drops the appended NextN
block (blk.78) and its nextn_predict_layers KV; --mtp keeps only the
NextN block plus shared embeddings/norm/lm_head. Default (bundled)
output is unchanged.

Co-Authored-By: Claude Fable 5 <redacted>
---------

Co-authored-by: Claude Fable 5 <redacted>
6 weeks agomodel: Add Laguna-S-2.1 LLM_TYPE (#26233)
Guido Imperiale [Tue, 28 Jul 2026 19:02:33 +0000 (20:02 +0100)]
model: Add Laguna-S-2.1 LLM_TYPE (#26233)

6 weeks agoggml-webgpu: Fix some binding alias issues to support all archs, fix recurrent-state...
Reese Levine [Tue, 28 Jul 2026 18:13:06 +0000 (11:13 -0700)]
ggml-webgpu: Fix some binding alias issues to support all archs, fix recurrent-state-rollback test (#25931)

* Add overlap glu variant to support all archs, fix recurrent-state-rollback test

* format

* Fix all arch overlapped ranges

* format

* diagnose bus error on apple ci

* More testing

* more testing

* more targeted testing

* Fix bug in alignment for > 4gb buffer offsets

* Fix bug in view offsets

* Try avoiding multi_buffers

* not fixed yet, more logging :(

* Handle edge case in set_rows

* Try looking at view source

* Skip deepseek32 for now and clean up trace infrastructure

* simplify skipping

* last cleanup

* actually final cleanup

* update handling of overlap

* format

* try skipping other failing model

6 weeks agoopencl: skip the Adreno KQ/KQV image kernels for multi-stream batches (#26189)
Hongqiang Wang [Tue, 28 Jul 2026 18:04:42 +0000 (11:04 -0700)]
opencl: skip the Adreno KQ/KQV image kernels for multi-stream batches (#26189)

The Adreno KQ/KQV image1d kernels (ggml_cl_mul_mat_kq_kqv_adreno) ignore
dim 3 entirely: the sub-buffer covers only nb02*ne02 bytes and the kernel
receives no ne03/ne13/nb03/nb13 arguments. With the unified KV cache,
multi-sequence batches (e.g. llama-perplexity with its default -b 2048,
n_seq=4, or a multi-slot llama-server) present KQ/KQV as 4D tensors with
ne3 = n_stream, so every stream past the first reads the first stream's
K/V and produces garbage. Flash attention masks the bug where it is
enabled; devices where FA is declined (e.g. Adreno 740) hit it with
default settings.

Route ne03/ne13 > 1 to the general path, which handles dim 3, and honor
view_offs when creating the sub-buffers (currently always 0 for tensors
reaching this function, but the function would silently misread any
future view).

Llama-3.2-1B-Instruct Q4_0, wiki.test.raw, 8 chunks, -ngl 99:
- Adreno 740, default:            PPL 1817.64 -> 15.61
- Adreno 740, -fa 0:              PPL 1941.64 -> 15.61
- Adreno 840, -fa 0:              PPL 1943.90 -> 15.50
- single-stream (-b 512) results unchanged (15.6090)
- test-backend-ops -o MUL_MAT on 740: identical before/after (909 OK,
  12 pre-existing q6_K failures)

6 weeks agomtmd : add Nemotron 3 Nano Omni support (parakeet) (#22520)
Daniel Bevenius [Tue, 28 Jul 2026 15:20:25 +0000 (17:20 +0200)]
mtmd : add Nemotron 3 Nano Omni support (parakeet) (#22520)

* mtmd : add Nemotron 3 Nano Omni support (parakeet)

This commit adds support for the subsampling and encoder part of
Nemotron Nemo 3 omni model.

The Parakeet subsampling/encoder were taken from parakeet.cpp which
is currently a pull request against whisper.cpp. I've tried to copy the
code a close as possible to hopefully enable easy patching between the
these two project later.

Refs: https://github.com/ggml-org/whisper.cpp/pull/3735

* mtmd : generate rel pos tensor in graph instead of in conversion [no ci]

This commit removes the generation of the relative positional tensor in
the model conversion script and instead computes it in the encoder
graph. This is only done for the window of positions required for the
current audio sample.

* mtmd : add clip_get_model to clip API [no ci]

This commit adds a function to get access to the clip_model. It also
removes the two functions clip_get_mel_filter_tensor, and
clip_get_window_tensor(const struct clip_ctx * ctx) which can now use
clip_get_model to access the model tensors that it needs.

* mtmd : read mel_filters and window into hparams

* mtmd : use set_input_f32 lambda [no ci]

* mtmd : add better asserts for mel_filters and hann window [no ci]

* mtmd : add missing size_t cast

* mtmd : change type of pad to size_t

* mtmd : zero initialize samples_padded

* mtmd : remove unsued ctx member from parakeet preprocessor

* mtmd : make log_mel_spectrogram_parakeet_worker_thread private static

* mtmd : sync/update parakeeet impl with latest whisper.cpp

This commit updates the parakeet code in mtmd to reflect the latest
updates to parakeet.cpp in whisper.cpp.

A follow up commit will address the currently hardcoded dw_pad and see
if we can add n_conv_kernel as a model metadata field.

* mtmd : add audio_conv_kernel_size to model conversion

This commit updates the model conversion to read the conv_kernel_size
field from the sound_config section of the models config.json file.
It then uses this field instead of the hardcoded values in parakeet.cpp.

* mtmd : cleanup [no ci]

* conversion : call super().filter_tensors [no ci]

* do not discard result of super filter_tensors

* mtmd : use build_mm instead of ggml_mul_mat

* mtmd : use build_ffn

* mtmd : move and reuse get_vector lambda

* mtmd : use build_inp_raw for parakeet

* mtmd : throw exception in get_scalar instead of assert

* mtmd : fix std::min call

* mtmt : use .c_str in throw clause in get_vector

* mtmd : check for F32 type and non-empty tensor in get_vector

The get_vector lambda is used by get_scalar but also standalone to read
in the mel_filters and the window data. Therefor we are not checking
for 1D tensors but allowing multiple dimensions. We do have a check in
get_scalar to verify the size of the vector.

* mtmd : replace hardcoded 1101 for n_tokens_real

* mtmd : assert subsampling_factor is 8

This commit adds an assert of the parakeet subsampling factor to check
that it is 8.

The motivation for this is that this model currently has three
convolutions with a stride of 2. If the underlying model updates the
subsampling factor these convolution operations will need to be updated
and this will produce and error if this occurs.

* mtmd : remove unused ggml_tensors attn_pos_w and mm_norm_w

* mtmd : remove single thread path

This commit removes the single thread path which was a left over from
the original parakeet.cpp where n_threads is configurable.

* fix some security issues

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
Co-authored-by: Xuan Son Nguyen <redacted>
6 weeks agoui: rendering performance follow-up (#26097)
Aleksander Grygier [Tue, 28 Jul 2026 15:13:25 +0000 (17:13 +0200)]
ui: rendering performance follow-up (#26097)

6 weeks agodocs: Adapt conda-forge package name (#26229)
Julien Jerphanion [Tue, 28 Jul 2026 14:51:20 +0000 (16:51 +0200)]
docs: Adapt conda-forge package name (#26229)

Co-authored-by: dev-tinker <redacted>
6 weeks agoserver: abstract llama_memory calls to common_memory (#26221)
Xuan-Son Nguyen [Tue, 28 Jul 2026 14:35:20 +0000 (16:35 +0200)]
server: abstract llama_memory calls to common_memory (#26221)

6 weeks agoggml : set output of view src (#25729)
Aman Gupta [Tue, 28 Jul 2026 13:23:24 +0000 (21:23 +0800)]
ggml : set output of view src (#25729)

* llama-graph: set_outputs to t->view_src

* change set_output to GGML_ASSERT about views not being outputs

* sampler : avoid views in outputs

* cont : fix dist sampler

* cont : consistent logits handling

* ggml : set output of view src

* graph : simplify set_outputs()

* cont : cleanup

Co-authored-by: Gaurav Garg <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Gaurav Garg <redacted>
6 weeks agovulkan: add iq4_nl support back to FA (#24585)
Jeff Bolz [Tue, 28 Jul 2026 12:06:03 +0000 (13:06 +0100)]
vulkan: add iq4_nl support back to FA (#24585)

* vulkan: add iq4_nl support back to FA

I was originally concerned about wasting shared memory on the LUT, but it's small
and unlikely to matter in practice.

Also support q1_0 for non-coopmat2.

Fixes #23681

* remove q1_0 FA support

6 weeks agoggml-cuda: add chunked SSD matmul for Mamba-2 prefill acceleration (#22675)
Bhavik Sharda [Tue, 28 Jul 2026 12:03:42 +0000 (17:33 +0530)]
ggml-cuda: add chunked SSD matmul for Mamba-2 prefill acceleration (#22675)

* ggml-cuda: add chunked SSD matmul for Mamba-2 prefill acceleration

* cuda: added SSD CICD fixes for CUDA / HIP / MUSA / MSVC.

* ggml-cuda: review comments fixed.

* ggml-cuda: Fuse M matrix materialization into pre_matmul kernel and enabled test.

* ggml-cuda: test updates and fixes

* ggml-cuda: test updates to remove hardcoding of tensor initialise data limits.

* ggml-cuda: ssd minor review comment fixed.

* ggml-cuda: ssd minor CICD fixed.

* CUDA SSD: Fixes correctness by promoting s0_stride_seq to int64_t, improves memory coalescing in ssm_ssd_prepare_dt_kernel, and boosts efficiency by merging B_weighted and C_scaled; also addresses prior review comments.

* cuda: fix sdata read-write race in prepare_dt fallback scan loop

6 weeks agospec: add DSpark speculative decoding (#25173)
王金旭 [Tue, 28 Jul 2026 11:43:27 +0000 (19:43 +0800)]
spec: add DSpark speculative decoding (#25173)

* spec: add DSpark speculative decoding

DSpark (DeepSpec, 2026) on top of the merged DFlash drafter. It reuses the
DFlash encoder/decoder graph, target feature extraction and KV-cache injection,
and the verify/accept path unchanged; the draft model is a new "dspark" arch
adding a low-rank Markov head (markov_w1/w2) and an optional (unused here)
confidence head. No new public APIs.

The proposal is the only change: the block is anchor-first (position 0 already
predicts the first draft) and the decoder graph applies a semi-autoregressive,
previous-token conditioned logit bias in-graph, chained per block position:

  logits'(i) = logits(i) + markov_w2 . markov_w1[prev(i)]
  prev(0)    = the block's anchor token, prev(i>0) = argmax(logits'(i-1))

vectorized across all blocks in the batch; the anchors are fed through a
dedicated graph input (token 0 of every block). Greedy stays lossless
(verify unchanged, same as DFlash).

- new arch "dspark" (llama_model_dspark : llama_model_dflash, reuses the graph,
  loads the markov/confidence tensors; shares the target's embed/lm_head).
- Qwen3DSparkModel converter.
- new spec type "draft-dspark" (common_speculative_impl_draft_dspark :
  common_speculative_impl_draft_dflash, overrides draft() only: submits whole
  anchor-first blocks and greedily reads back the biased logits).

* spec: read draft block size in the dflash impl

* docs: add DSpark section to speculative.md

* spec: keep dspark block size read in the dspark impl

* dspark : add TODOs for incomplete parts

- confidence head is loaded but not used yet
- confidence-scheduled prefix pruning is not implemented
- the in-graph Markov chain is greedy-only
- only Qwen3 backbones are supported for now (also noted in docs)

* spec: fold DSpark into the DFlash arch

Address review: drop LLM_ARCH_DSPARK and the dspark.block_size /
markov_rank GGUF keys. A DSpark draft now converts to a DFlash GGUF;
the Markov head tensors are detected by presence (like eagle3 d2t),
block_size is read from the existing dflash.block_size key, and the
block anchors are taken as a strided view of the decoder's token
input instead of a separate graph input.

* spec: add confidence-based draft pruning for DSpark

The DSpark confidence head predicts per-position acceptance of the
drafted block. --spec-draft-conf-min truncates the block at the first
position below the threshold (default 0 = disabled).

* fold the dspark impl into dflash, selected by spec type

* address review comments

* dspark: clean up and improve naming

* update readme

* remove trailing whitespace

* dflash: draft full n_max blocks, defer dp.n_max to the central truncation

The DSpark markov head views the draft batch as a uniform [n_seqs x block]
grid, but the per-seq dp.n_max clamp could produce blocks of different
sizes, silently corrupting the strided views and the resulting logits.

Drop the clamp and always draft the full n_max block for every sequence:
dp.n_max is already enforced by the central truncation in
common_speculative_draft(), the same way eagle3 handles it.

Co-authored-by: Zaire404 <redacted>
* dflash: assert the markov head block-uniformity invariant, require the conf head

With the draft batch always submitting equal-size n_max blocks, a
non-divisible token count can only mean the batch was split across
ubatches or a caller broke the layout - fail loudly instead of silently
dropping the markov bias. The block_drafts > block_size early return
stays: worst-case graph reserve passes legitimately build with
n_seq_tokens > block_size.

Also make conf_proj required when the markov head is present: the
confidence head is part of the DSpark checkpoint format, and a missing
head would otherwise leave --spec-draft-conf-min silently reading stale
embeddings instead of confidences.

Co-authored-by: Zaire404 <redacted>
* dspark: fold conf_min into p_min

p_min and conf_min express the same thing - the minimum predicted
survival probability for a drafted position - differing only in how the
estimate is obtained: token probability for regular drafters, the
trained confidence head for DSpark. The DSpark readback never used
p_min, so reuse it for the confidence threshold and drop the separate
--spec-draft-conf-min flag. Both defaulted to 0 (disabled), so behavior
is unchanged.

Co-authored-by: Zaire404 <redacted>
* dflash: note the confidence broadcast workaround

Requested in review: the ggml_repeat only adapts the [1, n_tok]
confidences to the n_embd-wide embd_nextn transport so that
llama_get_embeddings_nextn can be reused - not a placeholder.

Co-authored-by: Zaire404 <redacted>
* cont : clarify

[no ci]

---------

Co-authored-by: Ruixiang Wang <redacted>
Co-authored-by: Zaire404 <redacted>
Co-authored-by: Georgi Gerganov <redacted>
6 weeks agocommon/chat: add specialized minimax m3 parser (#26210)
Aldehir Rojas [Tue, 28 Jul 2026 09:27:20 +0000 (04:27 -0500)]
common/chat: add specialized minimax m3 parser (#26210)

6 weeks agosycl: fix use-after-return of the SDPA scale in the oneDNN flash-attention path ...
meatposes [Tue, 28 Jul 2026 08:37:25 +0000 (03:37 -0500)]
sycl: fix use-after-return of the SDPA scale in the oneDNN flash-attention path (#25880)

* sycl: fix use-after-return of the SDPA scale in the oneDNN flash-attention path

The scale was uploaded with an async memcpy sourced from a stack local. On the
in-order queue that copy is ordered behind the K/V staging kernels; once n_kv is
large enough (>= ~26k observed on Arc Pro B70) the staging outlives the host
stack frame and the copy reads recycled memory, feeding the SDPA a garbage scale.
Output then collapses to a single repeated token and the KV cache is poisoned
for the rest of the session.

Short contexts win the race by accident, and test-backend-ops caps
FLASH_ATTN_EXT at kv=1024, which is why CI never caught it. The previous
device_count > 1 wait_and_throw() gate (and reverting it, PR #25741) fixes the
symptom only by keeping the frame alive across the copy at the cost of a host
sync on every FA call.

Fix: cache one device scalar per (device, value) -- the scale is constant per
model -- and upload it synchronously once. The single-device fast path (no
per-call host sync) is then safe: every device-side hazard already serializes
on the in-order queue. The multi-GPU conservative wait is kept unchanged.

Also:
- GGML_SYCL_FA_ONEDNN_MAX_KV env (0 = unlimited): optional n_kv ceiling that
  routes very long sequences to the native FA kernel.
- test-backend-ops: FLASH_ATTN_EXT F16 cases up to kv=65536 (Qwen3.6-27B
  geometry hsk=hsv=256 GQA 6, and hsk=128 GQA 4), closing the kv=1024 blind
  spot. Note the race itself needs a live multi-op pipeline to reproduce;
  single-op runs pass even on broken builds.

Verified on Arc Pro B70 (bmg_g31), Qwen3.6-27B Q4_K, -c 131072: output
byte-identical at temp 0 to the native FA path through 32k-deep prefill, with
prefill depth-flat at 820-840 t/s (vs 340-350 native at 32k depth).

Assisted-by: Claude Fable 5
* sycl: handle GGML_SYCL_FA_ONEDNN_MAX_KV like the other runtime env vars and document it

Review feedback on #25880:
- read the variable once at backend init into g_ggml_sycl_fa_onednn_max_kv via
  ggml_sycl_get_env, and print it in the startup env listing (-lv 4 shows it)
- document GGML_SYCL_FA_ONEDNN and GGML_SYCL_FA_ONEDNN_MAX_KV in the SYCL.md
  runtime table

Also trim the added FLASH_ATTN_EXT cases to kv={4096,16384}: the 32768/65536
shapes exceed the legacy NMSE threshold on both the oneDNN and native kernels
(long-sequence fp16 accumulation drift, present before this PR) and would fail
CI for an unrelated reason.

Assisted-by: Claude Fable 5
* sycl: clarify GGML_SYCL_FA_ONEDNN_MAX_KV default is disabled

Assisted-by: Claude Fable 5
* sycl: state default behavior of GGML_SYCL_FA_ONEDNN_MAX_KV explicitly

Assisted-by: Claude Fable 5
* Update ggml/src/ggml-sycl/fattn-onednn.cpp

Co-authored-by: Neo Zhang <redacted>
* sycl: write the SDPA scale from a kernel instead of caching it

The per-(device, value) scale cache was a function-local static
unordered_map with no synchronization, so concurrent backend instances
could access and rehash it at the same time.

Write the scalar with a single_task instead. The value is captured into
the command, so no host memory has to outlive the call -- which is what
the use-after-return fix needed in the first place. That removes the
shared container, the leaked device allocation and the string key, and
it also closes the remaining async-memcpy-from-a-stack-local on the
first flash-attention call.

Ordering does not rely on timing: the queue is created with
sycl::property::queue::in_order and the dnnl stream wraps that same
queue, so the write completes before the SDPA reads the scalar. The
multi-GPU wait_and_throw() branch is unchanged.

Also drop the <cstdlib> include, which is unused.

Assisted-by: Claude Opus 5
---------

Co-authored-by: Neo Zhang <redacted>
6 weeks agoserver : add extra trace log for prompt similarity (#26218)
Georgi Gerganov [Tue, 28 Jul 2026 08:05:16 +0000 (11:05 +0300)]
server : add extra trace log for prompt similarity (#26218)

6 weeks agoggml-metal: FWHT kernel for metal backend (#25924)
Nick Lafleur [Tue, 28 Jul 2026 07:44:06 +0000 (03:44 -0400)]
ggml-metal: FWHT kernel for metal backend (#25924)

* metal fwht wip

* shape guard and formatting

* formatting

* Formatting and typos

Co-authored-by: YiChen Lv <redacted>
* fix narrowing issue

Co-authored-by: YiChen Lv <redacted>
* cont : minor style

---------

Co-authored-by: YiChen Lv <redacted>
Co-authored-by: Georgi Gerganov <redacted>
6 weeks agospec: add eagle3-v3 support for gpt-oss model (#25794)
Ruixiang Wang [Tue, 28 Jul 2026 06:58:16 +0000 (08:58 +0200)]
spec: add eagle3-v3 support for gpt-oss model (#25794)

6 weeks agocontrib : add guideline about the "merge ready" label (#26178)
Georgi Gerganov [Tue, 28 Jul 2026 05:41:04 +0000 (08:41 +0300)]
contrib : add guideline about the "merge ready" label (#26178)

* contrib : add guideline about the "merge ready" label

* cont : add ref

[no ci]

6 weeks agoDisable -ffast-math on HIP (#25495)
Beinsezii [Mon, 27 Jul 2026 23:13:48 +0000 (16:13 -0700)]
Disable -ffast-math on HIP (#25495)