]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
8 weeks agollama : make tensor-split regex patterns static (#24710)
eduardopessin [Fri, 10 Jul 2026 17:04:12 +0000 (18:04 +0100)]
llama : make tensor-split regex patterns static (#24710)

llama_meta_device_get_split_state() recompiled 29 std::regex on every call.
In -sm tensor mode the callback runs once per tensor per token, so this
dominated the decode thread in profiling. Mark them static const so they are
compiled once. Kept inside the function (local statics are thread-safe since
C++11). Patterns are literal and stateless, so behavior is unchanged.

2 months agohexagon: improve ARGSORT performance for small tensors (#25512)
Max Krasnyansky [Fri, 10 Jul 2026 16:06:06 +0000 (09:06 -0700)]
hexagon: improve ARGSORT performance for small tensors (#25512)

* hex-sort: add efficient bitomic sort in hvx regs up to 1024 elements

* hex-sort: fix inverted vrors

* hex-sort: specialize sort functions for the common cases

* hex-sort: add tracing and local context

2 months agoarg: prevent duplicate spec model downloads (#25527)
Xuan-Son Nguyen [Fri, 10 Jul 2026 14:53:26 +0000 (16:53 +0200)]
arg: prevent duplicate spec model downloads (#25527)

2 months agomtmd: deepseek-ocr v1 multi-tile (#24717)
Xuan-Son Nguyen [Fri, 10 Jul 2026 14:05:49 +0000 (16:05 +0200)]
mtmd: deepseek-ocr v1 multi-tile (#24717)

* mtmd: deepseek-ocr v1 multi-tile dynamic resolution + unified image-preprocessors for both versions (ds-ocr v1 and v2)

* remove hacky API

* fuse row into a long image

* almost working

* adapt to new preprocessor api

* rm debugging printf

* improve

* mtmd: dsocr-tiles fixes (#25481)

* ds-ocr img-preproc fuse_row tile-drop fix for multi rows and columns images

* mtmd drop the duplicate redundant img_end

* deepseekocr graph simplify CLS broadcast cleanup

* test-deepseek-ocr: relax v1 single-view tolerance; drop trailing prompt space; make DRY opt-in and n_predict model-specific (#25486)

---------

Co-authored-by: Saba Fallah <redacted>
Co-authored-by: Saba Fallah <redacted>
2 months agofeat: pre-select models in the webui using alias (#25492)
felix [Fri, 10 Jul 2026 13:04:00 +0000 (13:04 +0000)]
feat: pre-select models in the webui using alias (#25492)

Co-authored-by: example name <redacted>
2 months agoui: use server modalities in non-router mode (#24874)
Josh Leverette [Fri, 10 Jul 2026 13:03:52 +0000 (08:03 -0500)]
ui: use server modalities in non-router mode (#24874)

2 months agoserver: remove loading.html (#25500)
Xuan-Son Nguyen [Fri, 10 Jul 2026 12:42:17 +0000 (14:42 +0200)]
server: remove loading.html (#25500)

* server: remove loading.html

* apply ui changes

2 months agosync : ggml
Georgi Gerganov [Fri, 10 Jul 2026 10:10:49 +0000 (13:10 +0300)]
sync : ggml

2 months agoggml : use ggml_vqtbl1q_u8 for 32-bit compat (whisper/0)
Georgi Gerganov [Fri, 10 Jul 2026 08:06:42 +0000 (11:06 +0300)]
ggml : use ggml_vqtbl1q_u8 for 32-bit compat (whisper/0)

2 months agoserver: improve tools, remove apply_diff (#25498)
Xuan-Son Nguyen [Fri, 10 Jul 2026 09:52:59 +0000 (11:52 +0200)]
server: improve tools, remove apply_diff (#25498)

* server: improve tools, remove apply_diff

* improve edit tool

* add tools_io abstraction

* add tools_io_basic

* fix build

* move utils to class member

* add const

2 months agocli: fix crash on wrong server base url (#25497)
marcoStocchi [Fri, 10 Jul 2026 09:52:20 +0000 (11:52 +0200)]
cli: fix crash on wrong server base url (#25497)

* llama-cli: fix crash on wrong server base url by catching exceptions and graceful exit

* review: leaner catch group: json error and standard exception

2 months agoui: prevent tooltip from flickering open and closed on hover (#25503)
Pascal [Fri, 10 Jul 2026 09:49:52 +0000 (11:49 +0200)]
ui: prevent tooltip from flickering open and closed on hover (#25503)

2 months agosync : ggml (#25517)
Georgi Gerganov [Fri, 10 Jul 2026 07:28:39 +0000 (10:28 +0300)]
sync : ggml (#25517)

* ggml : bump version to 0.16.0 (ggml/1559)

* sync : ggml

2 months agoui: export full message tree instead of active path only (#25501)
Pascal [Fri, 10 Jul 2026 07:10:45 +0000 (09:10 +0200)]
ui: export full message tree instead of active path only (#25501)

downloadConversation serialized activeMessages, the root -> currNode
path, so exporting a conversation with edited or regenerated messages
dropped every alternate version and kept only the selected one.

Fetch the whole message tree via getConversationMessages so the export
carries all message versions, matching the multi-conversation export
path which already did this. Keep the active conversation as the header
source to preserve an up-to-date currNode.

Forks are separate conversations, each with its own convId, and are
exported on their own.

2 months agollama : make all KQ masks f16 if FA is used, remove zero attention bias, remove raw_k...
fairydreaming [Fri, 10 Jul 2026 07:06:58 +0000 (09:06 +0200)]
llama : make all KQ masks f16 if FA is used, remove zero attention bias, remove raw_k repeats in DeepSeek V4 (#25370)

* llama : make all KQ masks (except the lightning indexer one) f16 if FA is used and remove zero attention bias in DeepSeek V4

* llama : remove dead code that repeats unified raw_k cache for each stream in DeepSeek V4 - no longer needed as raw_k is always non-unified.

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agoggml-et: Initial ET backend (#24179)
Martin Chang [Fri, 10 Jul 2026 04:38:34 +0000 (12:38 +0800)]
ggml-et: Initial ET backend  (#24179)

* ggml-et: Add performance logging

* ggml-et: Quants helpers

* ggml-et: Add MUL_MAT kernel

* ggml-et: Add ROPE kernel

* ggml-et: Add RMS_NORM kernel

* ggml-et: Add GLU kernel

* ggml-et: Add SOFT_MAX kernel

* ggml-et: Add GET_ROWS kernel

* ggml-et: Add CONT kernel

* ggml-et: Add SET_ROWS kernel

* ggml-et: Add MUL_MAT_ID kernel

* ggml-et: Build et kernels as part of ggml

* ggml-et: Embed kernels with fs fallback

* ggml-et: Build fixes

* ggml-et: Add MUL_MAT F32xF32 op

* ggml_et: Add MUL_MAT_ID op

* ggml-et: Disable offloading for debug

* ggml-et: Refactor out block ops

* ggml-et: ggml backend API changes

* ggml-et: Add RESHAPE/TRANSPOSE to supported

* ggml-et: Add CONT_F16

* ggml-et: Add supported ops doc

* gglm-et: Initial doc

* ggml-et: Remove  runtime import hacks

We can now import the runtime by a simple find_package(), so we
can cleanup the CMakeLists.txt.

* ggml-et: Fix GET_ROWS kernel

Fix lost batch dimension.

Also clean vibe-comments.

* ggml-et: Fix SET_ROWS kernel

Remove incorrect broadcasting guard.

* ggml-et: Use custom instruction for fp32->fp16

* ggml-et: Vectorize set_rows fp32->fp16

* ggml-et: Fix ROPE kernel (yarn)

ggml-et: fix et_logf

WIP: Fix ramp

WIP: fix ROPE!

* ggml-et: Better sinf

* ggml-et: Fix SOFT_MAX

Add `max_bias` and `sink` support.

* ggml-et: Fix CONT

Reorder from contiguous write to read with atomic stores.

* ggml-et: Fix elmap kernel

Remainder handlin

* ggml-et: Fix MUL_MAT MUL_MAT_ID remainders

* ggml-et: Fix ET-SOC reference

* ggml-et: Fix embed kernels scripts for old python

This allows GGML-ET to build on pre-3.8 python.

* Add sysemu support with compile time flag `-DGGML_ET_SYSEMU=ON` (#6)

* Example using ET-Soc-1 emulator configuration

Example usage:
```bash
cmake -B build -DGGML_CUDA=OFF -DGGML_ET=ON -DLLAMA_CURL=OFF -DGGML_CCACHE=ON
cmake --build build --config Release -j $(nproc)

time ./build/bin/test-backend-ops

./build/bin/llama-server \
    --model Qwen3-0.6B-Q8_0.gguf \
    --alias Qwen3-0.6B-Q8_0 \
    -fa 0 \
    --ctx-size 1024 \
    --no-warmup \
    --host 127.0.0.1 \
    --port 8080
```

* build: proper dep tracking for kernels

* support host using MOLD linker

* initial multi core GET_ROW F32 implementation

* vectorized q8 dequant

* wip: cland warning clenaups and initial logging refactor

* wip: message default message cleanup

* chore: message cleanups

* cmake cleanup

* migrate to use platform provided functions

* cmake back into subdir

* support et_print() in kernels

* fix: repair kernel building

* perf: operations run async by default

* debug: proper kernel dep tracking and error detection on kenrel launch

* fix: kernel binary dep tracking and fixing get_rows_f32 erroring

* perf: back to doing async kernel runs by default

* perf: vectorize and parallel device memset

* merge matmul work

* misc: align allocation and enable all offload

* misc: delete deadcode and respect memory limits

* fix: repair tensor debug print

* fix: loosen RMS_NORM op percision

* feat: Q4_0 GET_ROWS

* perf: FP32 MUL_MAT using TensorFMA

* update limitations

* perf: redue L1 load in compute_block_dot_product_q8_0

* feat: save kernel mapping (name to id) when profiling is enabled

* chore: memops cleanup

* perf: parallelize softmax by rows

* perf: vectorize 2nd phase of softmax

* perf: ban GET_ROWS from offloaded

* perf: vectorize and non-atomic for eltwise ops and sub support

* perf: vectorize normal rope

* perf: glu runs in parallel

* merge: manually merge saqib's work on kernel fixes

* perf: more vectorized RoPE

* perf: parallelize mul_mat_id

* perf: parallelize set_rows_f32

* perf: vectorize softmax

* feat: support kernel fusion and fuse RMS_NORM + MUL

* fix: mostly resolve test-backend-ops failure in SOFT_MAX and ROPE

* fix: bump max rope dims for gemma

* feat: GeGLU and SCALE support to fully offload Gemma

* perf: faster device memset

* feat: get_rows supporting Q4_K and avoid cont cache coherent issues

* better F32 MM

* feat: NORM for ET backend

* feat: SQR for ET backend

* feat: UNARY on ET

* feat: el_map support broadcasting for ET

* feat: SUM_ROWS in ET backend

* feat: more ops in ET backend

* feat: WKV* operators in ET backend

* perf: parallelize operators across cacheline instead of row

* perf: parallelize get_rows on cacheline

* wip: baseline FlashAttention for ET backend

* wip: enough FA and CPY f32->f16 to run llama 3.1 fully offloaded with FA on

* feat: f16 x f16 -> f32 MM using matrix engine

* wip: f16 FlashAttention using matrix engine

* wip: clean up

* feat: barriers

* perf: optimize FA_F16 in ET

* perf: vectorize pack_k_for_transpose16

* perf: prefetch next loop matrix tile

* perf: FlashAttention 2nd MM uses TensorFMA and optimizations

* cleanup: flashattention reorg

* perf: optimizations and fixes

* feat: L2SCP API and make FlashAttention support DV = 256 for gemma

* perf: parallelize norms beyond single row

* feat: GATED_DELTA_NET support and relaxed L2_NORM requirment

* feat: loosen RMS_NORM, NORM, ROPE contingous req too

* feat: repeat supports brocasting on dim 0 and loosen cont check

* feat: FILL and DIAG operator

* feat: loosen UNARY support chcek

* feat: TRI support

* feat: SOLVE_TRI support

* feat: basic SET support

* feat: loosen CONT req

* perf: fp16_to_fp32 use ASM

* feat: IMROPE support

* feat: PAD support

* feat: global barrier

* fix: view must live on the same backend as backing tensor

* feat: relax CONCAT in ET backend

* feat: dead simple CUMSUM implementation

* feat: basic SSM_CONV support

* feat: loosen CONCAT req

* feat: relax GATED_DELTA_NET and add SET support proper

* cleanup: cleanup LCM math

* feat: SWIGLU single input

* feat: SSM_SCAN support

* feat: el_map supports non aligned tensors in best effort

* feat: basic GROUP_NORM support

* feat: loosen MUL_MAT capablities slightly

* feat: loosen MUL_MAT and GET_ROWS and add IM2COL

* feat: special case for softmax 1x1x1x1

* feat: loosen SOFT_MAX req in ET backend

* fix: el_map unaligned acse fixes

* perf: optimize zero_acc_vec in flash_attn_ext_f16_me

* perf: use hart 1 for packing in MM and FA for FP16

* feat: kernel semaphore

* perf: better instruction sequence in FlashAttention

* fix: gated_delta_net with proper masking

* perf: better parallelization for GATED_DELTA_NET

* perf: parallelize SSM_CONV over nr

* perf: vectorize SSM_CONV

* perf: optimize MUL_MAT for q8

* feat: support Gemma 4

* fix: support multi-device

* feat: broader GLU support

* feat: unary ops supports view

* fix: repair fp16 MM using matrix engine

* perf: handle large N GEMV better

* perf: better q8_0 MM

* perf: better set_rows

* add back deleted files

* fix: repair after merge

* feat: POC version of uberkernel

* feat: RMS_NORM in uberkernel

* feat: add more kernels into usage

* chore: clean up uberkernel compilation

* perf: faster flash attention

* perf: opt flash attention for large seq length

* feat: loosen op bounds. clamp and mean support

* perf: vectorize ssm_scan

* perf: slightly faster FA

* perf: FlashAttention parallel MM and load

* perf: fuse Q8 MM and ADD

* feat: basic conv kernel for ET

* softMAx_test

* set_rows_f32

* get_rows and cont

* testing

* set_rows_exp

* Junk addition

* Narrowing the issue

* Update flash_attn_ext_f16_me.c

Focusing FA_ext_f16_me

* test

* Eviction updated

* Detailed cache eviction debug

* mulmat

* removeal of `BUILD_FOR_UBERKERNEL` flag

* cleaning...

* fix: balance FCC0 count

* feat: implement mul_mat and mul_mat_id for Q4_0 type

* optimize uberkernel plan upload

* add mul_mat q4 into uberkernel

* enable gating flush to just uberkernel

* update docs for ET

* update op support for ET

* et-backend: optimize Q4_0 and Q8_0 mul_mat_id row accumulations

* et-backend: specialize mul_mat_id kernels for Q4_0 and Q8_0

* et-backend: fix RoPE YaRN corr_dim formula and handle degenerate inputs

* test-backend-ops: add DeepSeek-V2-Lite RoPE test coverage

* et-backend: add Q4_0 mul_mat matrix-engine kernel using TensorFMA32

* et-backend: vectorize Q4_0 matrix-engine dequantization

* et-backend: support hybrid matrix/vector engine execution for Q4_0 mul_mat tail

* et-backend: run partial-N tiles on matrix engine for Q4_0 mul_mat

* et-backend: route Q4_0 mul_mat N < 53 to vecdot for better prefill latency

* Update uberkernel.c

* Update unary_f32.c

* gemma 4

* bisect gemma4: enable scale_f32 only

* bisect gemma4: +rms_norm_f32

* bisect gemma4: +rms_norm_mul_f32

* bisect gemma4: disable rms_norm_mul_f32 -- BREAKS OUTPUT

* bisect gemma4: +rope_f32 (skip rms_norm_mul)

* bisect gemma4: +el_map_f32

* bisect gemma4: +softmax_f32

* bisect gemma4: +get_rows_f32

* bisect gemma4: +glu_f32

* bisect gemma4: +mul_mat_f32 +mul_mat_f32_matrix_engine

* bisect gemma4: +mul_mat_f16 +mul_mat_f16_matrix_engine

* bisect gemma4: +mul_mat_Q8_0 +mul_mat_Q4_0

* bisect gemma4: +flash_attn_ext_f32 +flash_attn_ext_f16_me

* bisect gemma4: +mul_mat_id_f32

* bisect gemma4: +sum_rows_f32

* bisect gemma4: +cont_f16

* bisect gemma4: +fill_f32

* bisect gemma4: +unary_f32 (all ops re-enabled except rms_norm_mul)

* Update rms_norm_mul_f32.c

* bisect2 gemma4 n64: +scale_f32 only

* bisect2 gemma4 n64: +rms_norm_f32 +rope_f32

* bisect2 gemma4 n64: +rms_norm_mul_f32 (with ET_UBERKERNEL eviction fix)

* bisect2 gemma4 n64: +el_map +get_rows +glu +softmax (skip rms_norm_mul)

* bisect2 gemma4 n64: all ops enabled except rms_norm_mul

* bisect2 n64: test unary+cont+fill+sum_rows (no mul_mat/flash_attn)

* bisect2 n64: +mul_mat_f32 +mul_mat_f32_matrix_engine

* bisect2 n64: +mul_mat_f16 +mul_mat_f16_matrix_engine

* bisect2 n64: +mul_mat_Q8_0 +mul_mat_Q4_0

* bisect2 n64: +mul_mat_Q8_0 only (disable Q4_0)

* bisect2 n64: +mul_mat_Q4_0 only (Q8_0 breaks)

* bisect2 n64: +mul_mat_id +flash_attn_ext (skip Q8_0)

* run-3: matmul + rms_norm_mul

* run-4

* Revert "run-4"

* run5

* changes after cleanup

* cleanup before upstream

* restrict changes into ET backend

* move kernel embedding from Python to CMake

* move uberkernel gen into CMake

* apply clang format

* update CMake style

* update to match C and C++ style

* use source ggml and quant headers instead of ET's

* MROPE support

* absorb view ops into same branch as none

* fix bad rebase

* add marty1885 to codeowners

* oops

* remove redundant newline

* fix CI editor warnings

---------

Co-authored-by: Vidas <redacted>
Co-authored-by: Gianluca Guida <redacted>
Co-authored-by: Gianluca Guida <redacted>
Co-authored-by: ubergarm <redacted>
Co-authored-by: SaqibAkram-10xE <redacted>
Co-authored-by: Rehan Qasim <redacted>
2 months agollama-batch: add unit test (#25471)
Aman Gupta [Fri, 10 Jul 2026 03:04:31 +0000 (11:04 +0800)]
llama-batch: add unit test (#25471)

* llama-batch: add unit test

* fix win32 builds

* add not implemented assertion in unused methods

* remove unreachable code

2 months agoopencl: cluster-parallel decode FA for Adreno (#25473)
Hongqiang Wang [Thu, 9 Jul 2026 18:13:48 +0000 (11:13 -0700)]
opencl: cluster-parallel decode FA for Adreno (#25473)

2 months agoggml : process data in smaller chunks in CUDA ggml_top_k() and ggml_argsort() to...
fairydreaming [Thu, 9 Jul 2026 18:07:12 +0000 (20:07 +0200)]
ggml : process data in smaller chunks in CUDA ggml_top_k() and ggml_argsort() to reduce temporary buffers memory usage (#24776)

* ggml : process data in smaller chunks in CUDA ggml_top_k() implementation to reduce temporary buffers memory usage

* ggml : allocate tmp_dst only only once before the loop

* chore : whitespaces

Co-authored-by: Georgi Gerganov <redacted>
* ggml : use chunked processing in both CUDA CUB top-k and argsort implementations

* chore : separate argsort_f32_i32_cuda_bitonic() call from return statement

Co-authored-by: Johannes Gäßler <redacted>
* chore : replace ternary operators with min/max

---------

Co-authored-by: Stanisław Szymczyk <redacted>
Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Johannes Gäßler <redacted>
2 months agocli: add --output option (#25484)
Xuan-Son Nguyen [Thu, 9 Jul 2026 17:37:39 +0000 (19:37 +0200)]
cli: add --output option (#25484)

2 months agohexagon: tiling, tracing and optimizations for unary ops (#25474)
Aparna M P [Thu, 9 Jul 2026 17:15:47 +0000 (22:45 +0530)]
hexagon: tiling, tracing and optimizations for unary ops (#25474)

* hexagon: tile wide rows in pointwise unary ops to avoid VTCM overflow

* unary: reject permuted tensors for now (not used by models)

* hex-unary: replace divs with fastdiv

* hex-unary: add vtcm layout and host computed kernel params

* hex-unary: move fastdiv init into kernel params

* hex-unary: add specialized thread functions to improve generated code

* hex-unary: tracing instrumentation for unary ops

* hex-unary: factor out hvx kernels, streamline and remove more duplication

* ggml-hexagon: fix std::min collision with Windows min macro

* hex-cmake: make lto build happy

---------

Co-authored-by: Max Krasnyansky <redacted>
2 months agoserver : move chat-template thinking probe inside the init try/catch (#24093)
Jesse LaRose [Thu, 9 Jul 2026 16:37:39 +0000 (12:37 -0400)]
server : move chat-template thinking probe inside the init try/catch (#24093)

A model whose chat template parses at init but fails parser generation
at apply time (e.g. uses {% call %}) throws std::invalid_argument from
common_chat_templates_support_enable_thinking(), which ran outside the
try/catch guarding common_chat_templates_init(). The throw was uncaught
and llama-cli aborted (SIGABRT) instead of failing to load. Moved the
probe inside that try/catch so an apply-time error fails load the same
way an init parse error does.

Signed-off-by: Jesse LaRose <redacted>
2 months agoggml : fix conv 2d dw (#25490)
Georgi Gerganov [Thu, 9 Jul 2026 14:56:32 +0000 (17:56 +0300)]
ggml : fix conv 2d dw (#25490)

2 months agometa: add hard emphasis on agents not writing descriptions/comments (#25480)
Piotr Wilkin (ilintar) [Thu, 9 Jul 2026 13:18:07 +0000 (15:18 +0200)]
meta: add hard emphasis on agents not writing descriptions/comments (#25480)

* meta: add hard emphasis on agents not writing descriptions/comments

Add a block in AGENTS.md to emphasize that agents are forbidden, under any circumstances, to post comments or pull request descriptions on behalf of the user.

* Add example

* Move examples to examples

* White space

2 months agoRefactor: Consistently use smart pointers in `test-backend-ops` (#25440)
Oliver Simons [Thu, 9 Jul 2026 13:00:17 +0000 (15:00 +0200)]
Refactor: Consistently use smart pointers in `test-backend-ops` (#25440)

* Use smart pointers in test_case::eval

This makes it consistent with other methods of `test_case`.

* Use smart pointer in show_test_coverage also

* Also use smart pointers for backends

2 months agoOnly index by compile times + always multiply/add (#25445)
Oliver Simons [Thu, 9 Jul 2026 11:23:57 +0000 (13:23 +0200)]
Only index by compile times + always multiply/add (#25445)

The first one avoids relying on compile to optimize local memory away,
and the second is cheaper than issuing control flow statements

2 months agollama-bench : init params.offline (#25476)
Adrien Gallouët [Thu, 9 Jul 2026 09:56:56 +0000 (11:56 +0200)]
llama-bench : init params.offline (#25476)

Signed-off-by: Adrien Gallouët <redacted>
2 months agometal : add CONV_2D_DW (depthwise convolution) support (#21565)
Sou-ly [Thu, 9 Jul 2026 09:29:15 +0000 (18:29 +0900)]
metal : add CONV_2D_DW (depthwise convolution) support (#21565)

* metal : add CONV_2D_DW (depthwise 2D convolution) support

* test : add perf cases for CONV_2D_DW

* metal : use 3D dispatch for CONV_2D_DW kernel

* metal : add channel-tiled CONV_2D_DW kernel for non-contiguous layouts

* metal : simplify CONV_2D_DW dispatch and trim comments

* metal : merge duplicate CONV_2D_DW pipeline getters

* tests : add F16 CONV2D_DW tests

* cpu : fix F16 kernel support for CONV_2D_DW

* tests : remove commented-out CONV_2D_DW test block

---------

Co-authored-by: Georgi Gerganov <redacted>
2 months agoggml-hip: enable -funsafe-math-optimizations (#24668)
RapidMark [Thu, 9 Jul 2026 08:02:26 +0000 (01:02 -0700)]
ggml-hip: enable -funsafe-math-optimizations (#24668)

CUDA is compiled with fast math and AMD/HIP is not — this flag lets AMD use fast math too.

We can't use -ffast-math: it implies -ffinite-math-only, which won't compile (ggml uses INFINITY for masking) and produces NaNs. -funsafe-math-optimizations gives the speedup without the NaN problems.

Co-authored-by: Mark Caldwell <redacted>
2 months agocuda: align snake fusion matcher with the other backends (#25460)
Pascal [Thu, 9 Jul 2026 08:00:06 +0000 (10:00 +0200)]
cuda: align snake fusion matcher with the other backends (#25460)

* cuda: fix snake fusion type predicate, a and inv_b are F32

The matcher required a->type == x->type while launch_snake reads both
as const float *, matching the CPU and Metal contract where a and inv_b
stay F32. F16/BF16 chains never fused and fell back to the naive path,
and a hypothetical all F16 chain would have read F16 bits as float.
Aligns the predicate and the comment with ggml-cpu.c

* cuda: reject snake fusion on non-contiguous operands

The kernel reads x[idx] and a[c] / inv_b[c] linearly, so a
non-contiguous view passing the matcher would silently read wrong data.
Mirror the contiguity guard already present in the CPU, Vulkan and
Metal matchers.

2 months agoserver : respect min-step when splitting prompt batches (#25420)
Aldehir Rojas [Thu, 9 Jul 2026 06:23:30 +0000 (01:23 -0500)]
server : respect min-step when splitting prompt batches (#25420)

2 months agohexagon: add VISION RoPE support (#25216)
Aparna M P [Thu, 9 Jul 2026 04:55:00 +0000 (10:25 +0530)]
hexagon: add VISION RoPE support (#25216)

* hexagon: add VISION RoPE support

* hexagon: support RoPE on strided half-dim views for all modes

* hex-rope: decouple src0 DMA copy size from row stride

* hex-rope: support non-contiguous dst for RoPE

* hex-rope: fix dst spad pitch for non-contiguous dst

2 months agoggml-webgpu: tune subgroup split (d_split) in flash_attn_vec (#25418)
Masashi Yoshimura [Wed, 8 Jul 2026 23:34:19 +0000 (08:34 +0900)]
ggml-webgpu: tune subgroup split (d_split) in flash_attn_vec (#25418)

2 months agoopencl: Q6_K GEMM/GEMV fix for ne01 of weights that are not multiples of 128. ...
Hongqiang Wang [Wed, 8 Jul 2026 22:52:21 +0000 (15:52 -0700)]
opencl:  Q6_K GEMM/GEMV fix for ne01 of weights that are not multiples of 128.  (#25464)

* opencl: fix garbled output for Q6_K weights with ne01 % 128 != 0 on Adreno

Observed with granite-3.1-3b-a800m-instruct, whose vocab is an odd number.

Route Q6_K dense mul_mat with ne01 % 128 != 0 off the noshuffle path:
decode (ne1==1) uses the correct flat GEMV and the matching GEMM (ne1>1)
falls back to CPU (the flat convert has no verified small-batch GEMM kernel
for these shapes). All standard hidden/FFN/vocab dims are multiples of 128
and keep the noshuffle path.

* opencl: reserve alignment slack for the SOA subbuffer carve in alloc size

set_tensor carves quantized weights into per-component subbuffers (d/q,
ql/qh/s/d, ...) whose origins are each rounded up to the device base
address alignment. When a component's size is not a multiple of the
alignment, the carve extends past ggml_nbytes(tensor) and the last
subbuffer overlaps the next tensor in the pool -- e.g. q6_K [1536, 49155]:
size_s = 49155*96 ends 32 bytes past a 128-byte boundary, so the d
subbuffer ends 96 bytes past the tensor's allocation, and whichever of the
two neighboring tensors is uploaded last silently corrupts the other (here:
the last vocab rows' block scales). This affects any quant type whose
component sizes can be misaligned, on any shape with ne01 not a multiple of
the alignment granularity; standard power-of-two dims are unaffected.

Implement get_alloc_size for the OpenCL buffer type and reserve the
worst-case carve slack (4 aligned gaps; 5 components max, q5_K) for
quantized tensors. Costs at most 512 bytes per quantized tensor at the
observed 128-byte alignment.

* opencl: use lm based q6_k mm when ne1 is not multiple of 128

---------

Co-authored-by: Li He <redacted>
2 months agovulkan: disable FA mask_opt on GCN to improve performance (#24362)
Ruben Ortlam [Wed, 8 Jul 2026 17:01:25 +0000 (19:01 +0200)]
vulkan: disable FA mask_opt on GCN to improve performance (#24362)

* vulkan: disable FA mask_opt on GCN to improve performance

* reenable mask opt over attention head size 256

2 months agoopencl: ragged-tile MoE prefill FP16 GEMM optimization (skip padded expert tiles...
Hongqiang Wang [Wed, 8 Jul 2026 16:44:55 +0000 (09:44 -0700)]
opencl: ragged-tile MoE prefill FP16 GEMM optimization (skip padded expert tiles) (#25433)

* opencl: ragged-tile MoE prefill GEMM (skip padded expert tiles)

The MoE prefill GEMM groups tokens into TILESIZE_N=32 per-expert tiles; at low
tokens-per-expert most tiles are mostly padding. When a tile's upper 16 slots
are all padding (router index 0xFFFFFFFF), skip the second dotx16_reduce8 half.
Numerically identical (skipped lanes are padding). Applied to all eight *_f32_ns
MoE GEMMs; default on, opt out with GGML_OPENCL_MOE_RAGGED_FP16=0.

* opencl: quarter-granularity ragged MoE tile-skip (8-col skip-groups)

Replace the two half-tile dotx16_reduce8 calls in the 8 *_f32_ns MoE GEMMs with
four dotx8_reduce4 (8-column) calls, skipping each empty trailing skip-group
independently. Padding is always trailing, so the kernel rounds the valid count
up to the skip granularity and skips fully-padding groups. Byte-identical to the
non-skipped path. New env GGML_OPENCL_MOE_RAGGED_GRAN={8,16,32} (quarter/half/
off); default quarter.

* opencl: move ragged moe env var in cl_init

---------

Co-authored-by: Li He <redacted>
2 months agollama-batch: fix allowed decreasing pos in a seq (#25449)
Aman Gupta [Wed, 8 Jul 2026 16:24:34 +0000 (00:24 +0800)]
llama-batch: fix allowed decreasing pos in a seq (#25449)

2 months agovulkan: for small AMD GPUs, reduce submission threshold based on CU count (#25240)
Ruben Ortlam [Wed, 8 Jul 2026 16:15:18 +0000 (18:15 +0200)]
vulkan: for small AMD GPUs, reduce submission threshold based on CU count (#25240)

2 months agohexagon: new vtcm layouts and improved pipelines for MUL_MAT, MUL_MAT_ID and FLASH_AT...
Max Krasnyansky [Wed, 8 Jul 2026 14:38:27 +0000 (07:38 -0700)]
hexagon: new vtcm layouts and improved pipelines for MUL_MAT, MUL_MAT_ID and FLASH_ATTN_EXT (#25425)

* hex-fa: refactor kernel param compute to use common layout builder

* hmx: add explicit compiler barriers to make hmx funcs more robust

* hex-vtcm: more generic vtcm layout builder for mm and flash-attn kernels

* hex-hmx: unroll inner kernels

* hex-hmx: use inline asm instead of intrinsics to avoid compiler issues

* hex-hmx: define inline asm macros and simplify code

* hex-hmx: replace leftover intrinsics

* hmx-fa: minor cleanup for hmx asm

* hmx-mm: move per-task stucts out of the kernels header

* hmx-mm: simplify core_dot_chunk

* hmx-mm: simplify inner loops that call hmx instructions

* hmx-mm: proper instrumentation for activation prep work for dma pipelined version

* hmx-mm: update a-prep loop for better prefetch

* hex-vtcm: improved vtcm layout alloc for mm to support overlapping areas

* hmx-mm: reduce the number of act fetch tows to 4 for now, going larger doesnt help here

* hex-hmx: always use hmx-queue in all modes

* hmx-mm: update comments and minor formatting

* hmx-mm: further improve synchro fallback path to prefetch the weights earlier

* hex-fa: further pipeline improvements (earlier prefetch)

* hmx-mm: cleanup dma pipelines to use dst cached in the queue

* hmx-fa: minor cleanup and opts for fa dma pipelines

* hmx-fa: optimize q-prep stage with dma and unrolling

* hmx-fa: use o_tile size from layout instead of computing it

* hmx-mm: cleanup types and size handling

* hmx-mm: replace divs with fastdiv in qprep loops

* hmx-fa: minor update/formatting to q_tile handling

* hmx-fa: cleanup the layout to avoid overpadding

* hmx-fa: simplified and improved cost mode for hmx fa solver that uses vtcm layout funcs

* hmx-queue: add support queue wakeup and make suspend async to avoid hmx-lock latency

* hex-hmx: move queue wakeup / suspend to the op-batch level

* hex-threads: add hybrid polling to workpool

* hex-mm: fix trailing spaces

2 months agocli : move to HTTP-based implementation (#24948)
Xuan-Son Nguyen [Wed, 8 Jul 2026 12:52:43 +0000 (14:52 +0200)]
cli : move to HTTP-based implementation (#24948)

* cli: move to HTTP-based implementation

* wip

* working

* remote server ok

* cli support router mode

Co-authored-by: Piotr Wilkin <redacted>
* case: router with only one model

* Apply suggestions from code review

Co-authored-by: Piotr Wilkin (ilintar) <redacted>
* remove outdated comment

* use destructor instead

* add ftype

* cli-view --> cli-ui

* pimpl

* no more json in header

* nits fixes

* also show model aliases

---------

Co-authored-by: Piotr Wilkin <redacted>
Co-authored-by: Piotr Wilkin (ilintar) <redacted>
2 months agoMake hip quality check run on all changes (#25403)
Oliver Simons [Wed, 8 Jul 2026 12:38:51 +0000 (14:38 +0200)]
Make hip quality check run on all changes (#25403)

Improvement of the CI to run on all hip-related changes as a follow-up to
https://github.com/ggml-org/llama.cpp/pull/25373
so breakage is more likely to be caught in future

2 months agocuda : add support for f16->f16 GGML_OP_SET_ROWS (#25367)
fairydreaming [Wed, 8 Jul 2026 11:24:20 +0000 (13:24 +0200)]
cuda : add support for f16->f16 GGML_OP_SET_ROWS (#25367)

2 months agollama: refactor fused ops (#24646)
Aman Gupta [Wed, 8 Jul 2026 10:18:09 +0000 (18:18 +0800)]
llama: refactor fused ops (#24646)

2 months agoserver-stream: follow-up on SSE Replay Buffer (#23226) (#25047)
Pascal [Wed, 8 Jul 2026 09:02:50 +0000 (11:02 +0200)]
server-stream: follow-up on SSE Replay Buffer (#23226) (#25047)

* server-stream : pimpl

* server-stream: prefix free functions with server_stream_

address review from ggerganov: scope the public stream functions under the
server_stream_ prefix, matching server_stream_session_manager_start/stop.

* server-stream: guard session and manager state with the mutex

address review from ggerganov: make done, completed_ts and the GC running flag plain members under their
mutex and set the condvar predicates under the lock. keep cancelled atomic for
the lock-free should_stop poll.

* server-stream: trim comments to the non-obvious

address review from ggerganov: drop comments that restate the code, keep the
concurrency, lifetime and ordering rationale. de-stale a few comments left by the
pimpl: g_stream_sessions is now internal and the /v1/streams listing is gone.

* server-stream: update dev docs for the pimpl and prefix

reflect server_stream_session_manager_start/stop and the server_stream_ prefix,
note the manager is now a file-static singleton hidden in the .cpp

* server-stream: move stream traces to debug level

keep the bring-up traces for diagnostics but off the default log: skip
drain, draining, drain ended, DELETE evict, attach_pipe, and the router
stream resume proxy.

* server-stream: align router stream resume proxy trace with upstream

the child-side bring-up traces are already SRV_TRC on master, move the
router stream resume proxy trace to the same level.

* server-stream: move stream_read_status enum to the cpp

it is only used by the hidden session and consumer types, so it belongs
with them behind the pimpl boundary, not on the public header surface.

---------

Co-authored-by: Georgi Gerganov <redacted>
2 months agollama-batch: add n_keep_tail in split_equal for recurrent models (#25278)
Aman Gupta [Wed, 8 Jul 2026 07:55:19 +0000 (15:55 +0800)]
llama-batch: add n_keep_tail in split_equal for recurrent models (#25278)

2 months agocommon: auto-create prompts-log-dir at argument parsing, so all tools using the flag...
rankaiyx [Wed, 8 Jul 2026 07:45:28 +0000 (15:45 +0800)]
common: auto-create prompts-log-dir at argument parsing, so all tools using the flag benefit (#25322)

2 months agoui: Context usage gauge and panel (#25340)
Aleksander Grygier [Wed, 8 Jul 2026 07:22:35 +0000 (09:22 +0200)]
ui: Context usage gauge and panel (#25340)

* feat: WIP

* feat: Retire ChatScreenProcessingInfo component, context, and keepStatsVisible settings

* feat: Always-on gauge with active-model /props, conversation stats and live-reactive reading/output/avg

* feat: Add /tokenize endpoint, TokenizeService, FNV-1a and JSON Schema utilities

* feat: Surface enabled-tools token count in context hover card

* refactor(tools): make toolsStore the sole owner of the OpenAI wire format

Previously mcpStore.getToolDefinitionsForLLM() owned the MCP->OpenAI
shape conversion (plus normalizeSchemaProperties). That created two
sources of truth for what gets sent to the LLM, with the
duplication-prone risk of the deduplicated enabled list (which feeds
the token-count cache) drifting from the bytes actually shipped on
chat.

Now:
- mcpStore: pure protocol state + routing. Drop getToolDefinitionsForLLM
  and the inline OpenAIToolDefinition conversion + normalizeSchemaProperties.
  Doc comment adjusted to declare wire-format ownership as belonging
  to toolsStore. Connection lifecycle, health checks, executeTool,
  and the connections/toolsIndex remain.
- toolsStore: owns the wire shape (added earlier this series). mcpEntries()
  inlines the MCP tool conversion; uses normalizeJsonSchema (the JSON
  Schema util extracted in the prior commit) so missing 'type' fields
  are inferred from defaults. mcpTools getter iterates mcpEntries() so
  the Settings UI and the deduplicated enabled list see the same
  definitions. getEnabledToolsForLLM iterates mcpEntries() instead of
  calling mcpStore, so the JSON sent to the LLM is identical to what
  toolsStore.refreshEnabledToolsTokenCount tokenizes.
- agentic: the chat-completion tools field's type was annotated as
  ReturnType<typeof mcpStore.getToolDefinitionsForLLM>, claiming the
  shape was owned by mcpStore. Switch to ReturnType<typeof
  toolsStore.getEnabledToolsForLLM>, the actual source.

Assisted-by: Claude
* feat: UI WIP

* feat: UI WIP

* feat: UI WIP

* feat: Adjust reasoning submenu layout and spacing

* feat: Adjust context usage gauge thresholds and styling

* feat: Split context usage gauge stats into current and cumulative breakdowns

* chore: Format

* refactor: Cleanup

* refactor: Cleanup

* feat: improve token gauge accuracy and display

* refactor: remove MCP recommendation gating and simplify server visibility

* feat: add token audit logging to ChatStore for debugging

* refactor: Simplify context token reading to use server promptTokens directly

* feat: Replace last-known token tracking with live server-derived stats for accurate streaming gauges

* feat: UI Improvements

* feat: Move prompt processing stats to the preceding user message

* feat: Fix context token double-counting and refine gauge layout

* refactor: remove always-show-agentic-turns setting and simplify agentic turn display

* feat: track and display cache tokens in context gauge

* feat: add diagnostic logging for chat completion requests

* refactor: improve token audit console output with fresh/cached breakdown

* fix: invalidate enabled tools token count cache on tool changes

* test: add unit tests for tools store token count invalidation

* refactor: Remove tools token counting infrastructure

* refactor: Update ChatFormContextGauge to use simplified token tracking

* refactor: Update ChatStore to remove tools token counting

* chore: Formatting

* feat: Improve UI text

* feat: simplify context usage derivation and refine gauge labels

* refactor: cleanup logs

* cleaning

* fix: UI

* refactor: Enums

* refactor: Extract context gauge logic into hook and split UI into sub-components

* refactor: Cleanup comments

---------

Co-authored-by: Pascal <redacted>
2 months agollama-eval : fix crash when answer is None in HTML dump (#25435)
Georgi Gerganov [Wed, 8 Jul 2026 07:00:03 +0000 (10:00 +0300)]
llama-eval : fix crash when answer is None in HTML dump (#25435)

dict.get("key", default) returns None (not default) when the key
exists but its value is explicitly None. This caused an AttributeError
in _escape_html() when a task errored before grading and answer was
set to None.

Assisted-by: pi:llama.cpp/Qwen3.6-27B
2 months agometal : add set_rows with src0 f16 (#25434)
fairydreaming [Wed, 8 Jul 2026 06:49:07 +0000 (08:49 +0200)]
metal : add set_rows with src0 f16 (#25434)

Co-authored-by: Georgi Gerganov <redacted>
2 months agofix: OOB reads in UGM tokenizer (precompiled_charsmap handling) (#18750)
hourhl [Wed, 8 Jul 2026 05:02:09 +0000 (13:02 +0800)]
fix: OOB reads in UGM tokenizer (precompiled_charsmap handling) (#18750)

* fix: OOB reads in UGM tokenizer (precompiled_charsmap handling)

- Validate minimum size (4 bytes) before reading xcda_blob_size
- Use strnlen with bounds check instead of unsafe strlen

Both issues allow heap-buffer-overflow from malicious T5/UGM GGUF files.

* Replace unsafe strnlen() with a bounds-checked loop that scans for \0 within the remaining array size.

* move bounds checks to load

* typo merge fix

---------

Co-authored-by: hourhl <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agoggml : fix A indexing in simd_gemm scalar tail-column path (#25390)
tyronecai [Wed, 8 Jul 2026 05:00:05 +0000 (13:00 +0800)]
ggml : fix A indexing in simd_gemm scalar tail-column path (#25390)

`simd_gemm()` has an incorrect A-matrix index in the scalar tail-column path for full row blocks.

2 months agoggml : add support for CPU f16->f16 GGML_OP_SET_ROWS (#25344)
fairydreaming [Wed, 8 Jul 2026 03:46:28 +0000 (05:46 +0200)]
ggml : add support for CPU f16->f16 GGML_OP_SET_ROWS (#25344)

* ggml : add support for CPU f16->f16 GGML_OP_SET_ROWS

* ggml : add missing type checks in f16 GGML_OP_SET_ROWS

* ggml : merge ggml_compute_forward_set_rows_f32() and ggml_compute_forward_set_rows_f16() into ggml_compute_forward_set_rows_impl()

* chore : replace assert() with GGML_ASSERT()

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agoopencl: fix potential crash in aos reconstruct (#25383)
lhez [Wed, 8 Jul 2026 03:34:29 +0000 (20:34 -0700)]
opencl: fix potential crash in aos reconstruct (#25383)

2 months agoAdd Q2_0 quantization: type definition and CPU backend (#24448)
Pasha Khosravi [Tue, 7 Jul 2026 19:05:47 +0000 (12:05 -0700)]
Add Q2_0 quantization: type definition and CPU backend (#24448)

2 months agospec : fix naming, spacing (#25410)
Georgi Gerganov [Tue, 7 Jul 2026 15:52:30 +0000 (18:52 +0300)]
spec : fix naming, spacing (#25410)

2 months agoCUDA: Fuse MMVQ post-scale for NVFP4 (#24481)
Oliver Simons [Tue, 7 Jul 2026 15:12:19 +0000 (17:12 +0200)]
CUDA: Fuse MMVQ post-scale for NVFP4 (#24481)

* CUDA: Fuse MMVQ for NVFP4 and BS 1

TODO:
1. Add tests to test-backend-ops (did verify correctness manually for
   one model)
2. Reorder bias/scale once PRs for NVFP4 are merged/landed

* Add dense MMVQ fusion as well

Perf numbers on B4500. Note qwen35 is FP8->Q8
+ ./scripts/compare-llama-bench.py -b master -c osimons/nvfp4_fuse_mmvq --tool llama-bench -i llama-bench.sqlite
| Model                    | Test         |   t/s master |   t/s osimons/nvfp4_fuse_mmvq |   Speedup |
|:-------------------------|:-------------|-------------:|------------------------------:|----------:|
| qwen35moe 35B.A3B NVFP4  | tg128@d32768 |       150.15 |                        156.29 |      1.04 |
| qwen35moe 35B.A3B Q4_K_M | tg128@d32768 |       157.91 |                        157.64 |      1.00 |

Perf numbers on DGX Spark
+ ./scripts/compare-llama-bench.py -b master -c osimons/nvfp4_fuse_mmvq --tool llama-bench -i llama-bench.sqlite
| Model                    | Test         |   t/s master |   t/s osimons/nvfp4_fuse_mmvq |   Speedup |
|:-------------------------|:-------------|-------------:|------------------------------:|----------:|
| qwen35moe 35B.A3B NVFP4  | tg128@d32768 |        58.31 |                         59.69 |      1.02 |
| qwen35moe 35B.A3B Q4_K_M | tg128@d32768 |        54.94 |                         54.79 |      1.00 |

* Add tests for the added fusion ops

* Cleanup test-backend-ops

* Cleanup ggml-cuda/mmvq

1. Unrestrict post-scale fusion
2. Rename names accordingly
3. Remove env variable to disable fusion

* Merge old mul_mat patterns into the lane-based approach

* Enable fusion for MoE in shared MMVQ

* Restrict scale_view_nodes, enroll MM + ADD into lane-matcher

* Refactor mmvq loads, still does not help non-nvfp4 kernels

* Restrict scale-fusion to NVFP4

This is necessary, as the prolog is quite heavy in GEMV for some
quants/model configs, leading to net perf regression.
We should really be looking to refactor this such that ratio of
prologue/hot-loop/epilogue is better on the hot-loop
front:

+ ./scripts/compare-llama-bench.py -b master -c c1b9381d327e063cc846b46b59708444b66dc4d8 --tool llama-bench -i llama-bench.sqlite
| CPU                         | Model                    | Test         |   t/s master |   t/s c1b9381d3 |   Speedup |
|:----------------------------|:-------------------------|:-------------|-------------:|----------------:|----------:|
| INTEL(R) XEON(R) GOLD 6542Y | gemma4 26B.A4B NVFP4     | tg128@d32768 |       151.70 |          154.32 |      1.02 |
| INTEL(R) XEON(R) GOLD 6542Y | gemma4 26B.A4B Q4_K_M    | tg128@d32768 |       187.95 |          185.73 |      0.99 |
| INTEL(R) XEON(R) GOLD 6542Y | gpt-oss 20B MXFP4 MoE    | tg128@d32768 |       304.62 |          300.69 |      0.99 |
| INTEL(R) XEON(R) GOLD 6542Y | qwen35moe 35B.A3B NVFP4  | tg128@d32768 |       193.72 |          211.99 |      1.09 |
| INTEL(R) XEON(R) GOLD 6542Y | qwen35moe 35B.A3B Q4_K_M | tg128@d32768 |       217.76 |          218.15 |      1.00

* Reorder scale & bias-add to adhere to #24331

* Restrict lane scale to NVFP4

Don't need to test unfused combinations

* Cleanup

* Merge single-lane mm-fusion helpers

* Refactor and clean-up host-side fusion logic

* Move gate_bias and scale into the same active-thread guard

Latest perf numbers:
B6000

build: 5b7d9f272 (9578)
+ ./scripts/compare-llama-bench.py -b master -c osimons/nvfp4_fuse_mmvq --tool llama-bench -i llama-bench.sqlite
| CPU                         | Model                    | Test         |   t/s master |   t/s osimons/nvfp4_fuse_mmvq |   Speedup |
|:----------------------------|:-------------------------|:-------------|-------------:|------------------------------:|----------:|
| INTEL(R) XEON(R) GOLD 6542Y | gemma4 26B.A4B NVFP4     | tg128@d32768 |       151.79 |                        154.10 |      1.02 |
| INTEL(R) XEON(R) GOLD 6542Y | gemma4 26B.A4B Q4_K_M    | tg128@d32768 |       187.90 |                        187.27 |      1.00 |
| INTEL(R) XEON(R) GOLD 6542Y | gpt-oss 20B MXFP4 MoE    | tg128@d32768 |       303.77 |                        306.56 |      1.01 |
| INTEL(R) XEON(R) GOLD 6542Y | qwen35moe 35B.A3B NVFP4  | tg128@d32768 |       193.41 |                        207.99 |      1.08 |
| INTEL(R) XEON(R) GOLD 6542Y | qwen35moe 35B.A3B Q4_K_M | tg128@d32768 |       217.60 |                        218.58 |      1.00 |

DGX Spark

build: 5b7d9f272 (9578)
+ ./scripts/compare-llama-bench.py -b master -c osimons/nvfp4_fuse_mmvq --tool llama-bench -i llama-bench.sqlite
| CPU   | Model                    | Test         |   t/s master |   t/s osimons/nvfp4_fuse_mmvq |   Speedup |
|:------|:-------------------------|:-------------|-------------:|------------------------------:|----------:|
| CPU   | gemma4 26B.A4B NVFP4     | tg128@d32768 |        34.61 |                         34.84 |      1.01 |
| CPU   | gemma4 26B.A4B Q4_K_M    | tg128@d32768 |        46.95 |                         46.90 |      1.00 |
| CPU   | gpt-oss 20B MXFP4 MoE    | tg128@d32768 |        64.84 |                         64.62 |      1.00 |
| CPU   | qwen35moe 35B.A3B NVFP4  | tg128@d32768 |        59.63 |                         60.72 |      1.02 |
| CPU   | qwen35moe 35B.A3B Q4_K_M | tg128@d32768 |        56.53 |                         56.55 |      1.00 |

PPL values for 5 chunks:
this PR

model                                                                                                       mode             ppl         uncertainty  log
/mnt/share/gguf/unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf                                 fusion_enabled   5.2892      0.35389      ppl-value-checks/Qwen3.6-35B-A3B-UD-Q4_K_M.fusion_enabled.log
/mnt/share/gguf/unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf                                 fusion_disabled  5.2742      0.35215      ppl-value-checks/Qwen3.6-35B-A3B-UD-Q4_K_M.fusion_disabled.log
/mnt/share/gguf/nvidia/Qwen3.6-35B-A3B-2.06GB-per-token-CT/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.gguf  fusion_enabled   5.4487      0.36866      ppl-value-checks/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.fusion_enabled.log
/mnt/share/gguf/nvidia/Qwen3.6-35B-A3B-2.06GB-per-token-CT/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.gguf  fusion_disabled  5.4403      0.36782      ppl-value-checks/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.fusion_disabled.log
/mnt/share/gguf/nvidia/Gemma-4-26B-A4B-NVFP4/Gemma-4-26B-A4B-NVFP4_fp8_q8.gguf                              fusion_enabled   17342.4348  3703.13932   ppl-value-checks/Gemma-4-26B-A4B-NVFP4_fp8_q8.fusion_enabled.log
/mnt/share/gguf/nvidia/Gemma-4-26B-A4B-NVFP4/Gemma-4-26B-A4B-NVFP4_fp8_q8.gguf                              fusion_disabled  18627.0624  3998.42475   ppl-value-checks/Gemma-4-26B-A4B-NVFP4_fp8_q8.fusion_disabled.log
/mnt/share/gguf/ggml-org/gpt-oss-20b-GGUF/gpt-oss-20b-mxfp4.gguf                                            fusion_enabled   363.8913    33.14007     ppl-value-checks/gpt-oss-20b-mxfp4.fusion_enabled.log
/mnt/share/gguf/ggml-org/gpt-oss-20b-GGUF/gpt-oss-20b-mxfp4.gguf                                            fusion_disabled  363.8913    33.14007     ppl-value-checks/gpt-oss-20b-mxfp4.fusion_disabled.log
/mnt/share/gguf/unsloth/gemma-4-26B-A4B-it-GGUF/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf                          fusion_enabled   17330.3926  3716.70472   ppl-value-checks/gemma-4-26B-A4B-it-UD-Q4_K_XL.fusion_enabled.log
/mnt/share/gguf/unsloth/gemma-4-26B-A4B-it-GGUF/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf                          fusion_disabled  17933.9524  3883.17066   ppl-value-checks/gemma-4-26B-A4B-it-UD-Q4_K_XL.fusion_disabled.log

master:
summary: ppl-value-checks/summary.tsv
model                                                                                                       mode             ppl         uncertainty  log
/mnt/share/gguf/unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf                                 fusion_enabled   5.2892      0.35389      ppl-value-checks/Qwen3.6-35B-A3B-UD-Q4_K_M.fusion_enabled.log
/mnt/share/gguf/unsloth/Qwen3.6-35B-A3B-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf                                 fusion_disabled  5.2742      0.35215      ppl-value-checks/Qwen3.6-35B-A3B-UD-Q4_K_M.fusion_disabled.log
/mnt/share/gguf/nvidia/Qwen3.6-35B-A3B-2.06GB-per-token-CT/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.gguf  fusion_enabled   5.4487      0.36866      ppl-value-checks/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.fusion_enabled.log
/mnt/share/gguf/nvidia/Qwen3.6-35B-A3B-2.06GB-per-token-CT/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.gguf  fusion_disabled  5.4403      0.36782      ppl-value-checks/Qwen3.6-35B-A3B-2.06GB-per-token-CT_fp8_q8.fusion_disabled.log
/mnt/share/gguf/nvidia/Gemma-4-26B-A4B-NVFP4/Gemma-4-26B-A4B-NVFP4_fp8_q8.gguf                              fusion_enabled   17342.4348  3703.13932   ppl-value-checks/Gemma-4-26B-A4B-NVFP4_fp8_q8.fusion_enabled.log
/mnt/share/gguf/nvidia/Gemma-4-26B-A4B-NVFP4/Gemma-4-26B-A4B-NVFP4_fp8_q8.gguf                              fusion_disabled  18627.0624  3998.42475   ppl-value-checks/Gemma-4-26B-A4B-NVFP4_fp8_q8.fusion_disabled.log
/mnt/share/gguf/ggml-org/gpt-oss-20b-GGUF/gpt-oss-20b-mxfp4.gguf                                            fusion_enabled   363.8913    33.14007     ppl-value-checks/gpt-oss-20b-mxfp4.fusion_enabled.log
/mnt/share/gguf/ggml-org/gpt-oss-20b-GGUF/gpt-oss-20b-mxfp4.gguf                                            fusion_disabled  363.8913    33.14007     ppl-value-checks/gpt-oss-20b-mxfp4.fusion_disabled.log
/mnt/share/gguf/unsloth/gemma-4-26B-A4B-it-GGUF/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf                          fusion_enabled   17330.3926  3716.70472   ppl-value-checks/gemma-4-26B-A4B-it-UD-Q4_K_XL.fusion_enabled.log
/mnt/share/gguf/unsloth/gemma-4-26B-A4B-it-GGUF/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf                          fusion_disabled  17933.9524  3883.17066   ppl-value-checks/gemma-4-26B-A4B-it-UD-Q4_K_XL.fusion_disabled.log

* Allow views to weights in ggml_can_fuse_subgraph

* Remove gate_first from test_mul_mat_vec_fusion

* Ditch lane-parsing approach in favor of hard-coded patterns

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <redacted>
* Rename ggml_is_constant_view_src to ggml_is_constant

* Finish renaming of 0905129e9d12e2bc6f16d6d3cc4e6b40606fc893

* Readd descriptive prints for fusion debugging

* Add weight-buffer pre-allocation to `test_case`

This is required so we correctly test fusion of NVFP4.

* Update ggml/src/ggml.c

Co-authored-by: Johannes Gäßler <redacted>
* Add 2nd context for weights as suggested by @JohannesGaessler

This reflects more natural use of ggml compared to artifically
pre-allocating weights into the same context

* Exclude fused tests from gradient mode

I'm unsure of the current state, but naively every fusion pattern
should require its own backpropagation implementation. I don't see these
implemented for the CUDA backend, so we can disable tests to avoid
triggering GGML_ASSERT for

    ggml_tensor * build_graph(ggml_context * ctx) override {
        GGML_ASSERT(!use_weight_context());
        return build_graph(ctx, nullptr);
    }

* Apply suggestions from code review

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

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Johannes Gäßler <redacted>
2 months agoserver : fix draft model fit vs load inconsistency (#25056)
Alex [Tue, 7 Jul 2026 14:20:42 +0000 (10:20 -0400)]
server : fix draft model fit vs load inconsistency (#25056)

* fix: draft model fit vs load inconsistency

* refactor(server): unify draft/mtp parameter initialization, model, and context load
- moves speculative init to speculative.cpp
- changes server_context_impl model_dft and ctx_dft to use raw pointers

- fix: don't throttle progress callback when loading draft model
- refactor: rename draft model/ctx load method

* fix: valign

2 months agoserver : add timings and progress to /responses API stream (#25348)
Thomas LECONTE [Tue, 7 Jul 2026 14:13:03 +0000 (16:13 +0200)]
server : add timings and progress to /responses API stream (#25348)

2 months agoserver: enforce prompt cache RAM limit (#25070)
Thiago Padilha [Tue, 7 Jul 2026 13:24:35 +0000 (10:24 -0300)]
server: enforce prompt cache RAM limit (#25070)

Before this commit, --cache-ram was not a hard limit:

- The cache always kept at least one entry, even if that entry exceeded the
  RAM/token limits.
- Old entries were only evicted for the RAM/token limits after saving the new
  one, which could cause the cache to temporarily exceed the RAM/token limits
  even if individual entries were below the limit.

Now, ensure that the RAM limit is strict with these changes:

- Skip saving state to cache if by itself it exceeds the RAM limit.
- Evict old entries as necessary to make the new entry fit.

Additionally, token-limit cleanup may now evict the last remaining cache entry
instead of always preserving one.

2 months agocommon : add missing <fstream> include in common.h (#25220)
zhangrunda [Tue, 7 Jul 2026 13:23:53 +0000 (21:23 +0800)]
common : add missing <fstream> include in common.h (#25220)

Signed-off-by: zhangrunda <redacted>
2 months agoggml-hip : add -fno-finite-math-only alongside -ffast-math (#25373)
asf0 [Tue, 7 Jul 2026 11:27:50 +0000 (05:27 -0600)]
ggml-hip : add -fno-finite-math-only alongside -ffast-math (#25373)

-ffast-math implies -ffinite-math-only under ROCm/clang 22, which
disables INFINITY/NaN and triggers -Wnan-infinity-disabled (errors
under -Werror in CI). Re-enable infinity handling without dropping
the rest of fast-math.

Fixes #25361

2 months agollama: fix quantized kv-cache for dsv4 (#25202)
Aman Gupta [Tue, 7 Jul 2026 09:46:57 +0000 (17:46 +0800)]
llama: fix quantized kv-cache for dsv4 (#25202)

2 months ago[SYCL] fix unsupported UT cases of CONT & CPY (#25231)
Neo Zhang [Tue, 7 Jul 2026 09:20:52 +0000 (17:20 +0800)]
[SYCL] fix unsupported UT cases of CONT & CPY (#25231)

* fix unsupported UT cases of CONT & CPY

* update ops.md

* rm unused head file

2 months ago[SYCL] support op col2im_1d (#25264)
Neo Zhang [Tue, 7 Jul 2026 08:07:46 +0000 (16:07 +0800)]
[SYCL] support op col2im_1d (#25264)

* support op col2im_1d

* update ops.md

* rm unused words

* update for bf16

* optimize 1%-11% as the review comments

* fix the format issue

* update as the review comments

2 months ago[SYCL] support OP cross_entropy_loss, cross_entropy_loss_back (#25236)
Neo Zhang [Tue, 7 Jul 2026 07:48:50 +0000 (15:48 +0800)]
[SYCL] support OP cross_entropy_loss, cross_entropy_loss_back (#25236)

* support OP cross_entropy_loss, cross_entropy_loss_back

* correct format issue

2 months agosycl : set K_QUANTS_PER_ITERATION to 1 on DMMV path (#25063)
Todd Malsbary [Tue, 7 Jul 2026 07:43:41 +0000 (00:43 -0700)]
sycl : set K_QUANTS_PER_ITERATION to 1 on DMMV path (#25063)

* sycl: add supported types to ggml_sycl_supports_reorder_dmmv

The reordered feature is implemented in ggml_sycl_op_dequantize_mul_mat_vec,
but gated by ggml_sycl_supports_reorder_dmmv. This commit fixes the gate.

Signed-off-by: Todd Malsbary <redacted>
* sycl: set K_QUANTS_PER_ITERATION=1 to improve utilization

When combined with opening the reorder gate, this improves GPU
utilization on B70, giving a significant boost to tg t/s.

Signed-off-by: Todd Malsbary <redacted>
* sycl: replace QK_WARP_SIZE with WARP_SIZE for QK_5

Signed-off-by: Todd Malsbary <redacted>
* sycl: add missing types to ggml_backend_sycl_buffer_init_tensor

Without this, the extra field is not allocated and the reorder path
will not take effect.

Signed-off-by: Todd Malsbary <redacted>
---------

Signed-off-by: Todd Malsbary <redacted>
2 months ago[SYCL] fix unsupport ACC UT cases for noncontiguous (#25124)
Neo Zhang [Tue, 7 Jul 2026 07:40:38 +0000 (15:40 +0800)]
[SYCL] fix unsupport ACC UT cases for noncontiguous (#25124)

* fix unsupport ACC UT cases for noncontiguous

* update ops.md

2 months agosycl : enhance argsort to support all UT cases (#25125)
Neo Zhang [Tue, 7 Jul 2026 07:39:29 +0000 (15:39 +0800)]
sycl : enhance argsort to support all UT cases (#25125)

2 months agosycl : use sycl func to fix AOT double type issue (#25081)
Neo Zhang [Tue, 7 Jul 2026 07:38:33 +0000 (15:38 +0800)]
sycl : use sycl func to fix AOT double type issue (#25081)

2 months agosycl : rename the env vars from "disable" to "enable" (#25042)
Neo Zhang [Tue, 7 Jul 2026 07:33:51 +0000 (15:33 +0800)]
sycl : rename the env vars from "disable" to "enable" (#25042)

2 months agoggml : make ggml_time_init idempotent (#24422)
An Long [Tue, 7 Jul 2026 07:29:17 +0000 (16:29 +0900)]
ggml : make ggml_time_init idempotent (#24422)

2 months agospeculative : fix out-of-bounds read in ngram-map on prompt shrink (#23936)
o7si [Tue, 7 Jul 2026 07:25:04 +0000 (15:25 +0800)]
speculative : fix out-of-bounds read in ngram-map on prompt shrink (#23936)

* speculative : fix out-of-bounds read in ngram-map on prompt shrink

* speculative : fix ngram-map cleanup cutoff after prompt shrink

2 months agovulkan : check src0 type in GGML_OP_SET_ROWS to avoid failures due to unimplemented...
fairydreaming [Tue, 7 Jul 2026 04:56:02 +0000 (06:56 +0200)]
vulkan : check src0 type in GGML_OP_SET_ROWS to avoid failures due to unimplemented f16 support (#25351)

* vulkan : check src0 type in GGML_OP_SET_ROWS to avoid failures due to unimplemented f16 support

* chore : get rid of else

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agoopencl: general flash attention decode performance optimizations (#25366)
Hongqiang Wang [Tue, 7 Jul 2026 02:57:52 +0000 (19:57 -0700)]
opencl: general flash attention decode performance optimizations (#25366)

* opencl: vec flash-attention decode kernels for f16/q8_0/q4_0 KV

* opencl: improve non FA KQ mv kernels

* opencl: tweaks for multiquery FA

* opencl: some tweaks for FA q1 kernels

* opencl: FA with DK=DV=512 for gemma-4

* opencl: various fixes

* opencl: cleanup

* opencl: fix FA decode crash for DK=512 (gemma-4)

The DK=512 decode-only program does not create the f32_f16 prefill
kernel, so the compiled check in ensure_fa_variant never hit and
supports_op gave inconsistent answers for the same op. block_n is also
unset for DK=512 decode; guard it to avoid an out-of-range read at
dispatch.

* opencl: run DK=512 FA decode on CPU

DK=512 decode is bandwidth-bound and faster on the CPU than the GPU,
increasingly so with depth. Decline it in supports_op; prefill stays on the GPU.

* opencl: compile MQ_GQA=8 FA kernels in a minimal program

The full program compiled with -D MQ_GQA=8 runs the Adreno compiler out
of memory at DK>=256. Only the vec_mq kernels are used from this
program, so compile it with FA_MQ_ONLY, which excludes everything else.
Also include the program name in the compile error log.

* opencl: remove stray token in flash_attn_f32_f16.cl

A stray "." broke the f32_f16 program build.

* opencl: split f16-KV FA decode finer (FD_KV_PER_SPLIT_F16)

The 2048 default under-fills the GPU on single-query f16-KV decode;
use 512 for f16 KV to get more splits. Quantized KV keeps 2048.

---------

Co-authored-by: Li He <redacted>
2 months agocommon: Set optimal default thread count for ppc ( linux as well as AIX) (#25237)
shalinib-ibm [Mon, 6 Jul 2026 21:35:20 +0000 (03:05 +0530)]
common: Set optimal default thread count for ppc ( linux as well as AIX) (#25237)

2 months agometal: add col2im_1d op (f32/f16/bf16) (#25176)
Pascal [Mon, 6 Jul 2026 18:47:36 +0000 (20:47 +0200)]
metal: add col2im_1d op (f32/f16/bf16) (#25176)

* metal: add col2im_1d op (f32/f16/bf16)

Gather kernel mirroring the CPU/CUDA path: each output (t_out, oc)
reads its ceil(K/s0) source columns with an F32 accumulator, a single
write and no atomics. One thread per output element, 256 per
threadgroup.

* metal: check dst contiguity and type match in supports_op for COL2IM_1D

Align the GGML_OP_COL2IM_1D predicate with the CPU, CUDA, and Vulkan
backends: the kernel writes dst with linear indexing and assumes the
same type as src0, so supports_op must also require a contiguous dst
and op->type == op->src[0]->type.

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

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

Co-authored-by: YiChen Lv <redacted>
2 months agoCUDA: remove -sm row, refactor cuBLAS (#24216)
Johannes Gäßler [Mon, 6 Jul 2026 18:04:53 +0000 (20:04 +0200)]
CUDA: remove -sm row, refactor cuBLAS (#24216)

* CUDA: remove -sm row, refactor cuBLAS

* fix CDNA + BF16 logic

* fix bad return

* fix src0 strides, contiguous requirements

* fix GGML_CUDA_FORCE_CUBLAS

* fix casts to BF16

2 months agoserver: fix deadlock in load_models() when erasing a finished download (#25358)
Pascal [Mon, 6 Jul 2026 17:26:06 +0000 (19:26 +0200)]
server: fix deadlock in load_models() when erasing a finished download (#25358)

* server: fix deadlock in load_models() when erasing a finished download

The download monitoring thread acquires the models mutex on its way out,
but load_models() joined it from the erase loop while holding that mutex.
Join it outside the lock via threads_to_join like the other monitoring
threads.

* server: add default timeout to test requests

A hung server now fails the test after 10 minutes instead of stalling
the CI job for hours. Explicit timeouts are unchanged.

2 months agoCUDA: extend K-type validation to V-types for flash attention (#24403)
Alexey Kopytko [Mon, 6 Jul 2026 14:26:50 +0000 (23:26 +0900)]
CUDA: extend K-type validation to V-types for flash attention (#24403)

* CUDA: extend K-type validation to V-types for flash attention

* reorder

2 months agoserver: temporary skip model downloading API test (#25355)
Xuan-Son Nguyen [Mon, 6 Jul 2026 14:10:04 +0000 (16:10 +0200)]
server: temporary skip model downloading API test (#25355)

2 months agoggml-cpu: use UE4M3 LUT in ARM NVFP4 dot product (#25331)
ragz4125 [Mon, 6 Jul 2026 11:06:40 +0000 (16:36 +0530)]
ggml-cpu: use UE4M3 LUT in ARM NVFP4 dot product (#25331)

2 months agoggml-cpu: Enable tiled matmul on AIX (#25199)
shalinib-ibm [Mon, 6 Jul 2026 10:18:17 +0000 (15:48 +0530)]
ggml-cpu: Enable tiled matmul on AIX (#25199)

The matmul_tiled path uses large local stack buffers for A_pack and B_pack. On AIX this can trigger a segmentation fault, so reduce the buffer footprint there to keep the tiled path usable.

 Performance Impact:
    ~ 2x gains in PP_Speed for FP32, Q4_0 and Q8_0 models tested with llama-bench, llama-batched-bench and llama-cli.
    Models used: Llama3.2 3b Instruct F32, qwen 2.5 3b Q4_0 and Q8_0

2 months agovulkan: fix 32-bit integer overflow in CEIL_DIV (#25245)
hokanosekai [Mon, 6 Jul 2026 08:35:57 +0000 (10:35 +0200)]
vulkan: fix 32-bit integer overflow in CEIL_DIV (#25245)

2 months agoui: restore Ctrl+B sidebar toggle shortcut (#25307)
Pascal [Mon, 6 Jul 2026 08:30:07 +0000 (10:30 +0200)]
ui: restore Ctrl+B sidebar toggle shortcut (#25307)

2 months agoscripts : use HF_TOKEN when downloading UI assets (#25280)
Adrien Gallouët [Mon, 6 Jul 2026 07:53:35 +0000 (09:53 +0200)]
scripts : use HF_TOKEN when downloading UI assets (#25280)

Signed-off-by: Adrien Gallouët <redacted>
2 months agoggml-hip: enable -ffast-math for HIP builds (#23862)
a-huk [Mon, 6 Jul 2026 07:02:26 +0000 (09:02 +0200)]
ggml-hip: enable -ffast-math for HIP builds (#23862)

2 months agoui: fake 200 for proxy DELETE req (#25298)
Xuan-Son Nguyen [Mon, 6 Jul 2026 06:41:39 +0000 (08:41 +0200)]
ui: fake 200 for proxy DELETE req (#25298)

2 months agoggml-cuda: optimize conv_transpose_1d indexing (#25310)
adavyas [Mon, 6 Jul 2026 03:49:06 +0000 (20:49 -0700)]
ggml-cuda: optimize conv_transpose_1d indexing (#25310)

2 months agoFix stale tensor-split params for draft models (#24814)
Al G [Sun, 5 Jul 2026 18:39:36 +0000 (19:39 +0100)]
Fix stale tensor-split params for draft models (#24814)

* meta: fix tensor split metadata for GQA attention

* Tidied the code a bit to match existing style

* Revert "Tidied the code a bit to match existing style"

This reverts commit b90c6c6300091fe09e2350a3d4edcfcf15db8d2e.

* Reverted the ggml-backend-meta asset hack.

2 months agoabort if we see a multi buffer (#25276)
Eve [Sun, 5 Jul 2026 18:38:47 +0000 (18:38 +0000)]
abort if we see a multi buffer (#25276)

2 months agoggml : fix tensor-parallel + -ncmoe crash on MoE models (#25028)
liminfei-amd [Sun, 5 Jul 2026 17:56:11 +0000 (01:56 +0800)]
ggml : fix tensor-parallel + -ncmoe crash on MoE models (#25028)

Tensor parallelism (-sm tensor) combined with -ncmoe (CPU-offloaded MoE
experts) aborts during warm-up on MoE models with
GGML_ASSERT(ggml_is_contiguous(tensor)) in ggml-backend-meta.cpp.

The failing tensor is the MoE router output (ffn_moe_topk): it is mirrored
(GGML_BACKEND_SPLIT_AXIS_MIRRORED, replicated across backends since routing
must be identical) and happens to be a non-contiguous view.
ggml_backend_meta_buffer_{get,set}_tensor asserted contiguity before
consulting the split state, so a mirrored non-contiguous tensor tripped the
assert even though the GGML_BACKEND_SPLIT_AXIS_MIRRORED case right below
already handles it.

Move the split-state lookup above the assert and allow the mirrored case in
both get_tensor and set_tensor.

Diagnosis credit to the reporter (@nathanmp).

Fixes #24886

Signed-off-by: liminfei-amd <redacted>
2 months agoggml: Update VMM Pool allocation ggml-cuda.cu - Turing P2P access fix (fixes #24489...
Vexxie [Sun, 5 Jul 2026 17:10:09 +0000 (18:10 +0100)]
ggml: Update VMM Pool allocation ggml-cuda.cu - Turing P2P access fix (fixes #24489) (#24491)

* Update ggml-cuda.cu - Turing P2P access fix.

* Add original code as fallback behaviour when NCCL or P2P is not set/true.

* Update ggml/src/ggml-cuda/ggml-cuda.cu to add comment as per suggestion

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

Co-authored-by: Johannes Gäßler <redacted>
2 months agocuda : concat implementation for quantized types (#25303)
fairydreaming [Sun, 5 Jul 2026 15:26:24 +0000 (17:26 +0200)]
cuda : concat implementation for quantized types (#25303)

* cuda : concat implementation for quantized types

* chore : apply am17an clever suggestion to shorten the code

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agollama : add guard for K/V rotation input when buffer is unallocated (#25215)
liminfei-amd [Sat, 4 Jul 2026 20:37:38 +0000 (04:37 +0800)]
llama : add guard for K/V rotation input when buffer is unallocated (#25215)

llm_graph_input_attn_kv::set_input and llm_graph_input_attn_kv_iswa::set_input
call set_input_k_rot / set_input_v_rot whenever the rotation tensor pointer is
non-null, but the tensor's buffer can be unallocated (NULL) when a graph only
stores K/V without attending -- e.g. DFlash speculative decoding's KV-injection
pass. set_input_k_rot then calls ggml_backend_buffer_is_host() on a NULL buffer
and aborts with GGML_ASSERT(buffer).

Guard the four k_rot/v_rot inputs with the same "&& ->buffer" check that the
adjacent kq_mask inputs already use in these two functions. When the buffer is
unallocated there is no data to upload, so skipping is correct.

Fixes #25191

Signed-off-by: liminfei-amd <redacted>
2 months agoui: add sync blocks so display/behavior settings can be set via --ui-config-file...
Pascal [Sat, 4 Jul 2026 14:12:27 +0000 (16:12 +0200)]
ui: add sync blocks so display/behavior settings can be set via --ui-config-file (#25132)

* ui: add sync blocks so display/behavior settings can be set via --ui-config-file

* ui: remove enable thinking setting

2 months agoggml : fix broken CPU concat implementation for quantized types (#25247)
fairydreaming [Sat, 4 Jul 2026 11:37:37 +0000 (13:37 +0200)]
ggml : fix broken CPU concat implementation for quantized types (#25247)

* ggml : fix broken CPU concat implementation for quantized types

* tests : concat tests for quantized types

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agochat: trim messages sent to StepFun parser (fixes long reasoning loops) (#25238)
Piotr Wilkin (ilintar) [Fri, 3 Jul 2026 21:12:11 +0000 (23:12 +0200)]
chat: trim messages sent to StepFun parser (fixes long reasoning loops) (#25238)

* chat: trim messages sent to StepFun parser (fixes long reasoning loops)

* add regression test; remove duplicate template

* chat: trim StepFun content parts before rendering

The StepFun trim workaround ran on the already-rendered messages, where
typed content parts have been concatenated into a single string, so the
per-part whitespace could no longer be reached. Move the trim ahead of
rendering and apply it to content_parts text as well as the string
content and reasoning_content. Adds a content-parts regression test.

Co-Authored-By: Piotr Wilkin <redacted>
Assisted-By: Claude Fable 5 <redacted>
---------

Co-authored-by: tarruda <redacted>
2 months agoui: Improve performance when streaming (#25225)
Nick Towle [Fri, 3 Jul 2026 17:03:51 +0000 (10:03 -0700)]
ui: Improve performance when streaming (#25225)

* ui: Improve performance when streaming

* ui: build sibling info map in branching utils

Moves the node map and sibling map construction from the
.by block into buildSiblingInfoMap() in branching.ts.

The map is built once per structural change and only read
afterwards, so it does not need SvelteMap reactivity. Keeping
the construction in plain TypeScript fixes the
svelte/prefer-svelte-reactivity lint error and groups the
branching logic where it already lives.

---------

Co-authored-by: Pascal <redacted>
2 months agoui: strip path and weight extension from model id in single model mode (#25137)
Pascal [Fri, 3 Jul 2026 15:32:48 +0000 (17:32 +0200)]
ui: strip path and weight extension from model id in single model mode (#25137)

2 months agospec: support spec-draft-p-min in DFlash (#25246)
Ruixiang Wang [Fri, 3 Jul 2026 13:40:06 +0000 (15:40 +0200)]
spec: support spec-draft-p-min in DFlash (#25246)

* spec: support spec-draft-p-min in DFlash

* dflash: add n_min guard

* dflash: guard both n_min and n_max