]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
4 weeks agoissues: add openvino backends (#20932)
Aaron Teo [Tue, 24 Mar 2026 06:41:10 +0000 (14:41 +0800)]
issues: add openvino backends (#20932)

Signed-off-by: Aaron Teo <redacted>
4 weeks agocommon : add standard Hugging Face cache support (#20775)
Adrien Gallouët [Tue, 24 Mar 2026 06:30:33 +0000 (07:30 +0100)]
common : add standard Hugging Face cache support (#20775)

* common : add standard Hugging Face cache support

- Use HF API to find all files
- Migrate all manifests to hugging face cache at startup

Signed-off-by: Adrien Gallouët <redacted>
* Check with the quant tag

Signed-off-by: Adrien Gallouët <redacted>
* Cleanup

Signed-off-by: Adrien Gallouët <redacted>
* Improve error handling and report API errors

Signed-off-by: Adrien Gallouët <redacted>
* Restore common_cached_model_info and align mmproj filtering

Signed-off-by: Adrien Gallouët <redacted>
* Prefer main when getting cached ref

Signed-off-by: Adrien Gallouët <redacted>
* Use cached files when HF API fails

Signed-off-by: Adrien Gallouët <redacted>
* Use final_path..

Signed-off-by: Adrien Gallouët <redacted>
* Check all inputs

Signed-off-by: Adrien Gallouët <redacted>
---------

Signed-off-by: Adrien Gallouët <redacted>
4 weeks agollama-fit: fix regex pattern for gate_up tensors (#20910)
Aman Gupta [Tue, 24 Mar 2026 04:57:57 +0000 (12:57 +0800)]
llama-fit: fix regex pattern for gate_up tensors (#20910)

* llama-fit: fix regex pattern for gate_up tensors

* Apply suggestions from code review

Co-authored-by: Johannes Gäßler <redacted>
---------

Co-authored-by: Johannes Gäßler <redacted>
4 weeks agocommon : replace wrap_for_generation with a prefix convenience function and fix gpt...
Aldehir Rojas [Tue, 24 Mar 2026 03:21:47 +0000 (22:21 -0500)]
common : replace wrap_for_generation with a prefix convenience function and fix gpt-oss (#20912)

4 weeks agohexagon: general DMA and Binary Op fixes for large strides (#20918)
Max Krasnyansky [Mon, 23 Mar 2026 22:33:49 +0000 (15:33 -0700)]
hexagon: general DMA and Binary Op fixes for large strides (#20918)

* hex-dma: make chained dma the default to handle newer models

This also includes some new instrumentation that we can remove later.

* hexagon: add uint32 dump helper

* hexagon: use single-page VTCM allocation to avoid issues with large gather ops in ssm-conv

ssm-conv uses HVX gather instruction and that instruction cannot handle cases where the base+offset
spans page boundaries.

* hexagon: update ssm-conv to make base-addr compute a bit easier to read

* hex-dma: use 1d mode for reshaping, it supports sizes up to 24-bits (>16MB)

* hex-bin: fix incorrect stride logic

* hexagon: make sure repack buffs are dumped for verbose > 2

* hex-bin: consistently use dma_queue_push even for dummy dst transactions

* hex-dma: start using 2d-wide mode on v75 and up

The removes the need to deal with the 16-bit limitaion for the strides.

* hex-bin: cleanup kernel selection logic

* hex-bin: cleanup binary op core and fix transposed tensor handling

* snapdragon: update run-bench to use larger ubatch and fa-on

4 weeks agoAdd codeowners for scripts/snapdragon and docs/snapdragon (#20915)
Max Krasnyansky [Mon, 23 Mar 2026 21:57:18 +0000 (14:57 -0700)]
Add codeowners for scripts/snapdragon and docs/snapdragon (#20915)

* Add codeowners for scripts/snapdragon

* Also add docs/backends/snapdragon

4 weeks agoopencl: add q6_K gemm and gemv kernels for Adreno (#20089)
lhez [Mon, 23 Mar 2026 19:44:18 +0000 (12:44 -0700)]
opencl: add q6_K gemm and gemv kernels for Adreno (#20089)

* opencl: add q6_K noshuffle kernels, initial q6_K gemv, some host code

* opencl: add q6_K transpose

* opencl: fix cvt kernel name

* opencl: add call to q6_K gemv

* opencl: fix q6_K scale transpose

* opencl: fix loading for gemv q6_K, refactor

* opencl: fix transpose_8_buf kernel assignment, refactor

* opencl: refactor q6_K transpose

* opencl: add gemm_noshuffle_q6_k_f32

* opencl: fix qh loading

* opencl: refactor q6_K gemv host side, release bufs and imgs

* opencl: refactor

* opencl: fix q6_K dequant and scale selection

* opencl: workaround compiler bug, fix dump_tensor

* opencl: refactor q6_K convert kernels

* opencl: unpack transformed q6_K in get_tensor

* opencl: refactor, handle non-uniform workgroups

* opencl: support non-vector subgroup bcast

4 weeks agorpc : RCE patch (#20908)
las7 [Mon, 23 Mar 2026 17:54:57 +0000 (10:54 -0700)]
rpc : RCE patch (#20908)

4 weeks agocontrib: add "Requirements" section to PR template (#20841)
Xuan-Son Nguyen [Mon, 23 Mar 2026 15:59:02 +0000 (16:59 +0100)]
contrib: add "Requirements" section to PR template (#20841)

* contrib: add "Requirements" section to PR template

* typo [no ci]

* use h2, add "Additional information"

---------

Co-authored-by: Piotr Wilkin (ilintar) <redacted>
4 weeks agodevops: upgraded default oneAPI version (#20731)
Davi Henrique Linhares [Mon, 23 Mar 2026 13:47:34 +0000 (10:47 -0300)]
devops: upgraded default oneAPI version (#20731)

4 weeks agowebui: Improve chat form positioning (#20901)
Aleksander Grygier [Mon, 23 Mar 2026 13:30:55 +0000 (14:30 +0100)]
webui: Improve chat form positioning (#20901)

4 weeks agodocs: Fix typo in reasoning flag documentation (#20780)
Geo Maciolek [Mon, 23 Mar 2026 13:24:55 +0000 (09:24 -0400)]
docs: Fix typo in reasoning flag documentation (#20780)

Tested to verify - the typo is just in the docs, not the actual flag.

4 weeks agomemory : fix seq_id bounds in llama_memory_recurrent::state_read_meta() (#20887)
Georgi Gerganov [Mon, 23 Mar 2026 12:08:46 +0000 (14:08 +0200)]
memory : fix seq_id bounds in llama_memory_recurrent::state_read_meta() (#20887)

4 weeks agodocs : rerun llama-gen-docs to include new CLI args (#20892)
Eric Zhang [Mon, 23 Mar 2026 11:33:38 +0000 (19:33 +0800)]
docs : rerun llama-gen-docs to include new CLI args (#20892)

4 weeks agoserver: use httplib dynamic threads (#20817)
Xuan-Son Nguyen [Mon, 23 Mar 2026 11:22:46 +0000 (12:22 +0100)]
server: use httplib dynamic threads (#20817)

* server: use httplib dynamic threads

* change to n_threads_http + 1024

4 weeks agoai : update gh permissions (#20895)
Georgi Gerganov [Mon, 23 Mar 2026 11:21:41 +0000 (13:21 +0200)]
ai : update gh permissions (#20895)

4 weeks agowebui: fix --webui-config-file settings not applied on load (#20823)
Pascal [Mon, 23 Mar 2026 10:25:35 +0000 (11:25 +0100)]
webui: fix --webui-config-file settings not applied on load (#20823)

* webui: fix --webui-config-file settings not applied on load

* chore: update webui build output

4 weeks agometal: add CONV_3D (#19927)
Rashid Ul Islam [Mon, 23 Mar 2026 07:45:34 +0000 (13:15 +0530)]
metal: add CONV_3D  (#19927)

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <redacted>
* metal:add conv_3d backend

Rebased with master and resolved conflicts.

* Resolved issues related to changes in variable names

* kernel void kernel_upscale_bilinear_f32 was missing in my branch, added back, should pass all tests now

---------

Co-authored-by: Georgi Gerganov <redacted>
4 weeks agocommon/autoparser : detect reasoning markers when enable_thinking changes system...
Jhen-Jie Hong [Mon, 23 Mar 2026 07:35:27 +0000 (15:35 +0800)]
common/autoparser : detect reasoning markers when enable_thinking changes system prompt (#20859)

4 weeks agoCANN: add RoPE cache preload before ACL graph capture (#20747)
Chenguang Li [Mon, 23 Mar 2026 07:24:06 +0000 (15:24 +0800)]
CANN: add RoPE cache preload before ACL graph capture (#20747)

ACL graph capture disallows host-to-device memcpy and device memory
malloc/free on the captured stream. Pre-load the RoPE cache before
capture so that:
- Host-to-device copies and allocations run on the non-captured stream
- Cache metadata is populated and memory pool is warmed up
- During capture, only on-device computations are recorded; host-side
  and allocation branches are skipped

4 weeks agofix(openvino): explicit memset in buffer_context allocation (#20857)
Dan Hoffman [Mon, 23 Mar 2026 06:05:37 +0000 (23:05 -0700)]
fix(openvino): explicit memset in buffer_context allocation (#20857)

* fix(openvino): explicit memset in buffer_context allocation

* minor

---------

Co-authored-by: Dan Hoffman <redacted>
Co-authored-by: Georgi Gerganov <redacted>
4 weeks agoopencl: add flattened Q4_K mv and general Q4_K mm (#20773)
shaofeiqi [Mon, 23 Mar 2026 05:45:11 +0000 (22:45 -0700)]
opencl: add flattened Q4_K mv and general Q4_K mm (#20773)

4 weeks agomtmd: Add dynamic high-resolution image preprocessing for InternVL model (#20847)
bssrdf [Mon, 23 Mar 2026 00:06:30 +0000 (20:06 -0400)]
mtmd: Add dynamic high-resolution image preprocessing for InternVL model (#20847)

* added support for internvl's dynamic high-resolution (Qianfan-OCR needed)

* add min/max dynamic patch to gguf meta

* clean up

* simplified handling min/max dynamic patch

* reuse llava_uhd logic for slice images

* provide default values for older models

* flake8

* prevent writing 0 value to gguf

* remove duplicated resolution candidates with a better algorithm

* fix indentation

* format

* add protection from divide by zero

* change to 0 to be safe

---------

Co-authored-by: Xuan Son Nguyen <redacted>
4 weeks agomtmd : fix LightOnOCR image preprocessing (#20877)
DorianRudolph [Mon, 23 Mar 2026 00:04:14 +0000 (01:04 +0100)]
mtmd : fix LightOnOCR image preprocessing (#20877)

4 weeks agoserver: allow router to report child instances sleep status (#20849)
Xuan-Son Nguyen [Sun, 22 Mar 2026 17:33:52 +0000 (18:33 +0100)]
server: allow router to report child instances sleep status (#20849)

* server: allow router to report child instances sleep status

* refactor

* move sleeping to state

* nits

5 weeks agoCUDA: fix BF16 FA compilation (#20865)
Johannes Gäßler [Sun, 22 Mar 2026 16:53:33 +0000 (17:53 +0100)]
CUDA: fix BF16 FA compilation (#20865)

5 weeks agojinja : refactor token advancement (#20864)
Sigbjørn Skjæret [Sun, 22 Mar 2026 16:45:10 +0000 (17:45 +0100)]
jinja : refactor token advancement (#20864)

* refactor token advancement

* exercise sub-expressions

5 weeks agoserver: fix Host header (#20843)
Evgeny Kurnevsky [Sun, 22 Mar 2026 14:29:22 +0000 (15:29 +0100)]
server: fix Host header (#20843)

It should include port when it's not default.

5 weeks agosupport bf16 and quantized type (#20803)
Neo Zhang [Sun, 22 Mar 2026 14:06:27 +0000 (22:06 +0800)]
support bf16 and quantized type (#20803)

5 weeks agoggml-cuda: native bf16 flash attention for vec kernel (#20525)
Patrick Buckley [Sun, 22 Mar 2026 10:05:51 +0000 (03:05 -0700)]
ggml-cuda: native bf16 flash attention for vec kernel (#20525)

* ggml-cuda: native bf16 flash attention for vec and tile kernels

mma kernel still converts bf16 to fp16 before launch, native mma bf16 todo

* ggml-cuda: address code owner review feedback

reverted tile kernel changes to avoid larger refactor

* fix ci failures on turing and hip

* fix bf16 vec kernel compile on hip v_dot2 platforms

* add comments

---------

Co-authored-by: Johannes Gäßler <redacted>
5 weeks ago[CUDA] Increase number of output elements per-thread block if the K-dimension is...
Gaurav Garg [Sun, 22 Mar 2026 08:49:35 +0000 (14:19 +0530)]
[CUDA] Increase number of output elements per-thread block if the K-dimension is small (#20635)

* Increase per-thread work if the K-dimension is small

With tensor parallelism, the K-dimension of the FFN-down matrices is split, which makes it quite small, especially for MOEs. For example, Qwen3-30b-A3B has a K-dimension of 768, and Qwen3235B-A22B has k-dimension of 1536.
The current heuristic uses a group of 4 warps irrespective of K-dimension size, resulting in some of the threads being idle. This results in poor performance for these matrices.

This change increases the number of output elements per block for such cases.

* Limit this change to ncols_dst = 1

* tab to space

5 weeks agomisc : prefer ggml-org models in docs and examples (#20827)
ddh0 [Sat, 21 Mar 2026 21:00:26 +0000 (16:00 -0500)]
misc : prefer ggml-org models in docs and examples (#20827)

* misc : prefer ggml-org models in docs and examples

Prefer referring to known-good quantizations under ggml-org rather than
3rd-party uploaders.

* remove accidentally committed file

5 weeks agocommon/grammar: fix grammar parsing issues to prevent stack overflow and hangs (...
Andrea Arcangeli [Sat, 21 Mar 2026 17:43:35 +0000 (13:43 -0400)]
common/grammar: fix grammar parsing issues to prevent stack overflow and hangs (#18604)

* grammar: add test case for nullable symbol loop

Reproduce stack overflow (or OOM) with ( [x]* )* found while adding
GBNF support to ripgrep-edit.

llama-server reproducer:

curl \
  -X POST \
  -d '{
    "messages": [{ "role": "user", "content": "write yes" }],
    "grammar": "root ::= ( [x]* )*"
  }' \
  -H "Content-Type: application/json" \
  http://localhost:8811/v1/chat/completions

* grammar: prevent stack overflow with nullable symbol loop

Fix a potential stack overflow in llama_grammar_advance_stack that
could occur when processing grammars with nullable symbols that lead
to infinite derivations of empty strings. The fix introduces cycle
detection by tracking visited stacks to prevent infinite recursion.

rg-edit regexp: llama_grammar_advance_stack
rg-edit extra-args: -A20
rg-edit directive: """Rewrite: fix the following segfault:

[..]
⚫ Testing segfault. Grammar:
            root ::= ( [x]* )*

            root ::= ( [x]* )*

Segmentation fault         build/bin/test-grammar-integration"""

gptel-context:
(("~/llama.cpp/src/llama-grammar.cpp")
 ("~/llama.cpp/tests/test-grammar-integration.cpp")
 ("~/llama.cpp/grammars/./list.gbnf")
 ("~/llama.cpp/grammars/./json_arr.gbnf")
 ("~/llama.cpp/grammars/./json.gbnf")
 ("~/llama.cpp/grammars/./japanese.gbnf")
 ("~/llama.cpp/grammars/./english.gbnf")
 ("~/llama.cpp/grammars/./chess.gbnf")
 ("~/llama.cpp/grammars/./c.gbnf")
 ("~/llama.cpp/grammars/./arithmetic.gbnf")
 ("~/llama.cpp/grammars/./README.md"))

* grammar: convert recursive llama_grammar_advance_stack to iterative

This change converts the function to an iterative approach using
explicit stacks, which prevents deep recursion and eliminates the risk
of stack overflow.

rg-edit regexp: llama_grammar_advance_stack
rg-edit extra-args: -A30
rg-edit directive: """Rewrite: fix the following segfault:

[..]
⚫ Testing segfault. Grammar:
            root ::= ( [x]* )*

            root ::= ( [x]* )*

Segmentation fault         build/bin/test-grammar-integration

convert from recursive to interactive"""

gptel-context:
(("~/llama.cpp/src/llama-grammar.cpp")
 ("~/llama.cpp/tests/test-grammar-integration.cpp")
 ("~/llama.cpp/grammars/./list.gbnf")
 ("~/llama.cpp/grammars/./json_arr.gbnf")
 ("~/llama.cpp/grammars/./json.gbnf")
 ("~/llama.cpp/grammars/./japanese.gbnf")
 ("~/llama.cpp/grammars/./english.gbnf")
 ("~/llama.cpp/grammars/./chess.gbnf")
 ("~/llama.cpp/grammars/./c.gbnf")
 ("~/llama.cpp/grammars/./arithmetic.gbnf")
 ("~/llama.cpp/grammars/./README.md"))

v2: Added a `std::set` to perform tree-based lookups with O(N log N)
complexity. Testing with a parallel run of `test-grammar-integration`
shows a double-digit percentage increase in runtime. An
`unordered_set` with O(1) hashing was also evaluated, but the overhead
of constructing hash keys from pointers made it significantly slower
than the rbtree implementation that only requires an ordering
operator. The performance regression in the test suite appears
justified by the overall reduction in algorithmic complexity.

Co-developed-by: Piotr Wilkin (ilintar) <redacted>
* grammar: add test case for hang in repetition grammar processing

This commit adds a new test case to the grammar integration tests that
specifically targets a hang scenario in the repetition grammar parser
found while adding GBNF support to ripgrep-edit.

llama-server reproducer:

curl \
  -X POST \
  -d '{
    "messages": [{ "role": "user", "content": "write yes" }],
    "grammar": "root ::= (([^x]*){0,99}){0,99}"
  }' \
  -H "Content-Type: application/json" \
  http://localhost:8811/v1/chat/completions

* grammar: add repetition threshold check

The change introduces a maximum repetition threshold to avoid
excessive rule expansion during grammar parsing. When parsing
repetition patterns like {m,n}, the parser now calculates the
potential number of rules that would be generated and throws an error
if the product of previous rules and new rules exceeds the threshold.

A test case was added to verify the threshold is properly enforced for
deeply nested repetition patterns that would otherwise cause hangs.

5 weeks agocontext : use n_embd_out for pooled embedding extraction (#20840)
Tom Hillbrunner [Sat, 21 Mar 2026 17:35:00 +0000 (18:35 +0100)]
context : use n_embd_out for pooled embedding extraction (#20840)

The MEAN/CLS/LAST pooling paths in encode() and decode() used
n_embd_inp() (16384 for qwen3vl with deepstack) to read from the
pooled embedding tensor, which only has n_embd_out() (4096) floats
per sequence. This caused a tensor read out of bounds assertion.

Fixes embedding mode for Qwen3-VL-Embedding models.

5 weeks agodocs : explicit about banning accounts that violates policy (#19593)
Xuan-Son Nguyen [Sat, 21 Mar 2026 14:50:16 +0000 (15:50 +0100)]
docs : explicit about banning accounts that violates policy (#19593)

5 weeks agofix(rpc): prevent division by zero in deserialize_tensor (#20712)
y198 [Sat, 21 Mar 2026 13:59:43 +0000 (20:59 +0700)]
fix(rpc): prevent division by zero in deserialize_tensor (#20712)

rpc : prevent division by zero in deserialize_tensor

When receiving an RPC message with a deprecated tensor type (e.g., type 4 or 5 where `blck_size == 0`), `ggml_row_size()` will trigger a division by zero (SIGFPE) and crash the rpc-server.

This patch adds a simple validation check in `deserialize_tensor` to return `nullptr` if the requested tensor type has a block size of 0.

(Note: This was originally reported via Security Advisory and maintainer suggested dropping a patch here).

* style: remove trailing whitespace

5 weeks agoConvert: Make NVFP4 and MXFP4 HF conversions say NVFP4/MXFP4 instead of BF16 (#20730)
Michael Wand [Sat, 21 Mar 2026 11:35:21 +0000 (04:35 -0700)]
Convert: Make NVFP4 and MXFP4 HF conversions say NVFP4/MXFP4 instead of BF16 (#20730)

* Corrected convert script for NVFP4 naming and updated gguf constants

* Add mostly_MXFP4 to FileType

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update convert_hf_to_gguf.py

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

* set initial value [no ci]

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agoci : switch from pyright to ty (#20826)
Sigbjørn Skjæret [Sat, 21 Mar 2026 07:54:34 +0000 (08:54 +0100)]
ci : switch from pyright to ty (#20826)

* type fixes

* switch to ty

* tweak rules

* tweak more rules

* more tweaks

* final tweak

* use common import-not-found rule

5 weeks agoAdd shader count for Intel Arc Pro B60 (#20818)
Matt Corallo [Sat, 21 Mar 2026 04:22:51 +0000 (04:22 +0000)]
Add shader count for Intel Arc Pro B60 (#20818)

5 weeks agocommon/parser: fix nasty bug causing subtle corruption of generation prompt (#20825)
Piotr Wilkin (ilintar) [Fri, 20 Mar 2026 23:19:04 +0000 (00:19 +0100)]
common/parser: fix nasty bug causing subtle corruption of generation prompt (#20825)

5 weeks agoggml-cpu: add always_inline to tinyBLAS_PPC accumulator saves (#20791)
shalinib-ibm [Fri, 20 Mar 2026 23:11:45 +0000 (04:41 +0530)]
ggml-cpu: add always_inline to tinyBLAS_PPC accumulator saves (#20791)

Explicitly mark save_acc and add_save_Acc with always_inline
in tinyBLAS_PPC. This ensures the compiler keeps MMA accumulator
disassembly within kernel's register context, preventing un-necessary
stask spills.

Signed-off-by: Shalini Salomi Bodapati <redacted>
5 weeks agoai : limit runtime of the agent (#20816)
Georgi Gerganov [Fri, 20 Mar 2026 18:31:25 +0000 (20:31 +0200)]
ai : limit runtime of the agent (#20816)

5 weeks agocommon : fix typo in debug log ('extracft' -> 'extract') (#20807)
James O'Leary [Fri, 20 Mar 2026 17:23:18 +0000 (10:23 -0700)]
common : fix typo in debug log ('extracft' -> 'extract') (#20807)

5 weeks agoai : do not run bash commands in the prompt (#20810)
Georgi Gerganov [Fri, 20 Mar 2026 17:06:33 +0000 (19:06 +0200)]
ai : do not run bash commands in the prompt (#20810)

5 weeks agomodel : fix Granite Hybrid type check for 7B.A1B (#20795)
Victor Villar [Fri, 20 Mar 2026 14:16:09 +0000 (15:16 +0100)]
model : fix Granite Hybrid type check for 7B.A1B (#20795)

* Check granite hybriid expert count to set type as LLM_TYPE_7B_A1B or LLM_TYPE_1B

* Use feed fwd dim instead of num of experts

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

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agoserver: (doc) clarify in-scope and out-scope features (#20794)
Xuan-Son Nguyen [Fri, 20 Mar 2026 13:03:50 +0000 (14:03 +0100)]
server: (doc) clarify in-scope and out-scope features (#20794)

* server: (doc) clarify in-scope and out-scope features

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agovulkan: change gated_delta_net to shard a column across a subgroup (#20662)
Jeff Bolz [Fri, 20 Mar 2026 11:17:15 +0000 (06:17 -0500)]
vulkan: change gated_delta_net to shard a column across a subgroup (#20662)

* vulkan: change gated_delta_net to shard a column across a subgroup

This is based on https://github.com/ggml-org/llama.cpp/pull/20391, I used an
LLM to port the CUDA code to Vulkan, and guided to it to make various fixes to
work with Vulkan (e.g. handling different subgroup sizes, unknown mapping of
subgroup to invocation id, using subgroupAdd optionally, etc.).

This fixes a perf regression from the transposing of the values in memory
(!20443).

* vulkan: Spread columns across fewer lanes to reduce the number of workgroups

5 weeks agocontext: zero output buffer on allocation (#20781)
Ruikai Peng [Fri, 20 Mar 2026 09:31:34 +0000 (17:31 +0800)]
context: zero output buffer on allocation (#20781)

* context: zero output buffer on allocation

Address GHSA-wqq9-25mr-rw76.

The logits output buffer allocated in output_reserve() uses
posix_memalign(), which does not zero memory. The buffer is only
written during decode when needs_raw_logits() returns true. When
backend samplers cover all output sequences, needs_raw_logits()
returns false and the buffer is never written, but
llama_get_logits() still returns a pointer to it, exposing stale
heap content.

Zero the buffer after allocation to prevent information disclosure
through the public logits API.

Found-by: Pwno
* Update src/llama-context.cpp

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agomodel: assert nextn_predict_layers to prevent underflow (#20783)
Ruikai Peng [Fri, 20 Mar 2026 09:17:58 +0000 (17:17 +0800)]
model: assert nextn_predict_layers to prevent underflow (#20783)

Address GHSA-645x-v54x-34w8.

When nextn_predict_layers >= n_layer, n_layer - nextn_predict_layers
can underflow (unsigned wrap), which corrupts n_layer_kv_from_start.

Assert nextn_predict_layers immediately after parsing the GGUF key.

Found-by: Pwno
5 weeks agoserver : improve mtmd ctx checkpoints (#20726)
Georgi Gerganov [Fri, 20 Mar 2026 09:13:12 +0000 (11:13 +0200)]
server : improve mtmd ctx checkpoints (#20726)

* server : improve mtmd ctx checkpoints

* server : fix off-by-one in pos_min_thold

5 weeks agoCANN: add BF16 support for core operators (#20152)
hipudding [Fri, 20 Mar 2026 09:08:39 +0000 (17:08 +0800)]
CANN: add BF16 support for core operators (#20152)

* CANN: add BF16 support for core operators

Add BF16 (bfloat16) type support to the CANN backend for the following
operators: MUL_MAT, MUL_MAT_ID, GET_ROWS, SET_ROWS, CPY, CONT, and
OUT_PROD. This enables BF16 models to run on Ascend NPUs.

* CANN: skip NZ weight format for BF16 and add 310P compile guards

NZ weight format conversion does not support BF16 tensors, skip it
in set_tensor, get_alloc_size and mul_mat. Remove BF16 from MUL_MAT_ID
and OUT_PROD as there are no BF16 use cases. Add #ifndef ASCEND_310P
guards for all BF16 operator support since 310P does not support BF16.

5 weeks agodocs : fix Metal backend op support status in ops.md (#20779)
Seyoung Jeong [Fri, 20 Mar 2026 09:06:38 +0000 (03:06 -0600)]
docs : fix Metal backend op support status in ops.md (#20779)

Regenerate docs/ops/Metal.csv using test-backend-ops on Apple M5
and rebuild docs/ops.md via scripts/create_ops_docs.py.

Five ops were incorrectly marked as not supported (❌) for Metal:
- DIAG:           ❌ → ✅
- POOL_1D:        ❌ → ✅
- SET:            ❌ → ✅
- SOLVE_TRI:      ❌ → ✅
- GATED_DELTA_NET:❌ → 🟡 (partial, depends on head_size % 32)

5 weeks agoai : update find-related action (#20790)
Georgi Gerganov [Fri, 20 Mar 2026 08:28:14 +0000 (10:28 +0200)]
ai : update find-related action (#20790)

* ai : update "related issues" prompt

* cont

* cont

* cont

5 weeks agojinja : fix heap OOB read in value equality comparison (#20782)
Ruikai Peng [Fri, 20 Mar 2026 06:15:17 +0000 (14:15 +0800)]
jinja : fix heap OOB read in value equality comparison (#20782)

Address GHSA-q9j6-4hhc-rq9p and GHSA-2q4c-9gq5-5vfp.

The three-iterator overload of std::equal in value_array_t::equivalent()
and value_object_t::equivalent() reads past the end of the shorter
container when comparing arrays or objects of different lengths.

Use the four-iterator overload (C++14) which checks both range lengths.

Found-by: Pwno
5 weeks agocommon/parser : fix out_of_range crash in throw path (#20424 regression) (#20777)
James O'Leary [Fri, 20 Mar 2026 01:37:22 +0000 (18:37 -0700)]
common/parser : fix out_of_range crash in throw path (#20424 regression) (#20777)

* chat : fix out_of_range crash in throw path (#20424 regression)

#20424 introduced effective_input = generation_prompt + input, but the
throw path uses input.substr(result.end) where result.end is a position
within effective_input. Every thinking model with a non-empty
generation_prompt crashes with std::out_of_range instead of the intended
error message.

Test crashes on unpatched master, passes with fix:

  cmake -B build -DLLAMA_BUILD_TESTS=ON -DLLAMA_BUILD_TOOLS=OFF
  cmake --build build --target test-chat
  ./build/bin/test-chat

* Update test-chat.cpp

* Update test-chat.cpp

* Update test-chat.cpp

---------

Co-authored-by: Piotr Wilkin (ilintar) <redacted>
5 weeks agoserver: fix router mode deadlock on child crash and TOCTOU race in models_max (#20763)
Ben Racicot [Thu, 19 Mar 2026 21:16:05 +0000 (17:16 -0400)]
server: fix router mode deadlock on child crash and TOCTOU race in models_max (#20763)

Two bugs in `server_models::load()` that affect router mode reliability:

**Bug 1: Deadlock when child process crashes**

When a child process is killed (e.g., SIGKILL from OS code signature
validation), the monitoring thread deadlocks on `stopping_thread.join()`
because the stopping_thread's wait predicate (`is_stopping`) is never
satisfied — the model name was never inserted into `stopping_models`.
`update_status()` is never reached and the model stays stuck in LOADING
state permanently.

Fix: extend the stopping_thread's wait predicate to also wake when the
child process is no longer alive (`!subprocess_alive()`). When woken by
a dead child, the thread skips the shutdown sequence and returns
immediately. The original `stopping_models.erase()` logic is preserved
for normal unloads.

**Bug 2: TOCTOU race bypasses `--models-max` (ref #20137)**

`unload_lru()` is called outside the mutex, then `load()` acquires the
lock afterward. Under concurrent requests, multiple threads observe
capacity and all proceed to load, exceeding the limit.

Fix: re-check capacity under the lock after `unload_lru()` returns.
If another thread filled the slot in the window between `unload_lru()`
and the lock acquisition, reject with an error instead of silently
exceeding the limit.

5 weeks agodocs: Update server README to reflect PR #20297 (#20560)
Tomeamis [Thu, 19 Mar 2026 20:28:44 +0000 (21:28 +0100)]
docs: Update server README to reflect PR #20297 (#20560)

5 weeks agoggml: guard KleidiAI DOWNLOAD_EXTRACT_TIMESTAMP for cmake < 3.24 (#20767)
Sundaram krishnan [Thu, 19 Mar 2026 19:36:23 +0000 (01:06 +0530)]
ggml: guard KleidiAI DOWNLOAD_EXTRACT_TIMESTAMP for cmake < 3.24 (#20767)

5 weeks agoci : improve action for duplicate issue (#20772)
Georgi Gerganov [Thu, 19 Mar 2026 19:11:53 +0000 (21:11 +0200)]
ci : improve action for duplicate issue (#20772)

* ci : show thinking traces of the agent

* cont : increase thinking

* cont : remove agent files

* cont : move the model selection to the provider

5 weeks agohip: Avoid compiler bug in RDNA code generation during debug builds on Windows (...
Rail Chabdarov [Thu, 19 Mar 2026 18:14:08 +0000 (19:14 +0100)]
hip: Avoid compiler bug in RDNA code generation during debug builds on Windows (#20655)

5 weeks agoserver: Add cached_tokens info to oaicompat responses (#19361)
Ryan Goulden [Thu, 19 Mar 2026 18:09:33 +0000 (11:09 -0700)]
server: Add cached_tokens info to oaicompat responses (#19361)

* tests : fix fetch_server_test_models.py

* server: to_json_oaicompat cached_tokens

Adds OpenAI and Anthropic compatible information about the
number of cached prompt tokens used in a response.

5 weeks agochat : handle tool calls with no required args in TAG_WITH_TAGGED format (#20764)
James O'Leary [Thu, 19 Mar 2026 16:53:11 +0000 (09:53 -0700)]
chat : handle tool calls with no required args in TAG_WITH_TAGGED format (#20764)

* chat : handle tool calls with no required args in TAG_WITH_TAGGED format

* Update tests/test-chat.cpp [no ci]

Co-authored-by: Aldehir Rojas <redacted>
---------

Co-authored-by: Piotr Wilkin (ilintar) <redacted>
Co-authored-by: Aldehir Rojas <redacted>
5 weeks agoci : clarify gh command for viewing issues (#20766)
Georgi Gerganov [Thu, 19 Mar 2026 16:43:54 +0000 (18:43 +0200)]
ci : clarify gh command for viewing issues (#20766)

5 weeks agohexagon: add Matrix Extensions (HMX) for Hexagon NPU backend (#20693)
Yiwei Shao [Thu, 19 Mar 2026 16:11:06 +0000 (09:11 -0700)]
hexagon: add Matrix Extensions (HMX) for Hexagon NPU backend (#20693)

* migrate(vtcm): unify VTCM management for HMX merge

- Add HMX fields to htp_context (#ifdef HTP_HAS_HMX): hmx_enabled,
  hmx_dma, vtcm_scratch_size, exp2_table
- Add HTP_VTCM_SESSION_HOLD CMake option (default ON): hold VTCM for
  entire session instead of per-op acquire/release
- Add vtcm_op_acquire/vtcm_op_release inline wrappers: no-op in
  session-hold mode, delegate in per-op mode
- Add VTCM tail reservation for precompute tables (256KB, 64KB aligned)
  in htp_iface_start under HTP_HAS_HMX
- Add HMX init/cleanup hooks in htp_iface_start/stop
- Add precompute table recovery in vtcm_acquire after VTCM preemption
- Do NOT migrate vtcm_mgr from htp-ops-lib (replaced by tail reservation)

* migrate(repack): replace x4x2 with HMX tile-permuted super-block format

- Add hmx_block_q4_0/q8_0 struct definitions (scales-first + sequential quants)
- Implement forward repack: repack_q4_0_to_hmx_superblock, repack_q8_0_to_hmx_superblock, repack_f16_to_tile_permuted
- Implement inverse repack for get_tensor debug verification
- Route set_tensor/get_tensor via opt_arch >= 73 to HMX path, else existing HVX x4x2
- MXFP4 on v73+ falls back to HVX x4x2 repack (not memcpy)
- Extend supports_op: add IQ4_NL for v73+, F16 tile alignment checks
- Tail blocks (K not multiple of 256): repack to x4x2 via pad-repack-truncate
- Add CMake GGML_HEXAGON_HMX_TAIL_HVX option (default ON); OFF rejects non-256-aligned K in supports_op

* migrate(dma): add dma_queue_push_1d() convenience wrapper for HMX ops

Add 1D linear DMA transfer helper to hex-dma.h for upcoming HMX op
migration. Reuses existing dma_queue_flush() for sync points instead
of adding redundant dma_queue_drain().

* migrate(hmx): reorganize HMX files into htp/hmx/ and simplify HMX locking

Move all 14 HMX-related files from htp/ to htp/hmx/ subdirectory for
cleaner separation between HVX and HMX code. Simplify HMX hardware
locking by replacing the two-level lock design (SHARED HAP lock +
custom asm spin-lock) with direct HAP_compute_res_hmx_lock/unlock
on the existing vtcm_rctx, which already has HMX capability.

Key changes:
- Create htp/hmx/ subdirectory with all HMX infrastructure and ops
- Replace hmx_mgr_ctx_id + spin-lock with HAP_compute_res_hmx_lock(vtcm_rctx)
- Remove hmx_manager_enable/disable_execution() (SHARED lock no longer needed)
- Add hmx_set_vtcm_state() call in main.c (was missing, caused null globals)
- Update main.c includes to use hmx/ prefix
- Clean up duplicate declarations from hmx-worker-pool.h

* migrate(hmx-infra): consolidate HMX infrastructure into htp_context

- Remove hmx-mgr.c/h: eliminate global HMX state singleton, thread htp_context through all HMX ops
- Remove hmx-worker-pool.c/h: replace separate HMX worker pool with main worker_pool API (worker_pool_run_func)
- Replace hmx_unit_acquire/release with direct HAP_compute_res_hmx_lock/unlock on ctx->vtcm_rctx
- Remove HTP_VTCM_SESSION_HOLD compile option: always use per-op vtcm_acquire/release
- Remove hmx_dma from htp_context: HMX ops use ctx->dma[0] instead of separate DMA queue
- Simplify main.c init/cleanup: remove hmx_manager_setup/reset and vtcm_op_acquire/release wrappers
- Delete upstream llama.cpp AGENTS.md (not applicable to fork)

* migrate(flash-attn): remove HTP_EXP2_TABLE_COPIES, use single exp2 table

- Remove HTP_EXP2_TABLE_COPIES compile definition and CMake cache variable
- Remove table duplication loop in precompute-table.c
- Remove worker_index % N sub-table indexing in hmx-flash-attn-ops.c
- Fix table_size to 65536 (single 64 KB copy) in main.c

The exp2 lookup table is read-only; concurrent VTCM reads do not cause
bank conflicts, so duplicating the table wastes 192 KB of VTCM for no
benefit.

* migrate(dsp-main): add HMX priority dispatch in packet_callback

- Add proc_hmx_matmul_req() wrapper for HMX mat_mul (F16 and quantized types)
- Add proc_hmx_flash_attn_req() wrapper for HMX simple_flash_attn (FP16 only, falls back to HVX for non-FP16)
- Add proc_hmx_rms_norm_req() wrapper using hvx_rms_norm_f32
- Route MUL_MAT, FLASH_ATTN_EXT, RMS_NORM through HMX path when ctx->hmx_enabled
- Split RMS_NORM and SCALE into separate case blocks for independent dispatch
- All HMX wrappers guarded by #ifdef HTP_HAS_HMX

* migrate(cmake-dsp): add HMX source files and -mhmx for v73+ skels

Add HTP_VTCM_SESSION_HOLD option (default ON) and v73+ HMX build
integration: compile hmx-matmul-ops, hmx-flash-attn-ops,
hmx-rms-norm-ops and precompute-table into v73/v75/v79/v81 skels
with -mhmx flag and HTP_HAS_HMX=1 definition. v68/v69 skels remain
unchanged.

* migrate(hmx-ops): fix compile errors in HMX ops for ggml struct compatibility

- hmx-matmul-ops.c: include ggml-common.h for block_q4_0/block_q8_0 definitions
- hmx-matmul-ops.c: rename quants->qs, scale->d to match upstream ggml field names
- hmx-flash-attn-ops.c: suppress -Wunused-function/-Wunused-variable warnings
- hmx-flash-attn-ops.c: inline ctx->n_threads, remove unused n_workers variable

* hmx: set Q/O element type to fp16 for flash attention

The llama.cpp integration passes fp16 Q/O tensors, so qo_fp32_element
should be false to match the actual data layout.

* hexagon: unify HMX weight format to x4x2, add IQ4_NL and DSP-side fallback

Remove the v73+ HMX-specific super-block/tile-permuted weight format
and unify all architectures on the HVX x4x2 packed format. The DSP now
decides at runtime whether to use the HMX or HVX matmul path based on
dimension constraints (M%32, N%32, K%256 alignment), rather than the
host rejecting ops in supports_op. This simplifies the host repack
logic, eliminates ~400 lines of HMX super-block code, and adds IQ4_NL
quantization support across host and DSP.

Key changes:
- Remove hmx_block_q4_0/q8_0 types, repack functions, and F16 tile
  permutation (ggml-hexagon.cpp, hmx-quants.h)
- Simplify set_tensor/get_tensor to always use x4x2 repack, add IQ4_NL
- Force is_host=false so tensor copies go through format conversion
- Add HTP_TYPE_IQ4_NL to DSP message protocol (htp-msg.h)
- Rewrite DSP dequantizers to work directly on x4x2 layout
  (hmx-matmul-ops.c)
- Fix mxclracc.hf placement: clear per output tile, not once globally
- Move HMX eligibility checks to DSP proc_hmx_matmul_req (main.c)
- Remove dma_queue_push_1d wrapper, use 2D DMA for weight sub-blocks
- Add VTCM allocation overflow asserts
- Remove GGML_HEXAGON_HMX_TAIL_HVX build option (CMakeLists.txt)

* Enhance HMX debugging capabilities with new tile dumping functions

- Introduced hmx_dump_tile_mem and hmx_dump_fp32_tile_region for improved memory layout visualization of tile data.
- Updated hmx_dump_tile_rows to provide raw memory output for debugging.
- Added debug logging for activation and weight tile pairs during processing to facilitate troubleshooting.
- Refined existing macros for dumping HVX vector values to streamline debugging output.

These changes aim to enhance the debugging experience for HMX matmul operations, ensuring better visibility into data handling and transformations.

* OK for small mat mul

* hexagon: fix UDMA roiwidth 16-bit overflow in HMX matmul DMA transfers

The UDMA descriptor roiwidth field is 16-bit (max 65535), but large matrix
DMA transfers (e.g. 32×2304 = 73728 bytes) exceeded this limit, causing
truncated transfers and NaN results. Fix by using 2D DMA (per-row stride ×
n_rows) instead of 1D (total_size × 1) for all 4 DMA push calls in both
x4x2 and fp16 weight paths.

Also includes:
- Use standard vlut16 instead of _nomatch variant for dequantization
- Add per-tile vscatter drain barrier for correctness
- Add compile-time HMX_DEBUG_TRACE_VALUES instrumentation (disabled by default)

* hexagon: remove HMX RMS norm fallback and re-enable matmul pipeline

Remove hmx-rms-norm-ops.c as the HVX RMS norm offers no benefit over
the generic unary path. Re-enable DMA pipeline mode for QK matmul.

* hexagon: guard all HMX matmul DMA transfers against UDMA 16-bit field overflow

All UDMA type1 descriptor fields (roiwidth, roiheight, srcstride, dststride)
are 16-bit (max 65535). Commit 40d2a9cc fixed roiwidth overflow in the
non-pipeline path by switching from 1D to 2D DMA, but the pipeline path
(3 call sites) was left unchanged and still used 1D DMA with
chunk_size = n_cols * row_stride as roiwidth, which overflows for any
practical matrix size when the pipeline is active.

Add a local hmx_dma_push_safe() helper that transparently handles overflow:
- Fast path (zero overhead): all params fit in 16 bits -> direct call.
- Contiguous block: reshapes into a single 2D descriptor with sub_width
  that fits in 16 bits, preserving async DMA behavior.
- Stride overflow: row-by-row fallback for future large-k models where
  per-row stride itself exceeds 65535.

Convert all 8 external dma_queue_push calls in hmx-matmul-ops.c to use
the safe helper, including the 3 pipeline sites (1D -> 2D fix), the
FP16 and x4x2 weight paths, qweight_fetch sub-block DMA, and the
output-stationary activation fetch.

* hexagon: multithread activation/output transfer and add HMX matmul fallback

- Replace single-threaded transfer_activation_chunk_fp32_to_fp16 with
  transfer_activation_chunk_multithread across all HMX matmul paths
- Add multi-threaded transfer_output_chunk_multithread for FP16-to-FP32
  output store, following the same worker pool pattern
- Rename transfer_activation_chunk_no_prefetch back to
  transfer_activation_chunk_fp32_to_fp16 and clean up stale comments
- Add HVX fallback in proc_hmx_matmul_req when HMX matmul returns error

* [todo]: dynamic alloc vtcm, cause prefill regression.

* hexagon: constrain HMX mxmem tile load region to avoid VTCM bank boundary faults

Set activation/weight mxmem Rt to 2047 for single-tile loads and document the 4MB VTCM bank boundary constraint, preventing precise bus errors when dynamic VTCM allocation places tiles near bank edges.

* hexagon: split unaligned-M HMX matmul into HMX+HVX phases

- keep HMX for the 32-aligned head rows and process tail rows with HVX
- force re-quantization for HVX tail after HMX phase to avoid stale VTCM state
- preserve fallback behavior when N is unaligned or no aligned M rows exist

* hexagon: batch-4 Q4_0 dequantize fast path and remove debug traces

Add dequantize_x4x2_q4_0_x4groups_hvx() that processes 4 contiguous
K-tiles with a single vmemu + vlut16 per row, reducing per-tile overhead.
The dequantize loop now takes the batch-4 path when 4 aligned K-tiles
are available within the same column tile, falling back to the original
single-tile path otherwise.

Also removes HMX_DEBUG_TRACE_VALUES instrumentation blocks that are no
longer needed.

* hexagon: abort on DSP error and fix HMX-to-HVX fallback quantize flag

Promote DSP response error from log to GGML_ABORT for fail-fast
behavior. Clear SKIP_QUANTIZE flag when falling back from HMX to HVX
matmul so the HVX path correctly re-quantizes activations.

* hexagon: support batch matmul. This fix perplexity issue
The problem comes from Grouped-Query Attention(GQA).  Strides between batches are not well respected
TODO: optimize batch matmul to reuse weights between batches.

* hexagon: reuse weights in fp16 batch matmul

* hexagon: remove unused HMX flash attention operations and precomputation table, remove the log system for test

* hexagon: remove unused HVX math helpers, debug infrastructure, and stale build options

* hexagon: fix HMX not enabled due to missing force_hvx parameter in IDL

* hexagon: remove the unnecessary changes not related to HMX

* hexagon: bypass HMX by default

* hexagon: add upstream repo link to htp-ops-lib ported file headers

* hexagon: restore host buffer support

* hexagon: add HMX=1 option for the adb scripts

* hex-hmx: improve DMA pipelining

* hex-hmx: further improvements to dma pipelining

* hex-hmx: minor cleanup

* hex-hmx: move hmx lock out of inner loops/calls

* hex-hmx: remove unnecessary state and wrappers

* hex-hmx: remove hmx dir and unify f32 to f16 conversions

* hex-hmx: further unify hvx conversions

* hex-hmx: revert f16 converter to the original for now

* hex-hmx: minor cleanup for f16 to f32 converter

* hex-mm: replace incorrect fp16-to-fp32 hmx converter and reformated related code

* hex-dma: move chanied dma push into hex-dma.h header and update hmx-mm

* hex-mm: use hex_is_aligned instead of a duplicated hmx_is_aligned

* hex-mm: use hvx_vec_splat_f16 in the hmx code

* hex-mm: use VLEN and HTP types in hmx-code

* hex-mm: remove duplicate QK and defs

* hexagon: pre-shuffle quants before vlut16

* hexagon: enable HMX by default

* hex-mm: code indent fixes for hmx-matmul

* hexagon: update hex-utils to include align/smin/etc helpers and use that in hmx mm

* hex-mm: more formatting fixes

* hex-mm: minor naming updates in hmx code

* hex-mm: remove leftover from rebase conflict

* Fix the incorrect indents

---------

Co-authored-by: Max Krasnyansky <redacted>
5 weeks agoci : add hip quality check (#20430)
uvos [Thu, 19 Mar 2026 16:05:44 +0000 (17:05 +0100)]
ci : add hip quality check (#20430)

* CI: add hip quality check

* Update scripts/hip/gcn-cdna-vgpr-check.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update .github/workflows/hip-quality-check.yml

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update .github/workflows/hip-quality-check.yml

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update .github/workflows/hip-quality-check.yml

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update scripts/hip/gcn-cdna-vgpr-check.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update scripts/hip/gcn-cdna-vgpr-check.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update scripts/hip/gcn-cdna-vgpr-check.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update scripts/hip/gcn-cdna-vgpr-check.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* Revert "Update .github/workflows/hip-quality-check.yml"

This reverts commit efa0bfcdb01dfac0feee674987a0482d50f46145.

* scripts: gcn-cdna-vgpr-check.py: enforce int type for total_vgprs

* scripts: gcn-cdna-vgpr-check.py: add flash attention instances to ignore list

* Bump ccache version

* Add mssing seperators to list

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agocommon/parser: add proper reasoning tag prefill reading (#20424)
Piotr Wilkin (ilintar) [Thu, 19 Mar 2026 15:58:21 +0000 (16:58 +0100)]
common/parser: add proper reasoning tag prefill reading (#20424)

* Implement proper prefill extraction

* Refactor cli parameters, update docs, move reasoning budget sampler part to common/reasoning-budget.cpp

* Update tools/server/server-task.cpp

* refactor: move grammars to variant, remove grammar_external, handle exception internally

* Make code less C++y

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agoggml webgpu: ops support for qwen3.5 (SET, TRI_SOLVE, SSM_CONV, GATED_DELTA_NET)...
Reese Levine [Thu, 19 Mar 2026 15:45:28 +0000 (08:45 -0700)]
ggml webgpu: ops support for qwen3.5 (SET, TRI_SOLVE, SSM_CONV, GATED_DELTA_NET) + GET_ROWS optimization (#20687)

* Implement l2_norm, set, tri

* Add DIAG/SOLVE_TRI

* Add SSM_CONV

* Better get_rows and gated_delta_net to support qwen3.5

* Clean up, update ops.md

* Fix binding_index type for wasm

* Fix read write annotations

* cleanups

5 weeks agocommon : add LLAMA_ARG_SPEC_TYPE (#20744)
ddh0 [Thu, 19 Mar 2026 15:16:55 +0000 (10:16 -0500)]
common : add LLAMA_ARG_SPEC_TYPE (#20744)

5 weeks agoci : add action for finding duplicate issues (#20756)
Georgi Gerganov [Thu, 19 Mar 2026 14:17:37 +0000 (16:17 +0200)]
ci : add action for finding duplicate issues (#20756)

* ci : add action for finding duplicates issues

* cont : gen info

* cont : formatting

* cont : fix

* cont : instructions

* cont : bump checkout action

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

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agoServer becomes the source of truth for sampling parameter defaults (#20558)
Pascal [Thu, 19 Mar 2026 12:20:39 +0000 (13:20 +0100)]
Server becomes the source of truth for sampling parameter defaults (#20558)

* webui: make server the source of truth for sampling defaults

* webui: fix Custom badge for sampling parameters

* webui: log user overrides after server sync

* chore: update webui build output

* fix: Default values for sampling settings config object

* chore: update webui build output

---------

Co-authored-by: Aleksander Grygier <redacted>
5 weeks agomtmd: add clip_graph::build_mm() (#20751)
Xuan-Son Nguyen [Thu, 19 Mar 2026 12:11:39 +0000 (13:11 +0100)]
mtmd: add clip_graph::build_mm() (#20751)

* clip: add build_mm()

* apply to all models

* add TODO for bias overload

5 weeks agoWebUI: Persist the on/off state of the MCP servers for new conversations (#20750)
Pascal [Thu, 19 Mar 2026 11:54:06 +0000 (12:54 +0100)]
WebUI: Persist the on/off state of the MCP servers for new conversations (#20750)

* webui: add persistent storage for MCP server on/off state in new chats

* webui: simplify MCP enabled checks, remove dead server.enabled fallback

* chore: update webui build output

* chore: update webui build output

---------

Co-authored-by: Aleksander Grygier <redacted>
5 weeks agowebui: Improve model parsing logic + add unit tests (#20749)
Aleksander Grygier [Thu, 19 Mar 2026 11:25:50 +0000 (12:25 +0100)]
webui: Improve model parsing logic + add unit tests (#20749)

* add tests for model id parser

* add test case having activated params

* add structured tests for model id parser

* add ToDo

* feat: Improve model parsing logic + tests

* chore: update webui build output

---------

Co-authored-by: bluemoehre <redacted>
5 weeks agoconvert : support is_causal hyperparameter (#20746)
Dowon [Thu, 19 Mar 2026 10:41:11 +0000 (19:41 +0900)]
convert : support is_causal hyperparameter (#20746)

* convert : support is_causal hyperparameter

Check for the `is_causal` attribute in the Hugging Face model configuration and include it in the GGUF metadata.

* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* style: fix F541 f-string is missing placeholders

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agocommon : fix gpt-oss content removal (#20745)
Aldehir Rojas [Thu, 19 Mar 2026 10:40:39 +0000 (05:40 -0500)]
common : fix gpt-oss content removal (#20745)

5 weeks agovulkan: dequantize iq4_xs 4 at a time (#20657)
Eve [Thu, 19 Mar 2026 10:32:04 +0000 (10:32 +0000)]
vulkan: dequantize iq4_xs 4 at a time (#20657)

5 weeks agocmake : fix build warning when kleidiai is enabled (#20457)
Charles Xu [Thu, 19 Mar 2026 08:14:48 +0000 (09:14 +0100)]
cmake : fix build warning when kleidiai is enabled (#20457)

* cmake : fix build warning when kleidiai is enabled

* remove LLAMA_ARG_THREADS from KleidiAI backend

5 weeks agovocab : assert array size of scores and toktypes (#20737)
Sigbjørn Skjæret [Thu, 19 Mar 2026 07:34:04 +0000 (08:34 +0100)]
vocab : assert array size of scores and toktypes (#20737)

5 weeks agodocs: add information about openvino in the docker page (#20743)
Kevin Hannon [Thu, 19 Mar 2026 07:08:47 +0000 (03:08 -0400)]
docs: add information about openvino in the docker page (#20743)

5 weeks agoCANN: handle in-place ROPE on non-contiguous f32 tensors (#20274)
Chenguang Li [Thu, 19 Mar 2026 06:05:01 +0000 (14:05 +0800)]
CANN: handle in-place ROPE on non-contiguous f32 tensors (#20274)

RotaryPositionEmbedding on CANN fails when src and dst share the same
non-contiguous buffer (inplace + view), because the operator overwrites
source data before it is fully read.

Add a branch that detects this case and uses contiguous temporary
buffers: copy src to temp, run ROPE into another temp, then copy back
to the non-contiguous dst. Fixes 20 failing ROPE tests (f32, v=1,
inplace=1).

Signed-off-by: noemotiovon <redacted>
5 weeks agoggml-webgpu: Update the `RMS_NORM` preprocessor and add `L2_NORM` (#20665)
Masashi Yoshimura [Thu, 19 Mar 2026 04:08:59 +0000 (13:08 +0900)]
ggml-webgpu: Update the `RMS_NORM` preprocessor and add `L2_NORM` (#20665)

* Update the preprocessor of RMS_NORM and add L2_NORM.

* Fix the name of rms_norm to row_norm.

5 weeks agoggml-webgpu: Add supports for `DIAG` and `TRI` (#20664)
Masashi Yoshimura [Thu, 19 Mar 2026 04:08:35 +0000 (13:08 +0900)]
ggml-webgpu: Add supports for `DIAG` and `TRI` (#20664)

* Add supports for DIAG and TRI.

* Remove extra ttype and add a comment for TRI op.

5 weeks agoCANN: support flash attention for head dim not multiple of 16, fix ALiBi slope offset...
Chenguang Li [Thu, 19 Mar 2026 03:02:42 +0000 (11:02 +0800)]
CANN: support flash attention for head dim not multiple of 16, fix ALiBi slope offset (#20031)

- Allow FLASH_ATTN_EXT when head dimension D is not a multiple of 16 by
  padding Q/K/V to D_padded = GGML_PAD(D, 16), running FusedInferAttentionScoreV2,
  then slicing the output back to D (ggml-cann.cpp + aclnn_ops.cpp).
- Fix aclnn_get_slope second-part offset: use ggml_type_size(dtype) instead of
  sizeof(float) so ALiBi slopes are correct when dtype is F16 (e.g. GQA with
  48 heads); fixes buffer overflow and large numerical errors in those cases.

5 weeks agomodel : add control vector support where missing (#20653)
Michael Grau [Wed, 18 Mar 2026 22:25:12 +0000 (23:25 +0100)]
model : add control vector support where missing (#20653)

* Add control vector functions to qwen3.5 and qwen-next models

* Add missing cvec compatibility to the rest of the models

* Adjust comments and formatting

* cleanup

* whitespace

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
5 weeks agogguf-py : cleaner way to get the first key (#20727)
Sigbjørn Skjæret [Wed, 18 Mar 2026 22:21:42 +0000 (23:21 +0100)]
gguf-py : cleaner way to get the first key (#20727)

5 weeks agoRebuild index.html.gz (#20724)
crsawyer [Wed, 18 Mar 2026 17:49:57 +0000 (12:49 -0500)]
Rebuild index.html.gz (#20724)

5 weeks agoMove to no timeout for WaitAny in graph submission to avoid deadlocks in some cases...
Reese Levine [Wed, 18 Mar 2026 17:23:47 +0000 (10:23 -0700)]
Move to no timeout for WaitAny in graph submission to avoid deadlocks in some cases on llvm-pipe backends (#20618)

5 weeks agoggml-cpu/x86: fix unused changemask warning in repack (#20692)
Shaw Nguyen [Wed, 18 Mar 2026 16:45:06 +0000 (23:45 +0700)]
ggml-cpu/x86: fix unused changemask warning in repack (#20692)

5 weeks agosync : ggml
Georgi Gerganov [Wed, 18 Mar 2026 12:45:54 +0000 (14:45 +0200)]
sync : ggml

5 weeks agoggml : bump version to 0.9.8 (ggml/1442)
Georgi Gerganov [Mon, 16 Mar 2026 18:15:14 +0000 (20:15 +0200)]
ggml : bump version to 0.9.8 (ggml/1442)

5 weeks agoggml : restore ggml_type_sizef() to aboid major version bump (ggml/1441)
Georgi Gerganov [Mon, 16 Mar 2026 18:09:25 +0000 (20:09 +0200)]
ggml : restore ggml_type_sizef() to aboid major version bump (ggml/1441)

5 weeks agowebui: improve tooltip wording for attachment requirements (#20688)
Julien Chaumond [Wed, 18 Mar 2026 13:01:02 +0000 (14:01 +0100)]
webui: improve tooltip wording for attachment requirements (#20688)

* webui: improve tooltip wording for attachment requirements

Co-Authored-By: Claude <redacted>
* chore: update webui build output

* chore: update webui build output

---------

Co-authored-by: Claude <redacted>
5 weeks agollama : re-enable manual LoRA adapter free (#19983)
Pop Flamingo [Wed, 18 Mar 2026 10:03:26 +0000 (11:03 +0100)]
llama : re-enable manual LoRA adapter free (#19983)

* Re-enable manual LoRA adapter free

* Remove stale "all adapters must be loaded before context creation" stale comments

5 weeks agotests : fix test-jinja-py Windows failures by bypassing command-line args [no ci...
Masato Nakasaka [Wed, 18 Mar 2026 09:43:31 +0000 (02:43 -0700)]
tests : fix test-jinja-py Windows failures by bypassing command-line args [no ci] (#20483)

* Fix errors occurring on Windows

* Reverted fix

#20365 will take care of CRLF isue

* Changed to write to directly to stdin

* Prevent fclose to happen twice

5 weeks agocommon : rework gpt-oss parser (#20393)
Aldehir Rojas [Wed, 18 Mar 2026 09:41:25 +0000 (04:41 -0500)]
common : rework gpt-oss parser (#20393)

* common : rework gpt-oss parser

* cont : fix gpt-oss tests

* cont : add structured output test

* cont : rename final to final_msg

5 weeks agotests: enable kv_unified to prevent cuda oom error on rtx 2060 (#20645)
Aaron Teo [Wed, 18 Mar 2026 09:40:22 +0000 (17:40 +0800)]
tests: enable kv_unified to prevent cuda oom error on rtx 2060 (#20645)

Signed-off-by: Aaron Teo <redacted>
5 weeks agowebui: Fix duplicated messages on q param (#20715)
Aleksander Grygier [Wed, 18 Mar 2026 09:32:43 +0000 (10:32 +0100)]
webui: Fix duplicated messages on q param (#20715)

* fix: Remove duplicate message sending on `?q` param

* chore: update webui build output

5 weeks agoHIP : ignore return of hipMemAdvise [no ci] (#20696)
uvos [Wed, 18 Mar 2026 08:53:13 +0000 (09:53 +0100)]
HIP : ignore return of hipMemAdvise [no ci] (#20696)

5 weeks agocontext : fix graph not resetting when control vector changes (#20381)
Andreas Obersteiner [Wed, 18 Mar 2026 06:10:13 +0000 (07:10 +0100)]
context : fix graph not resetting when control vector changes (#20381)

5 weeks agohexagon: add neg, exp, sigmoid, softplus ops, cont, repeat ops (#20701)
Krishna Sridhar [Tue, 17 Mar 2026 22:34:36 +0000 (15:34 -0700)]
hexagon: add neg, exp, sigmoid, softplus ops, cont, repeat ops (#20701)

Add element-wise unary ops needed by Qwen 3.5's DeltaNet linear
attention layers. These ops follow the existing unary-ops pattern
with VTCM DMA double-buffering.

- neg: negate via scale by -1.0
- exp: uses existing hvx_exp_f32 HVX intrinsics
- sigmoid: uses existing hvx_sigmoid_f32_aa HVX intrinsics
- softplus: log(1 + exp(x)) scalar fallback
- CONT reuses the existing CPY infrastructure since making a tensor
  contiguous is equivalent to a same-type copy.
- REPEAT implements tiled memory copy with multi-threaded execution via
  the worker pool, supporting f32 and f16 types. The kernel parallelizes
  across output rows and uses memcpy for each tile.

Co-authored-by: Max Krasnyansky <redacted>