]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
4 months agoWrite a readme on Multi-GPU usage in llama.cpp (#22729)
Gaurav Garg [Thu, 7 May 2026 15:48:40 +0000 (21:18 +0530)]
Write a readme on Multi-GPU usage in llama.cpp (#22729)

* Write a readme on Multi-GPU usage in llama.cpp

* Apply suggestions from code review

Co-authored-by: Johannes Gäßler <redacted>
* Address review comments

* Apply suggestions from code review

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

Co-authored-by: Johannes Gäßler <redacted>
4 months agollama : remove unnecessary seq_id check during state restore (#22797)
Georgi Gerganov [Thu, 7 May 2026 13:37:26 +0000 (16:37 +0300)]
llama : remove unnecessary seq_id check during state restore (#22797)

4 months agoggml-cpu: Optimized risc-v cpu q1_0 dot
pl752 [Thu, 7 May 2026 13:09:25 +0000 (18:09 +0500)]
ggml-cpu: Optimized risc-v cpu q1_0 dot

4 months agomtmd: fix whisper audio tail truncation by exposing padded buffer to FFT (#22770)
Pascal [Thu, 7 May 2026 12:01:01 +0000 (14:01 +0200)]
mtmd: fix whisper audio tail truncation by exposing padded buffer to FFT (#22770)

4 months agomodel: Add Mimo v2.5 model support (#22493)
AesSedai [Thu, 7 May 2026 11:21:58 +0000 (04:21 -0700)]
model: Add Mimo v2.5 model support (#22493)

* add mimo-v2.5 support

* mimo-v2.5: fix modify_tensors row split

* mimi-v2.5: forgot `add_attn_value_scale` plumbing

* mimi-v2.5: fix tp dequant to detect tp rows

* mimo-v2.5: fix TP iteration to be descending

* mimo-v2.5: fix comment

* mimo-v2.5: retain fused qkv

* mimo-v2.5: missed the attn_value scale during merge

* mimo-v2.5: fused QKV needs contiguous for scaling attention value

* mimo-v2.5: move `speech_embeddings.` to TextModel filter_tensors

* Update src/llama-hparams.h

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

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

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>
* Update src/models/mimo2.cpp

Co-authored-by: Sigbjørn Skjæret <redacted>
* mimo-v2.5: include MTP weights in gguf

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agowebui: fix ?model= URL param race in router mode (#22771)
Pascal [Thu, 7 May 2026 11:09:32 +0000 (13:09 +0200)]
webui: fix ?model= URL param race in router mode (#22771)

* webui: fix ?model= URL param race in router mode

* chore: update webui build output

4 months agocodeowners : add ZenDNN backend codeowner (#22772)
Vishal Singh [Thu, 7 May 2026 06:46:51 +0000 (12:16 +0530)]
codeowners : add ZenDNN backend codeowner (#22772)

* codeowners : add ZenDNN backend codeowner

* codeowners : fix zendnn owners to use individual github handles

4 months agowebui: fix flicker issue on dismiss animation on overlay primitives (#22773)
viggy [Thu, 7 May 2026 06:11:31 +0000 (23:11 -0700)]
webui: fix flicker issue on dismiss animation on overlay primitives (#22773)

* add fill-mode-forwards

* generated diffs

4 months agosycl : fix test script (#22737)
Shane Tran Whitmire [Thu, 7 May 2026 05:25:57 +0000 (00:25 -0500)]
sycl : fix test script (#22737)

The error:
./examples/sycl/test.sh: line 122: level_zero:${$GGML_SYCL_DEVICE}: bad
substitution

was thrown whenever the user used this command:
./examples/sycl/test.sh -mg 0

Fix is to get rid of a dollar sign.

4 months agollama : add missing call to ggml_backend_load_all() (#22752)
Adrien Gallouët [Thu, 7 May 2026 05:24:47 +0000 (07:24 +0200)]
llama : add missing call to ggml_backend_load_all() (#22752)

Signed-off-by: Adrien Gallouët <redacted>
4 months agomtmd : support MiniCPM-V 4.6 (#22529)
tc-mb [Wed, 6 May 2026 19:54:09 +0000 (03:54 +0800)]
mtmd : support MiniCPM-V 4.6 (#22529)

* Support MiniCPM-V 4.6 in new branch

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

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

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

Signed-off-by: tc-mb <redacted>
* rename clip_graph_minicpmv4_6

Signed-off-by: tc-mb <redacted>
* use new TYPE_MINICPMV4_6

Signed-off-by: tc-mb <redacted>
* use build_attn to allow flash attention support

Signed-off-by: tc-mb <redacted>
* no use legacy code, restored here.

Signed-off-by: tc-mb <redacted>
* use the existing tensors name

Signed-off-by: tc-mb <redacted>
* unused ctx->model.hparams.minicpmv_version

Signed-off-by: tc-mb <redacted>
* use n_merge for slice alignment

Signed-off-by: tc-mb <redacted>
* borrow wa_layer_indexes for vit_merger insertion point

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

Signed-off-by: tc-mb <redacted>
* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* use filter_tensors and add model.vision_tower

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

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

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

Signed-off-by: tc-mb <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agomodel : don't crash on unsupported architecture (#22742)
Gilad S. [Wed, 6 May 2026 16:51:21 +0000 (11:51 -0500)]
model : don't crash on unsupported architecture (#22742)

* model: don't crash on unsupported architecture

* Update src/llama-model.cpp

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

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agocommon: do not fit to unknown device memory (#22614)
fl0rianr [Wed, 6 May 2026 15:03:45 +0000 (17:03 +0200)]
common: do not fit to unknown device memory (#22614)

* common: do not fit to unknown device memory

Signed-off-by: Florian Reinle <redacted>
* common: preserve host fallback for non-GPU fit devices

Signed-off-by: Florian Reinle <redacted>
* common: keep unknown GPU fit memory at zero

Signed-off-by: Florian Reinle <redacted>
---------

Signed-off-by: Florian Reinle <redacted>
4 months agogguf-py : bump version to 0.19.0 (#22664)
Georgi Gerganov [Wed, 6 May 2026 12:46:14 +0000 (15:46 +0300)]
gguf-py : bump version to 0.19.0 (#22664)

* gguf-py : bump version to 0.19.0

* bump poetry

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agomtmd: add granite-speech support (ibm-granite/granite-4.0-1b-speech) (#22101)
Yakine Tahtah [Wed, 6 May 2026 12:40:59 +0000 (14:40 +0200)]
mtmd: add granite-speech support (ibm-granite/granite-4.0-1b-speech) (#22101)

* mtmd: add granite-speech support (ibm-granite/granite-4.0-1b-speech)

Conformer encoder with Shaw relative position encoding,
QFormer projector, log-mel spectrogram with frame stacking.

Encoder uses GLU gating, folded batch norm, and SSM depthwise
conv. QFormer compresses encoder output via windowed
cross-attention (window=15, queries=3) into the LLM embedding
space.

Audio preprocessing: reflect-padded STFT, 80-bin mel filterbank,
dynamic range compression, 2x frame stacking (80->160 mel).

GGUF converter handles batch norm folding at export time,
fused K/V split, and Conv1d weight reshaping.

Tested against HF transformers reference: token-for-token match
on 30s/60s audio clips with greedy decoding.

* mtmd: rename gs_ prefixed tensors to generic/architecture names

* mtmd: use tensor_mapping.py for all granite_speech tensors

* convert: fold GraniteSpeechTextModel into GraniteModel

* mtmd: replace n_layer hack with explicit has_standard_layers flag

* mtmd: replace hardcoded magic numbers with GGUF hparams for granite speech

* mtmd: align KEY_A_ define spacing

* convert: register GraniteModel for GraniteSpeechForConditionalGeneration

* convert: fix ty type-check for GraniteSpeechMmprojModel registration

* mtmd: align TN_ define spacing

* mtmd: use generic layer loop for granite speech tensor loading

* mtmd: merge qformer_proj_layer into clip_layer

* mtmd: granite_speech remove redundant ggml_build_forward_expand on inputs

* mtmd: granite_speech add comment explaining why build_attn is not used

* mtmd: granite_speech hard-code eps in cpp, remove from GGUF metadata

* gguf: add spacing between granite_speech tensor mapping blocks

* mtmd: make generic audio layer_norm_eps read optional

* mtmd: granite_speech keep encoder eps in GGUF, only hard-code projector eps

* mtmd: align defines and struct fields in clip-impl.h and clip-model.h

* mtmd: fix alignment and ordering issues across granite speech files

* convert: granite_speech use filter_tensors instead of modify_tensors for skipping

4 months agofeat: migrate to PEP 621 and add uv support (#21907)
David Huggins-Daines [Wed, 6 May 2026 12:04:10 +0000 (08:04 -0400)]
feat: migrate to PEP 621 and add uv support (#21907)

* feat: migrate to PEP 621 and add uv support

* fix: remove upper bound on protobuf

* remove poetry.lock and uv.lock

* fix/add torch dependency version and markers

* fix dev-dependency deprecation warning

* gguf-py : update python version requirement to 3.10

---------

Co-authored-by: David Huggins-Daines <redacted>
Co-authored-by: Daniel Bevenius <redacted>
4 months agoconvert : ignore non-language tensors for Gemma4Model (#22753)
Daniel Bevenius [Wed, 6 May 2026 11:50:44 +0000 (13:50 +0200)]
convert : ignore non-language tensors for Gemma4Model (#22753)

* convert : ignore non-language tensors for Gemma4Model

This commit adds a check to make sure only text language tensors are
handled in filter_tensors.

The motivation is that currently when trying to convert a Gemma4 model
the following error occurs:
```console
(venv) $ ./convert-gemma.sh
INFO:hf-to-gguf:Loading model: gemma-4-E2B-it
INFO:hf-to-gguf:Model architecture: Gemma4ForConditionalGeneration
INFO:hf-to-gguf:gguf: indexing model part 'model.safetensors'
INFO:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only
INFO:hf-to-gguf:Exporting model...
INFO:hf-to-gguf:rope_freqs.weight,                 torch.float32 --> F32, shape = {256}
Traceback (most recent call last):
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 13752, in <module>
    main()
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 13746, in main
    model_instance.write()
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 945, in write
    self.prepare_tensors()
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 805, in prepare_tensors
    for new_name, data_torch in (self.modify_tensors(data_torch, name, bid)):
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 7925, in modify_tensors
    yield from super().modify_tensors(data_torch, name, bid)
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 7290, in modify_tensors
    yield from super().modify_tensors(data_torch, name, bid)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 579, in modify_tensors
    new_name = self.map_tensor_name(name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/danbev/work/llama.cpp/./convert_hf_to_gguf.py", line 572, in map_tensor_name
    raise ValueError(f"Can not map tensor {name!r}")
ValueError: Can not map tensor 'model.embed_vision.embedding_projection.weight'
```

* add forgotten embed_vision and embed_audio

* improve

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agowebui: Remove Google Favicons & Improve MCP Information logic & UI (#22719)
Aleksander Grygier [Wed, 6 May 2026 09:12:27 +0000 (11:12 +0200)]
webui: Remove Google Favicons & Improve MCP Information logic & UI (#22719)

* refactor: Remove Google favicon utility

* fix: MCP Server favicon

* refactor: Cleanup

* refactor: MCP Server Information

* fix: Fix MCP Settings UI

* refactor: Cleanup

4 months agoggml-cpu: fuse RMS_NORM + MUL on CPU backend (#22423)
zzzzwc [Wed, 6 May 2026 07:41:14 +0000 (15:41 +0800)]
ggml-cpu: fuse RMS_NORM + MUL on CPU backend  (#22423)

4 months agoadd tabindex and aria-hidden (#22699)
viggy [Wed, 6 May 2026 07:21:58 +0000 (00:21 -0700)]
add tabindex and aria-hidden (#22699)

4 months agoconvert : add filter_tensors method to pre-filter tensors (#22597)
Sigbjørn Skjæret [Wed, 6 May 2026 06:06:05 +0000 (08:06 +0200)]
convert : add filter_tensors method to pre-filter tensors (#22597)

* add filter_tensors classmethod

* remove language_model

* fix parts validation

4 months agoggml : use `CL_DEVICE_GLOBAL_MEM_SIZE` as memory estimate for OpenCL --fit (#22688)
fl0rianr [Wed, 6 May 2026 05:12:48 +0000 (07:12 +0200)]
ggml : use `CL_DEVICE_GLOBAL_MEM_SIZE` as memory estimate for OpenCL --fit (#22688)

* ggml : report estimated OpenCL memory for --fit

Signed-off-by: Florian Reinle <redacted>
* ggml : estimated OpenCL memory backend integrated

Signed-off-by: Florian Reinle <redacted>
---------

Signed-off-by: Florian Reinle <redacted>
4 months agoHexagon: Process M-tail rows on HMX instead of HVX (#22724)
Trivikram Reddy [Tue, 5 May 2026 16:43:03 +0000 (11:43 -0500)]
Hexagon: Process M-tail rows on HMX instead of HVX (#22724)

* hex-mm: process m-tail rows on HMX instead of HVX

* hmx-mm: unroll and optimize padded activation loop

---------

Co-authored-by: Max Krasnyansky <redacted>
4 months agoopencl: refactor Adreno q4_0 (#22335)
lhez [Tue, 5 May 2026 16:38:57 +0000 (09:38 -0700)]
opencl: refactor Adreno q4_0 (#22335)

* opencl: refactor adreno q4_0 gemm/gemv dispatch

* opencl: refactor q4_0 gemm/gemv loading, use consistent names

* opencl: use consistent name for adreno q8_0 gemm/gemv

* opencl: use consistent names for adreno q4_0 gemm/gemv

* opencl: simplify adreno q4_0 set_tensor

* opencl: refactor q4_0 get_tensor

4 months agorpc : use graph uid instead of graph cache (#22701)
Radoslav Gerganov [Tue, 5 May 2026 10:47:13 +0000 (13:47 +0300)]
rpc : use graph uid instead of graph cache (#22701)

Store the last graph uid and compare against it to determine if the same
graph is being computed.

4 months agocommon : fix missing-noreturn warnings when compiling with clang 21 (#22702)
Adrien Gallouët [Tue, 5 May 2026 10:16:25 +0000 (12:16 +0200)]
common : fix missing-noreturn warnings when compiling with clang 21 (#22702)

common/arg.cpp:3719:9: error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     3719 |         [](common_params & /*params*/, int /*value*/) {
          |         ^
    common/arg.cpp:3726:9: error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     3726 |         [](common_params & /*params*/, int /*value*/) {
          |         ^
    common/arg.cpp:3733:9: error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     3733 |         [](common_params & /*params*/, int /*value*/) {
          |         ^
    common/arg.cpp:3740:9: error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     3740 |         [](common_params & /*params*/, int /*value*/) {
          |         ^
    common/arg.cpp:3747:9: error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
     3747 |         [](common_params & /*params*/, int /*value*/) {
          |         ^

Signed-off-by: Adrien Gallouët <redacted>
4 months agosync : ggml
Georgi Gerganov [Tue, 5 May 2026 10:15:19 +0000 (13:15 +0300)]
sync : ggml

4 months agoggml : bump version to 0.11.0 (ggml/1478)
Georgi Gerganov [Tue, 5 May 2026 10:14:32 +0000 (13:14 +0300)]
ggml : bump version to 0.11.0 (ggml/1478)

4 months agocommon : only load backends when required (#22290)
Adrien Gallouët [Tue, 5 May 2026 07:23:50 +0000 (09:23 +0200)]
common : only load backends when required (#22290)

* common : only load backends when required

Signed-off-by: Adrien Gallouët <redacted>
* llama : call ggml_backend_load_all() directly from llama_backend_init()

Signed-off-by: Adrien Gallouët <redacted>
* Add ggml_backend_load_all() where llama_backend_init() is not used

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

Signed-off-by: Adrien Gallouët <redacted>
4 months agovendor : update cpp-httplib to 0.43.3 (#22686)
Alessandro de Oliveira Faria (A.K.A.CABELO) [Tue, 5 May 2026 07:04:57 +0000 (04:04 -0300)]
vendor : update cpp-httplib to 0.43.3 (#22686)

4 months agoserver : validate --tools CLI argument against known tool names (#22538)
Georgi Gerganov [Tue, 5 May 2026 03:35:27 +0000 (06:35 +0300)]
server : validate --tools CLI argument against known tool names (#22538)

Previously, unknown tool names passed via --tools were silently ignored.
Now the server validates each tool name at startup and exits with an
error if an unrecognized tool is specified, listing the available tools.

Assisted-by: llama.cpp:local pi
4 months agollama : add option to save memory in device buffers (#22679)
Georgi Gerganov [Tue, 5 May 2026 03:35:07 +0000 (06:35 +0300)]
llama : add option to save memory in device buffers (#22679)

* llama : add option to save memory in device buffers

* tests : extend llama-save-load-state

4 months agograph : handle non-contiguous Q/K/V in mul_mat_aux (#22630)
Sigbjørn Skjæret [Tue, 5 May 2026 03:34:44 +0000 (05:34 +0200)]
graph : handle non-contiguous Q/K/V in mul_mat_aux (#22630)

* qkv may not always be contiguous

* cont : make the cont conditional

---------

Co-authored-by: Georgi Gerganov <redacted>
4 months agoggml : implement fast walsh-hadamard transform for kv rotation (#21352) (#22631)
Ismail [Tue, 5 May 2026 02:05:05 +0000 (04:05 +0200)]
ggml : implement fast walsh-hadamard transform for kv rotation (#21352) (#22631)

4 months agokleidiai : update to v1.24.0 and use release archive (#22549)
Charles Xu [Mon, 4 May 2026 19:13:31 +0000 (21:13 +0200)]
kleidiai : update to v1.24.0 and use release archive (#22549)

4 months agoCUDA: use fastdiv for batch index split in get_rows (#22650)
leonardHONG [Mon, 4 May 2026 14:24:05 +0000 (22:24 +0800)]
CUDA: use fastdiv for batch index split in get_rows (#22650)

4 months agoserver: implement /models?reload=1 (#21848)
Xuan-Son Nguyen [Mon, 4 May 2026 14:23:26 +0000 (16:23 +0200)]
server: implement /models?reload=1 (#21848)

4 months agoexamples: refactor diffusion generation (#22590)
Shakhnazar Sailaukan [Mon, 4 May 2026 12:19:30 +0000 (16:19 +0400)]
examples: refactor diffusion generation (#22590)

* examples: refactor diffusion generation

* renamed enum values

4 months agowebui : fix circular dependency between chat.service.ts and models.svelte.ts (#22625)
JusteLeo [Mon, 4 May 2026 11:38:10 +0000 (13:38 +0200)]
webui : fix circular dependency between chat.service.ts and models.svelte.ts (#22625)

4 months agocommon/autoparser: fixes for newline handling / forced tool calls (#22654)
Piotr Wilkin (ilintar) [Mon, 4 May 2026 11:18:11 +0000 (13:18 +0200)]
common/autoparser: fixes for newline handling / forced tool calls (#22654)

* chat/autoparser: the fixes

* Move optspace() to chat-peg-parser, comment out server tests invalidated due to content now allowed with forced tool calls.

* Trim whitespace on apply instead

4 months agomodel: move `load_hparams` and `load_tensors` to per-model definition (#22004)
Xuan-Son Nguyen [Mon, 4 May 2026 10:36:59 +0000 (12:36 +0200)]
model: move `load_hparams` and `load_tensors` to per-model definition (#22004)

* git-friendly migration

* add build_graph

* nits

* exclude old code from build

* wip

* add llm_arch_model_i

* prepare downstream functions

* nits

* nits

* wip

* wip

* add back create_tensor_qkv

* fix files missing include

* enforce one llm_build per arch

* cmake: use glob

* missing model params

* nits

* wip

* wip (2)

* wip (3)

* test-llama-archs is happy

* improve switch case

* move more stuff into llm_arch_model_i

* fix downstream code

* nits

* nits (2)

* fix order

* llama_model_base

* LLAMA_LOAD_LOCALS

* small fix

* fix build errors

* auto

* rm migration script and ifdef

4 months agoserver: Add a simple get_datetime server tool (#22649)
Evan Huus [Mon, 4 May 2026 10:19:41 +0000 (06:19 -0400)]
server: Add a simple get_datetime server tool (#22649)

4 months agowebui: restore missing settings (#22666)
Nick Towle [Mon, 4 May 2026 07:04:07 +0000 (00:04 -0700)]
webui: restore missing settings (#22666)

4 months agodocs : update speculative decoding parameters after refactor (#22397) (#22539)
Georgi Gerganov [Mon, 4 May 2026 05:52:07 +0000 (08:52 +0300)]
docs : update speculative decoding parameters after refactor (#22397) (#22539)

* docs : update speculative decoding parameters after refactor (#22397)

Update docs/speculative.md to reflect the new parameter naming scheme
introduced in PR #22397:

- Replace --draft-max/--draft-min with --spec-draft-n-max/--spec-draft-n-min
- Replace --spec-ngram-size-n/m with per-implementation variants
- Add documentation for all new --spec-ngram-*- parameters
- Update all example commands

Assisted-by: llama.cpp:local pi
* pi : add rule to use gh CLI for GitHub resources

Assisted-by: llama.cpp:local pi
* docs : run llama-gen-docs

* arg : fix typo

4 months agovulkan: delete dead GGML_VK_MAX_NODES def (#22621)
Atomic-Germ [Mon, 4 May 2026 05:49:29 +0000 (22:49 -0700)]
vulkan: delete dead GGML_VK_MAX_NODES def (#22621)

4 months agoggml-webgpu: add layer norm ops (#22406)
Chen Yuan [Mon, 4 May 2026 03:52:53 +0000 (23:52 -0400)]
ggml-webgpu: add layer norm ops (#22406)

* shader(norm): add layer norm ops

* shader(norm): stablize floating point computation with Kahan summation and handle mixed types

* shader(norm): remove the non-contiguous strides

* shader(norm): use the original implementation rather than the kahan summation

4 months agocommon : determine generation prompt using longest common prefix (#22657)
Aldehir Rojas [Sun, 3 May 2026 22:18:23 +0000 (17:18 -0500)]
common : determine generation prompt using longest common prefix (#22657)

4 months agoconvert : Mistral format yarn apply_scale support (#22612)
Julien Denize [Sun, 3 May 2026 19:51:21 +0000 (21:51 +0200)]
convert :  Mistral format yarn apply_scale support (#22612)

* [BUGFIX] Mistral format apply_scale support.

* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* fix misunderstood boolean parameters

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agoconvert : apply Q/K RoPE permutation in NVFP4 repack path (#22611)
JM Robles [Sun, 3 May 2026 15:22:00 +0000 (17:22 +0200)]
convert : apply Q/K RoPE permutation in NVFP4 repack path (#22611)

Llama-architecture q_proj/k_proj weights need an axis-0 row permutation
to match GGML's RoPE convention. The BF16 path applies this in
LlamaModel.modify_tensors via LlamaModel.permute, but the NVFP4 path
bypasses modify_tensors and writes weights directly through
ModelBase._repack_nvfp4. Without the permutation, attention heads end
up scrambled at inference and the model produces gibberish.

This change overrides _repack_nvfp4 on LlamaModel and applies the same
permutation to both the nibble-packed weight and the per-block scale
before delegating to ModelBase._repack_nvfp4 via super(). Reuses the
existing LlamaModel.permute static helper and respects the existing
undo_permute flag, so subclasses (Mistral, Granite, Llama4, etc.)
inherit the fix automatically.

Verified on TinyLlama-1.1B reproducer: perplexity drops from 4419
(gibberish) to 43.9, matching the BF16-dequantized baseline (44.0).
Also verified end-to-end on ALIA-40b-instruct-2601 (BSC, Llama
architecture) with multilingual generation in Spanish/Catalan/Basque/
Galician all coherent with the fix applied.

Co-authored-by: Chema <redacted>
4 months agofix: CUDA device PCI bus ID de-dupe OOMing (ignoring other 3 gpus entirely) (#22533)
lucy [Sat, 2 May 2026 20:19:25 +0000 (16:19 -0400)]
fix: CUDA device PCI bus ID de-dupe OOMing (ignoring other 3 gpus entirely) (#22533)

* fix: CUDA device PCI bus ID detection for multi-GPU de-dupe

* HIP, MUSA macros

---------

Co-authored-by: Johannes Gäßler <redacted>
4 months agoserver : avoid checkpoint data host copies (#22558)
Georgi Gerganov [Sat, 2 May 2026 15:03:25 +0000 (18:03 +0300)]
server : avoid checkpoint data host copies (#22558)

* server : avoid checkpoint data host copies

* llama : refactor llama_io_read_i

4 months agoggml-virtgpu: fix circular dependency in headers (#22557)
JusteLeo [Sat, 2 May 2026 13:28:50 +0000 (15:28 +0200)]
ggml-virtgpu: fix circular dependency in headers (#22557)

4 months agoconvert : disable uint types (#18908)
Csaba Kecskemeti [Sat, 2 May 2026 06:05:59 +0000 (23:05 -0700)]
convert : disable uint types (#18908)

4 months agoopencl: Adreno optimization for MoE - MxFP4 (#22301)
Shawn Gu [Sat, 2 May 2026 06:02:24 +0000 (23:02 -0700)]
opencl: Adreno optimization for MoE - MxFP4 (#22301)

* MoE Mxfp4 CLC kernel added, router reorder on GPU

* Pass test-backend-ops for MoE mxfp4 Adreno CLC

* remove putenv in llama-model.cpp

* fix indent style and whitespace

* opencl: remove unnecessary headers

* opencl: do not save cl_program objects

* opencl: remove unnecessary assert

* fix precision issue

---------

Co-authored-by: Li He <redacted>
4 months agoGithub: update issue templates (#22594)
Johannes Gäßler [Sat, 2 May 2026 05:56:13 +0000 (07:56 +0200)]
Github: update issue templates (#22594)

4 months agosync : ggml
Georgi Gerganov [Sat, 2 May 2026 05:46:31 +0000 (08:46 +0300)]
sync : ggml

4 months agoggml : bump version to 0.10.2 (ggml/1474)
Georgi Gerganov [Sat, 2 May 2026 05:45:46 +0000 (08:45 +0300)]
ggml : bump version to 0.10.2 (ggml/1474)

4 months agosync : ggml
Georgi Gerganov [Fri, 1 May 2026 18:29:15 +0000 (21:29 +0300)]
sync : ggml

4 months agoggml : try fix win32 build (whisper/0)
Georgi Gerganov [Fri, 1 May 2026 15:53:30 +0000 (18:53 +0300)]
ggml : try fix win32 build (whisper/0)

4 months agohexagon: hmx flash attention (#22347)
Yiwei Shao [Sat, 2 May 2026 03:29:13 +0000 (20:29 -0700)]
hexagon: hmx flash attention (#22347)

* hmx: extract shared interleave headers and unify matmul batched

* hmx: add HMX-accelerated flash attention for prefill

* hmx: replace asm wrappers with Q6_ intrinsics in hmx-utils.h

Switches three single-instruction helpers from inline asm to the matching
Q6_ intrinsics, matching the style established by aizip f8737609a and used
by the upstream PR #21554 hmx-matmul-ops.c rewrite:

  hmx_set_output_scales       asm "bias=mxmem2"  -> Q6_bias_mxmem2_A
  hmx_load_tile_pair_fp16     asm packet         -> Q6_activation_hf_mxmem_RR
                                                    + Q6_weight_hf_mxmem_RR
  hmx_consume_accumulator_fp16 asm "mxmem=acc"   -> Q6_mxmem_AR_after_hf

hmx_load_tiles_fp16 stays on inline asm: it uses ":deep" activation
streaming, and the mixed Q6_activation_hf_mxmem_RR_deep + non-deep
Q6_weight_hf_mxmem_RR pair fails the HMX backend constraint check
("activate weight pair (1) exceeds limit (1)"). The asm bundle keeps
both halves in one VLIW packet and avoids the diagnostic.

Functionally equivalent — same instructions emitted; the Q6_ intrinsics
just give the compiler more visibility for scheduling.

* hmx: drop the duplicate interleave_fp16_weight_chunk_to_tiles

* hmx:  apply upstream optimization to hmx-flash-attn-ops.c
apply restrict, __builtin_assume, and pointer accumulation to the three HMX workers (qk_dot, o_update, o_norm) and the matching inline HMX loops in op_hmx_flash_attn_ext.

* hmx: unify interleave helper

* hmx: multi-thread Q load / O store and enable prefill FA dispatch

Extract inline Q-load and O-store loops into worker_pool-parallel helpers
(fa_phase_q_load, fa_phase_o_store) so HVX threads split the F32↔F16
conversion work across row ranges.  Also relax the softmax threading
gate from n_row_vec_cnt >= n_threads to >= 2, which was unnecessarily
forcing single-thread fallback when n_rows_g < 512.

On the dispatch side, remove the ne[2] != 1 guard that blocked multi-head
(prefill) FA from reaching the HTP backend — GQA is already handled
internally by both the HMX and HVX flash-attention paths.

* hmx: relax matmul pipeline gate to cover k > n shapes (e.g. FFN_down)

* hmx: optimize FA softmax mask phase (no-ALiBi fast path + GQA dedup)

* hmx: Add an asm memory clobber at the phase boundary to prevent reorder bug

* [experimental]: fp16 softmax (EXP2_HF) to accelerate fa

Bake log2(e) into qk_scale and use hvx_exp2_hf directly for P and m_diff
(base-2 consistent, matches htp-ops-lib). ~22 ALU ops for 64 lanes vs
~44 for the F32 round-trip path.

* hmx flash-attn: refine cost model coefficients based on profiling data

* hmx flash-attn: replace asm clobber with targeted volatile reads on vtcm_d_tiles

* hmx flash-attn: fix prefill correctness (dst indexing, softmax reduce, V stride)

* hmx flash-attn: fix p_tiles dual-tile OOB race; enable MT + pipeline

* hmx flash-attn: preserve additive mask bias in no-ALiBi fast path

The no-ALiBi fast path (max_bias==0) was skipping mask add entirely on
the assumption that mask values are only {0, -inf}.  This is wrong when
the mask carries additive positional bias — those terms were silently
dropped.  Keep the slope-mul skip (slope≡1.0) but add mask back so the
bias survives; vmux still clamps below -16 to -inf.

Also add HMX FA coverage to test-backend-ops: prefill shapes (nb=64,
nb=32) × {mask on/off} × {ALiBi on/off} × {softcap on/off}, F16 KV,
hs ∈ {64, 128}.

* hmx: fix softcap+EXP2_HF interaction, tighten matmul pipeline gate, add FA tests

- flash-attn: when EXP2_HF is on AND logit_softcap is active, fold
  log2(e) into the post-tanh multiplier (v_cap) instead of pre-baking
  it into qk_scale.  Pre-baking shifted the tanh knee from x≈c to
  x≈c/log2(e) and produced numerically wrong softcapped outputs
  whenever both knobs were enabled.
- flash-attn softmax (fa_softmax_thread): replace the union+memcpy
  scalar extract pattern with HVX vmux-based per-row accumulators on
  rowmax/rowsum.  Add hvx_vec_get_f16 helper in hvx-base.h.  Functional
  parity, less scalar code, clearer hf/qf16 lane-format contract.
- matmul (hmx_mat_mul_permuted_qk_0_d16a32): pick pipeline vs sequential
  layout based on whether the chunker actually yields >=2 n-chunks,
  instead of the static (m>=128 && n>=256) gate.  Avoids paying for
  output double-buffer + worker dispatch when there is no HMX/HVX
  overlap to gain (e.g. shapes that collapse to one n-chunk).
- tests: add HMX flash-attention coverage over the
  {mask, ALiBi (max_bias), logit_softcap} cross-product for the prefill
  path — head_dim 64/128, GQA 4×4, kv=512/nb=64 plus a kv=113/nb=32
  non-aligned case.

* [Help Wanted]: refactor D matrix computation into separate function for clarity and maintainability

* format code

* hexagon: looks like -O3 is causing issues with the large code base, switch to -O2 and -flto instead

* hexagon: use hex_ prefix for swap_ptr

* hexagon: move vtcm_seq_alloc into vtcm-utils.h

More vtcm allocator updates are coming so it makes sense to start the separate hdr for it.

* hmx-utils: add hmx_prefix for layout converters

* hmx-mm: move main hmx_mm functions to the end, remove unused fwd decls, etc

* hmx-mm: remove unused qweight_fetch_task_state_t and minor alignment fixes

* hmx-fa: minor alignment fixes

* hmx-fa: move hmx_flash_atten into hmx-ops.h

* hmx-fa: remove redundant workpool pointer in the hmx_fa_ctx, plus minor alignment updates

* hmx-fa: minor alignment and simplifications

* hexagon: move FA_EXP_F16 option to hostside CMake file

* hmx-fa: use hvx_vec_splat_f16 instead of fp16_to_bits

* hmx-fa: add hvx_splat_u16/u8 and use that in the fa instead custom hvx_fill

* hmx-fa: some more alignment updates in the core fa function

* hmx-fa: keep slopes in vtcm in fp16

Saves malloc/free and removes the need for float -> fp16 downcast on every use.

* hexagon: consistent noinline usage (after static)

* hex-hmx: consistent use FARF_HIGH to enable debug output

* hmx-utils: no need for always_inline attr

* hex-hmx: consistent noinline usage (static noinline ...)

* hex-hmx: simplify init_col_scales

* hexagon: fix editorconfig errors

* hmx-mm: minor alignment fixes

---------

Co-authored-by: Max Krasnyansky <redacted>
4 months agollama-quant : fix `--tensor-type` when default `qtype` is overriden (#22572)
ddh0 [Fri, 1 May 2026 17:55:55 +0000 (12:55 -0500)]
llama-quant : fix `--tensor-type` when default `qtype` is overriden (#22572)

fix #22544 (my fault!)

Credit to @Anai-Guo, ref #22559 - since that one was closed due to the
new contributor policy I am taking the liberty of re-submitting that PR
here.

4 months agohexagon: enable non-contiguous row tensor support for unary ops (#22574)
Aparna M P [Fri, 1 May 2026 17:09:23 +0000 (22:39 +0530)]
hexagon: enable non-contiguous row tensor support for unary ops (#22574)

4 months agowebui: Spring Cleaning Refactor v1 (#22505)
Aleksander Grygier [Fri, 1 May 2026 16:36:29 +0000 (18:36 +0200)]
webui: Spring Cleaning Refactor v1 (#22505)

* wip: server_tools

* feat: Integrate with `/tools` endpoint

* feat: Builtin + MCP + JSON Schema Tools WIP

* refactor

* displayName -> display_name

* snake_case everywhere

* rm redundant field

* feat: Improvements

* chore: update webui build output

* refactor: Updates after server updates

* chore: update webui build output

* change arg to --tools all

* feat: UI improvements

* chore: update webui build output

* add readme mention

* llama-gen-docs

* chore: update webui build output

* chore: update webui build output

* chore: update webui build output

* feat: Reorganize settings sections

* feat: Separate dialogs for MCP Servers Settings and Import/Export

* feat: WIP

* feat: WIP

* feat: WIP

* feat: WIP

* feat: WIP

* feat: WIP

* WIP on allozaur/20677-webui-server-tools

* feat: UI improvements

* chore: Update package lock

* chore: Run `npm audit fix`

* feat: UI WIP

* feat: UI

* refactor: Desktop Icon Strip DRY

* feat: Cleaner rendering and transition for ChatScreen

* feat: UI improvements

* feat: UI improvement

* feat: Remove MCP Server "enable" switch from Tools submenu

* chore: Run `npm audit fix`

* feat: WIP

* feat: Logic improvements

* refactor: Cleanup

* refactor: DRY

* test: Fix Chat Sidebar UI Tests

* chore: Update package lock

* refactor: Cleanup

* feat: Chat Message Action Card with Continue and Permission flow implementations

* feat: Add agentic steering messages, draft messages and improve chat UX

* fix: Search results UI

* test: Fix unit test

* feat: UI/UX improvements

* refactor: Simplify `useToolsPanel` access in components

* feat: Implement Processing Info Context API

* feat: Implement 'Go back to chat' functionality for settings

* feat: Enhance MCP Server management in Chat Form Attachments

* style: Minor UI and branding adjustments

* chore: Update webui static build output

* chore: Formatting, linting & type checks

* feat: Draft messages logic

* feat: UI improvements

* feat: Steering Messages improvements

* refactor: Cleanup

* refactor: Cleanup

* feat: Improve UI

* refactor: Settings navigation hook

* refactor: DRY code

* refactor: DRY ChatMessageUser UI components

* refactor: Desktop Icon Strip DRY

* refactor: Tools & permissions

* fix: Navigation condition

* refactor: Cleanup

* refactor: Cleanup

* refactor: Cleanup

* fix: preserve reasoning_content in agentic flow

* refactor: Storybook cleanup

* refactor: isInViewport util function

* refactor: Rename globally `onClick` to `onclick`

* chore: `npm audit fix`

* refactor: Action Icon usage

* refactor: Naming

* refactor: JS in `class` directive

* refactor: Chat components cleanup WIP

* refactor: Components structure

* refactor: Cleanup WIP

* feat: New ChatAttachmentsPreview component

* feat: UI improvements

* feat: UI improvements

* refactor: Cleanup

* refactor: ChatAttachmentsPreview UI/UX

* refactor: Remove dead code

* refactor: Cleanup

* fix: Model Name aliases displaying

* feat: Shortcut improvements

* refactor: Chat Message

* feat: Move Import/Export to settings

* refactor: Cleanup

* refactor: Cleanup

* refactor: Cleanup

* refactor: Cleanup

---------

Co-authored-by: Xuan Son Nguyen <redacted>
4 months agoggml-webgpu: Fix vectorized handling in mul-mat and mul-mat-id (#22578)
Masashi Yoshimura [Fri, 1 May 2026 14:55:01 +0000 (23:55 +0900)]
ggml-webgpu: Fix vectorized handling in mul-mat and mul-mat-id (#22578)

* Fix vectorized condition of mul-mat-fast pipeline and add vectorized variant to mul-mat-id

* Apply suggestion from @CISC

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

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agovulkan: Support asymmetric FA in coopmat2 path (#21753)
Jeff Bolz [Fri, 1 May 2026 13:28:32 +0000 (15:28 +0200)]
vulkan: Support asymmetric FA in coopmat2 path (#21753)

* vulkan: Support asymmetric FA in coopmat2 path

There has been some recent interest/experimentation with mixed quantization
types for FA. I had originally designed the cm2 FA shader with this in mind
(because I didn't realize it wasn't supported at the time!), this change
adds the missing pieces and enables it.

Also support Q1_0 since people have been trying that out (seems crazy, but
who knows).

We should be able to do similar things in the coopmat1/scalar path, but
there's another change open against the scalar path and I don't want to
conflict.

* reorder cases

4 months agoggml-webgpu: add the upscale shader (#22419)
Chen Yuan [Fri, 1 May 2026 05:22:18 +0000 (01:22 -0400)]
ggml-webgpu: add the upscale shader (#22419)

* shader(upscale): add the upscale shader with nearest, bilinear and bicubic implementations

* shader(upscale): use macro

4 months agoggml-webgpu: Improve performance of mat-vec and mat-mat for MUL_MAT_ID (#22464)
Masashi Yoshimura [Thu, 30 Apr 2026 21:19:10 +0000 (06:19 +0900)]
ggml-webgpu: Improve performance of mat-vec and mat-mat for MUL_MAT_ID (#22464)

* Add mat-vec fast path of MUL_MAT_ID.

* Add shared accumulation vec logic and the other types supports.

* Add i-quant mat-mat for MUL_MAT_ID and fix some parts

* Remove n_experts from shader_lib_context.

4 months agoUpdate llama-mmap to use ftello/fseeko (#22497)
Reese Levine [Thu, 30 Apr 2026 21:17:52 +0000 (14:17 -0700)]
Update llama-mmap to use ftello/fseeko (#22497)

* Update llama-mmap to work with 32-bit wasm and >2GB models

* Update to gguf.cpp style

4 months agocommon : check for null getpwuid in hf-cache (#22550)
Adrien Gallouët [Thu, 30 Apr 2026 19:32:41 +0000 (21:32 +0200)]
common : check for null getpwuid in hf-cache (#22550)

Signed-off-by: Adrien Gallouët <redacted>
4 months agovulkan: add get/set tensor 2d functions (#22514)
Ruben Ortlam [Thu, 30 Apr 2026 15:37:13 +0000 (17:37 +0200)]
vulkan: add get/set tensor 2d functions (#22514)

* vulkan: add get/set_tensor_2d functions

* fix backend interface comments

* Update ggml/src/ggml-metal/ggml-metal.cpp

Co-authored-by: Sigbjørn Skjæret <redacted>
4 months agospec: fix argument typo (#22552)
Ben Guidarelli [Thu, 30 Apr 2026 14:32:32 +0000 (10:32 -0400)]
spec: fix argument typo (#22552)

4 months agoci : bump ty to 0.0.33 (#22535)
Sigbjørn Skjæret [Thu, 30 Apr 2026 13:15:54 +0000 (15:15 +0200)]
ci : bump ty to 0.0.33 (#22535)

* bump ty to 0.0.33

* update typings

4 months agovendor : update cpp-httplib to 0.43.2 (#22548)
Adrien Gallouët [Thu, 30 Apr 2026 13:04:39 +0000 (15:04 +0200)]
vendor : update cpp-httplib to 0.43.2 (#22548)

Signed-off-by: Adrien Gallouët <redacted>
4 months agoCUDA: fix tile FA kernel on Pascal (#22541)
Johannes Gäßler [Thu, 30 Apr 2026 11:04:50 +0000 (13:04 +0200)]
CUDA: fix tile FA kernel on Pascal (#22541)

4 months agoscripts : add wc2wt.sh - create worktree from current HEAD (#22513)
Georgi Gerganov [Thu, 30 Apr 2026 06:20:26 +0000 (09:20 +0300)]
scripts : add wc2wt.sh - create worktree from current HEAD (#22513)

* scripts : add wc2wt.sh - create worktree from current HEAD

Add a script to create a git worktree on a new branch from the current
HEAD. Similar to pr2wt.sh but for local development branches instead of
PRs.

Usage:
  ./scripts/wc2wt.sh gg/new-feature
  ./scripts/wc2wt.sh gg/new-feature "bash -l"

Assisted-by: llama.cpp:local pi
* cont : no need to try to delete the branch

4 months agoadd fast matmul iquants (#22504)
Rithik Sharma [Thu, 30 Apr 2026 05:58:32 +0000 (22:58 -0700)]
add fast matmul iquants (#22504)

4 months agospec : fix draft model checkpoints (#22521)
Georgi Gerganov [Thu, 30 Apr 2026 05:32:18 +0000 (08:32 +0300)]
spec : fix draft model checkpoints (#22521)

* spec : fix draft model checkpoints

* cont : clean-up

* cont : gate the ngram-mod reset warning behind verbose flag

4 months agospec : fix vocab compat checks in spec example (#22426)
Peter Sideris [Thu, 30 Apr 2026 05:18:25 +0000 (08:18 +0300)]
spec : fix vocab compat checks in spec example (#22426)

* port #22358 PR to examples/speculative/speculative.cpp
* use vocab_[tgt,dft] instead of ctx_[tgt,dft] when logging on draft
  model / target model vocabulary mismatch

Co-authored-by: Petros Sideris <redacted>
4 months agocommon : do not pass prompt tokens to reasoning budget sampler (#22488)
Aldehir Rojas [Wed, 29 Apr 2026 19:10:58 +0000 (14:10 -0500)]
common : do not pass prompt tokens to reasoning budget sampler (#22488)

4 months agohexagon: make vmem and buffer-size configurable (#22487)
Max Krasnyansky [Wed, 29 Apr 2026 18:51:21 +0000 (11:51 -0700)]
hexagon: make vmem and buffer-size configurable (#22487)

* hexagon: allow host to set max vmem size

We use a sane default but it's helpful to allow for an override if needed.

* hexagon: add support for measuring vmem space and move pinned mmaping management to host

* hexagon: update vmem checks to use uint64

* hexagon: bump op buffers to 16 (matches max mmaps)

* hexagon: bump default vmem to 3.2GB

* hexagon: add support for autodetecting vmem space and some logging cleanup in that area

* hexagon: fix whitespace warnings

* Update scripts/snapdragon/adb/run-cli.sh

Co-authored-by: Pascal <redacted>
* hex-adb: fix run-completion script

---------

Co-authored-by: Pascal <redacted>
4 months agoCUDA: fuse SSM_CONV + ADD(bias) + SILU (#22478)
Anav Prasad [Wed, 29 Apr 2026 18:39:56 +0000 (11:39 -0700)]
CUDA: fuse SSM_CONV + ADD(bias) + SILU (#22478)

4 months agospec : disacard last drafted token with low prob (#22506)
Georgi Gerganov [Wed, 29 Apr 2026 14:00:00 +0000 (17:00 +0300)]
spec : disacard last drafted token with low prob (#22506)

4 months agosync : ggml
Georgi Gerganov [Wed, 29 Apr 2026 13:43:08 +0000 (16:43 +0300)]
sync : ggml

4 months agoggml : bump version to 0.10.1 (ggml/1469)
Georgi Gerganov [Wed, 29 Apr 2026 13:41:45 +0000 (16:41 +0300)]
ggml : bump version to 0.10.1 (ggml/1469)

4 months agowebui: fix slow mic stop and WAV encode (#22480)
Pascal [Wed, 29 Apr 2026 10:58:35 +0000 (12:58 +0200)]
webui: fix slow mic stop and WAV encode (#22480)

* webui: instant mic stop, race-free recorder restart

* webui: faster WAV PCM encode via hoisted channels and Int16Array

* chore: update webui build output

* webui: drop setTimeout(0) hack and harden cancelRecording

* chore: update webui build output

4 months agoggml-cpu : disable tiled matmul on AIX to fix page boundary segfault (#22293)
shalinib-ibm [Wed, 29 Apr 2026 10:32:40 +0000 (16:02 +0530)]
ggml-cpu : disable tiled matmul on AIX to fix page boundary segfault (#22293)

* ggml-cpu : disable tiled matmul on AIX to fix page boundary segfault

vec_xst operations in the tiled path crash on AIX when writing
near 4KB page boundaries due to strict memory protection. Fall
back to mnpack implementation on AIX for stable execution.

Signed-off-by: Shalini Salomi Bodapati <redacted>
* Update ggml/src/ggml-cpu/llamafile/sgemm.cpp

Co-authored-by: Aaron Teo <redacted>
* Update sgemm.cpp

* Update sgemm.cpp

---------

Signed-off-by: Shalini Salomi Bodapati <redacted>
Co-authored-by: Aaron Teo <redacted>
4 months agoggml-cuda: refactor fusion code (#22468)
Aman Gupta [Wed, 29 Apr 2026 08:19:33 +0000 (16:19 +0800)]
ggml-cuda: refactor fusion code (#22468)

* ggml-cuda: refactor fusion code

* apply formatting + make env variable truthy

4 months agoggml-cpu: cmake: append xsmtvdotii march for SpacemiT IME (#22317)
qiurui144 [Wed, 29 Apr 2026 07:59:21 +0000 (15:59 +0800)]
ggml-cpu: cmake: append xsmtvdotii march for SpacemiT IME (#22317)

* ggml-cpu: cmake: append xsmtvdotii march for SpacemiT IME

When GGML_CPU_RISCV64_SPACEMIT=ON is set, ime1_kernels.cpp contains
inline asm for the vmadot family which requires the xsmtvdotii custom
extension.(problem can see in some blogs and make sure in K3 platform)
The current CMakeLists does not include xsmtvdotii, so any toolchain
that honours the explicit -march (tested with SpacemiT GCC 15.2) fails
at the assembler stage:

  Error: unrecognized opcode `vmadot v16,v14,v0',
         extension `xsmtvdotii' required

Append _xsmtvdotii to MARCH_STR when GGML_CPU_RISCV64_SPACEMIT is
enabled so the IME path can actually build with a capable toolchain.
No effect on builds that leave GGML_CPU_RISCV64_SPACEMIT off.

toolchain from https://www.spacemit.com/community/resources-download/Tools

* Update ggml/src/ggml-cpu/CMakeLists.txt

Co-authored-by: alex-spacemit <redacted>
---------

Co-authored-by: alex-spacemit <redacted>
4 months agoggml-webgpu: Fix bug in FlashAttention support check (#22492)
Reese Levine [Wed, 29 Apr 2026 07:59:00 +0000 (00:59 -0700)]
ggml-webgpu: Fix bug in FlashAttention support check (#22492)

* Fix flashattention support check for devices that don't support subgroups

* set path to none if kv_tile doesn't fit

4 months agocommon: Intentionally leak logger instance to fix hanging on Windows (#22273)
Masato Nakasaka [Wed, 29 Apr 2026 07:58:43 +0000 (16:58 +0900)]
common: Intentionally leak logger instance to fix hanging on Windows  (#22273)

* Changed to leak logger singleton to prevent hanging on Windows

* Fix comment

* Stopped using static vector

Using std::vector will cause g_col to be released before the logger thread exits, causing the logger thread to touch freed memory causing a crash

* Change so all logs are output before exit

* Added debug logging

* added more logging

* Added logging

* Explicitly free logger to avoid hanging on Win

* Reverted to leak logger instance again

* Removed debug log and fixed comment

* Fixed comment

---------

Co-authored-by: Georgi Gerganov <redacted>
4 months agoggml : add sve tuned code for gemm_q8_0_4x8_q8_0() kernel (#21916)
hrushitfujitsu [Wed, 29 Apr 2026 07:57:37 +0000 (13:27 +0530)]
ggml : add sve tuned code for gemm_q8_0_4x8_q8_0() kernel (#21916)

* Added sve tuned code for gemm_q8_0_4x8_q8_0() kernel

* Change arrays to static const in repack.cpp

---------

Co-authored-by: Vithulep <redacted>
4 months agoTP: fix delayed AllReduce + zero-sized slices (#22489)
Johannes Gäßler [Wed, 29 Apr 2026 06:55:07 +0000 (08:55 +0200)]
TP: fix delayed AllReduce + zero-sized slices (#22489)

4 months agoggml-cuda: Repost of 21896: Blackwell native NVFP4 support (#22196)
Michael Wand [Tue, 28 Apr 2026 22:47:42 +0000 (15:47 -0700)]
ggml-cuda: Repost of 21896: Blackwell native NVFP4 support (#22196)

4 months agoggml-cuda: add flash-attn support for DKQ=320/DV=256 with ncols2=32 (… (#22286)
lnigam [Tue, 28 Apr 2026 19:37:35 +0000 (01:07 +0530)]
ggml-cuda: add flash-attn support for DKQ=320/DV=256 with ncols2=32 (… (#22286)

* ggml-cuda: add flash-attn support for DKQ=320/DV=256 with ncols2=32 (GQA=32)

Adds MMA-f16 and tile kernel configs, dispatch logic, template instances,
and tile .cu file for Mistral Small 4 (head sizes 320/256), restricting to
ncols2=32 to support GQA ratio 32 only.

* Adding check to return BEST_FATTN_KERNEL_NONE in case GQA!=32

* Apply suggestions from code review

Address review comments

Co-authored-by: Johannes Gäßler <redacted>
* Address review comments and making kernel config default to DQK=512, DV=512 instead of DQK=256,DV=256

* Fixed bug with sinks=1, with ncols=32, there are two warp-groups created but sinks index is same(0,...,15) for both the groups hence with sinks=1, output is not matching with CPU output. Added sink_base which will be base index for each warp_group (threadIdx.y / np)

* Apply suggestions from code review

Co-authored-by: Johannes Gäßler <redacted>
* Update ggml/src/ggml-cuda/template-instances/generate_cu_files.py

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

Co-authored-by: Johannes Gäßler <redacted>
4 months agoconvert : add support for Nemotron Nano 3 Omni (#22481)
Daniel Bevenius [Tue, 28 Apr 2026 17:17:57 +0000 (19:17 +0200)]
convert : add support for Nemotron Nano 3 Omni (#22481)

This commit adds support for NVIDIA Nemotron Nano 3 Omni model enabling
this model to be converted to GGUF.

4 months agocommon : re-arm reasoning budget after DONE on new <think> (#22323)
Jillis ter Hove [Tue, 28 Apr 2026 17:15:36 +0000 (19:15 +0200)]
common : re-arm reasoning budget after DONE on new <think> (#22323)

DONE state absorbs all tokens including a new start tag, causing any think blocks after the first to run unbudgeted. Observed on unsloth/Qwen3.6-27B-GGUF which interleaves multiple <think> blocks per response.

Fixed by advancing start_matcher in DONE branch and re-arming to COUNTING with a fresh budget on match. Adds regression test (test-reasoning-budget: test 6).

4 months agovulkan: Coalesce Q4_K/Q5_K scale loads (#21751)
Matt Corallo [Tue, 28 Apr 2026 15:31:04 +0000 (15:31 +0000)]
vulkan: Coalesce Q4_K/Q5_K scale loads (#21751)

Some SPIR-V compilers (notably mesa) don't handle the current
vulkan Q4_K/Q5_K scale load pattern in mul_mat particularly well.
While reading three `u8`s from the 12-byte scale array should (at
least on some hardware) result in loading the full 12 bytes in a
single LOAD followed by whatever extraction is needed, at least
the ANV Intel driver really can't practically perform this
optimization.

`mesa`'s unsigned upper bound logic doesn't handle tracking bounds
through ternary, resulting in the `(is < 4) ? ... : is - 4` having
an infinite upper bound (as it cannot prove `is - 4` doesn't
underflow). While this could still be rectified if mesa looked at
the array bounds, it currently doesn't and `glslc` currently emits
SPIR-V that doesn't allow for this optimization anyway (though
maybe it will at some point, see
https://github.com/KhronosGroup/glslang/issues/4206).

In mul_mat_vecq we took a different approach to loading the same
fields. We read the first two bytes we needed from `scale` then
took a branch before deciding whether we needed to read a third
byte. In mesa this did, indeed, lead to a top-level branch with
conditional loads. As such these loads ended up not being
coalesced either (at least in the ANV driver) resulting in
additional instructions in our hot loop.

Instead, here, we go ahead and force loading the full 12 bytes and
extract the bits we need from the packed-u32s instead. In mul_mat
there's a few less ternaries and only one extra shift, so even on
drivers that did optimize the previous loads properly the only
material change should be pulling a few extra bytes into registers
(which on most hardware won't cost anything anyway, though
ironically on Intel it theoretically could). In mul_mat_vecq this
requires a bit of extra math and may read bytes from the u32 that
weren't needed, but it seems likely avoiding the branch is a win
on most platforms.

On Intel Xe2/mesa 26.0.4 with the optimizations from
https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15162,

for shader matmul_id_subgroup_q4_k_f32_f16acc_aligned_l:
 * Instruction Count: 2753 -> 2688
 * SEND Count: 269 -> 261
 * Cycle Count: 273976 -> 266138
 * Max live registers: 248 -> 246
 * Non SSA regs after NIR: 381 -> 382

for shader matmul_id_subgroup_q5_k_f32_f16acc_aligned_l:
 * Instruction Count: 2767 -> 2702
 * SEND Count: 271 -> 263
 * Cycle Count: 274140 -> 268144
 * Max live registers: 248 -> 246
 * Non SSA regs after NIR: 381 -> 382

for shader mul_mat_vec_id_q4_k_q8_1_f32:
 * Instruction Count: 1930 -> 1646
 * SEND Count: 116 -> 71
 * Cycle Count: 1348306 -> 843350
 * Max live registers: 78 -> 84
 * Non SSA regs after NIR: 300 -> 135

for shader mul_mat_vec_id_q5_k_q8_1_f32:
 * Instruction Count: 2207 -> 1922
 * SEND Count: 131 -> 86
 * Cycle Count: 1392012 -> 1037836
 * Max live registers: 90 -> 90
 * Non SSA regs after NIR: 300 -> 135

for shader mul_mat_vec_q4_k_q8_1_f32:
 * Instruction Count: 2029 -> 1749
 * SEND Count: 111 -> 66
 * Cycle Count: 1347278 -> 840118
 * Max live registers: 74 -> 80
 * Non SSA regs after NIR: 299 -> 134

for shader mul_mat_vec_q5_k_q8_1_f32:
 * Instruction Count: 2307 -> 2022
 * SEND Count: 126 -> 81
 * Cycle Count: 1379820 -> 954042
 * Max live registers: 86 -> 86
 * Non SSA regs after NIR: 299 -> 134

On one Arc Pro B60, unsloth/Qwen3.5-35B-A3B-GGUF:UD-Q4_K_XL:
 * pp512: 907.34 ± 9.28 -> 941.94 ± 10.53 (+4%)
 * pp2048: 897.95 ± 1.82 -> 931.55 ± 1.79 (+4%)
 * tg128: 49.49 ± 0.02 -> 49.86 ± 0.05 (+ <1%)

On one Arc Pro B60, unsloth/Qwen3.5-27B-GGUF:Q4_K_S:
 * pp512: 324.13 ± 10.52 -> 354.33 ± 6.81 (+9%)
 * pp2048: 329.80 ± 0.25 -> 357.10 ± 0.06 (+8%)
 * tg128: 17.11 ± 0.01 -> 18.11 ± 0.01 (+6%)

On four Arc Pro B60s, unsloth/Qwen3.5-122B-A10B-GGUF:Q5_K_S with
-sm layer (note that -sm tensor improvements will naturally be
less):
 * pp512: 264.55 ± 2.81 -> 280.45 ± 3.94 (+6%)
 * pp2048: 319.32 ± 2.72 -> 335.70 ± 3.48 (+5%)
 * tg128: 26.39 ± 0.01 -> 26.67 ± 0.01 (+1%)

4 months agoggml-webgpu: fix buffer aliasing for ssm_scan and refactor aliasing logic (#22456)
Reese Levine [Tue, 28 Apr 2026 14:27:17 +0000 (07:27 -0700)]
ggml-webgpu: fix buffer aliasing for ssm_scan and refactor aliasing logic (#22456)

* Refactor buffer aliasing to be part of shader lib decisions

* cleanup

* formatting

4 months agowebui: Server tools (#21237)
Aleksander Grygier [Tue, 28 Apr 2026 11:35:49 +0000 (14:35 +0300)]
webui: Server tools (#21237)

* wip: server_tools

* feat: Integrate with `/tools` endpoint

* feat: Builtin + MCP + JSON Schema Tools WIP

* refactor

* displayName -> display_name

* snake_case everywhere

* rm redundant field

* feat: Improvements

* chore: update webui build output

* refactor: Updates after server updates

* chore: update webui build output

* change arg to --tools all

* feat: UI improvements

* chore: update webui build output

* add readme mention

* llama-gen-docs

* chore: update webui build output

* chore: update webui build output

* chore: update webui build output

* feat: Reorganize settings sections

* feat: Separate dialogs for MCP Servers Settings and Import/Export

* feat: WIP

* feat: WIP

* feat: WIP

* feat: WIP

* feat: WIP

* feat: WIP

* WIP on allozaur/20677-webui-server-tools

* feat: UI improvements

* chore: Update package lock

* chore: Run `npm audit fix`

* feat: UI WIP

* feat: UI

* refactor: Desktop Icon Strip DRY

* feat: Cleaner rendering and transition for ChatScreen

* feat: UI improvements

* feat: UI improvement

* feat: Remove MCP Server "enable" switch from Tools submenu

* chore: Run `npm audit fix`

* feat: WIP

* feat: Logic improvements

* refactor: Cleanup

* refactor: DRY

* test: Fix Chat Sidebar UI Tests

* chore: Update package lock

* refactor: Cleanup

* feat: Chat Message Action Card with Continue and Permission flow implementations

* feat: Add agentic steering messages, draft messages and improve chat UX

* fix: Search results UI

* test: Fix unit test

* feat: UI/UX improvements

* refactor: Simplify `useToolsPanel` access in components

* feat: Implement Processing Info Context API

* feat: Implement 'Go back to chat' functionality for settings

* feat: Enhance MCP Server management in Chat Form Attachments

* style: Minor UI and branding adjustments

* chore: Update webui static build output

* chore: Formatting, linting & type checks

* feat: Draft messages logic

* feat: UI improvements

* feat: Steering Messages improvements

* refactor: Cleanup

* refactor: Cleanup

* feat: Improve UI

* refactor: Settings navigation hook

* refactor: DRY code

* refactor: DRY ChatMessageUser UI components

* refactor: Desktop Icon Strip DRY

* refactor: Tools & permissions

* fix: Navigation condition

* refactor: Cleanup

* refactor: Cleanup

* refactor: Cleanup

* fix: preserve reasoning_content in agentic flow

---------

Co-authored-by: Xuan Son Nguyen <redacted>
4 months agovulkan: add barrier after writetimestamp (#21865)
Jeff Bolz [Tue, 28 Apr 2026 10:28:12 +0000 (12:28 +0200)]
vulkan: add barrier after writetimestamp (#21865)