]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/log
pkg/ggml/sources/whisper.cpp
6 weeks agoruby : add VAD speech segments API (#3931)
KITAITI Makoto [Tue, 28 Jul 2026 06:08:44 +0000 (15:08 +0900)]
ruby : add VAD speech segments API (#3931)

* Bump version

* Add test for VAD segments API

* Implement VAD segments API

* Add signatures of VAD segments API

* Stop to dependent on mutex_m

* Check segment range for vad_segment_t0/t1

* Remove needless check

* Remove dead codes

* Fix index check for VAD segments

* Remove needless line

* Use NUM2DBL instead of RFLOAT_VALUE for safety

* Fix document

* Check type of samples

* Arrange CMake cache notation for older version

* Remove unnecessary line break

* Check return value of whisper_vad_segments_from_samples

* Fix type of VAD::Segment#start_time and #end_time

* Prevent dangling pointer from Params to VAD::Params

* Fix typos

* Update README

* Make test follow fix of impl

* Use segments_from_samples_body in ruby_whisper_vad_detect

* Run segments_from_samples without GVL

* Remove unnecessary codes

* [skip ci]Remove trailing whitespace

Co-authored-by: Daniel Bevenius <redacted>
---------

Co-authored-by: Daniel Bevenius <redacted>
2 months agoexamples : Remove leading space from txt output (#3921)
Cappuccino [Sat, 11 Jul 2026 15:53:59 +0000 (23:53 +0800)]
examples : Remove leading space from txt output (#3921)

* Fix #587: Remove leading space from txt output

The BPE tokenizer used by Whisper produces tokens with leading spaces,
causing each line in the txt output to start with an unwanted space.

This fix strips leading whitespace (spaces and tabs) from each segment
when writing to txt output files, improving the readability of the
transcription output.

Fixes: https://github.com/ggml-org/whisper.cpp/issues/587
2 months agoggml : use ggml_vqtbl1q_u8 for 32-bit compat (#0)
Georgi Gerganov [Fri, 10 Jul 2026 08:06:42 +0000 (11:06 +0300)]
ggml : use ggml_vqtbl1q_u8 for 32-bit compat (#0)

2 months agotalk-llama : sync llama.cpp
Georgi Gerganov [Fri, 10 Jul 2026 07:41:19 +0000 (10:41 +0300)]
talk-llama : sync llama.cpp

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

2 months agoggml : bump version to 0.16.0 (ggml/1559)
Georgi Gerganov [Fri, 10 Jul 2026 07:25:06 +0000 (10:25 +0300)]
ggml : bump version to 0.16.0 (ggml/1559)

2 months agoggml : fix conv 2d dw (llama/25490)
Georgi Gerganov [Thu, 9 Jul 2026 14:56:32 +0000 (17:56 +0300)]
ggml : fix conv 2d dw (llama/25490)

2 months agocommon : adapt to q2_0 (ggml/0)
Georgi Gerganov [Thu, 9 Jul 2026 11:58:55 +0000 (14:58 +0300)]
common : adapt to q2_0 (ggml/0)

2 months agoOnly index by compile times + always multiply/add (llama/25445)
Oliver Simons [Thu, 9 Jul 2026 11:23:57 +0000 (13:23 +0200)]
Only index by compile times + always multiply/add (llama/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 agometal : add CONV_2D_DW (depthwise convolution) support (llama/21565)
Sou-ly [Thu, 9 Jul 2026 09:29:15 +0000 (18:29 +0900)]
metal : add CONV_2D_DW (depthwise convolution) support (llama/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 (llama/24668)
RapidMark [Thu, 9 Jul 2026 08:02:26 +0000 (01:02 -0700)]
ggml-hip: enable -funsafe-math-optimizations (llama/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 (llama/25460)
Pascal [Thu, 9 Jul 2026 08:00:06 +0000 (10:00 +0200)]
cuda: align snake fusion matcher with the other backends (llama/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 agohexagon: add VISION RoPE support (llama/25216)
Aparna M P [Thu, 9 Jul 2026 04:55:00 +0000 (10:25 +0530)]
hexagon: add VISION RoPE support (llama/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 (llama/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 (llama/25418)

2 months agoopencl: Q6_K GEMM/GEMV fix for ne01 of weights that are not multiples of 128. (llama...
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. (llama/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 (llama/24362)
Ruben Ortlam [Wed, 8 Jul 2026 17:01:25 +0000 (19:01 +0200)]
vulkan: disable FA mask_opt on GCN to improve performance (llama/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) (llama/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 agovulkan: for small AMD GPUs, reduce submission threshold based on CU count (llama...
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 (llama/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 (llama/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 agocuda : add support for f16->f16 GGML_OP_SET_ROWS (llama/25367)
fairydreaming [Wed, 8 Jul 2026 11:24:20 +0000 (13:24 +0200)]
cuda : add support for f16->f16 GGML_OP_SET_ROWS (llama/25367)

2 months agometal : add set_rows with src0 f16 (llama/25434)
fairydreaming [Wed, 8 Jul 2026 06:49:07 +0000 (08:49 +0200)]
metal : add set_rows with src0 f16 (llama/25434)

Co-authored-by: Georgi Gerganov <redacted>
2 months agoggml : fix A indexing in simd_gemm scalar tail-column path (llama/25390)
tyronecai [Wed, 8 Jul 2026 05:00:05 +0000 (13:00 +0800)]
ggml : fix A indexing in simd_gemm scalar tail-column path (llama/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 (llama/25344)
fairydreaming [Wed, 8 Jul 2026 03:46:28 +0000 (05:46 +0200)]
ggml : add support for CPU f16->f16 GGML_OP_SET_ROWS (llama/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 (llama/25383)
lhez [Wed, 8 Jul 2026 03:34:29 +0000 (20:34 -0700)]
opencl: fix potential crash in aos reconstruct (llama/25383)

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

2 months agoCUDA: Fuse MMVQ post-scale for NVFP4 (llama/24481)
Oliver Simons [Tue, 7 Jul 2026 15:12:19 +0000 (17:12 +0200)]
CUDA: Fuse MMVQ post-scale for NVFP4 (llama/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 agoggml-hip : add -fno-finite-math-only alongside -ffast-math (llama/25373)
asf0 [Tue, 7 Jul 2026 11:27:50 +0000 (05:27 -0600)]
ggml-hip : add -fno-finite-math-only alongside -ffast-math (llama/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 agofix unsupported UT cases of CONT & CPY (llama/25231)
Neo Zhang [Tue, 7 Jul 2026 09:20:52 +0000 (17:20 +0800)]
fix unsupported UT cases of CONT & CPY (llama/25231)

* fix unsupported UT cases of CONT & CPY

* update ops.md

* rm unused head file

2 months agosupport op col2im_1d (llama/25264)
Neo Zhang [Tue, 7 Jul 2026 08:07:46 +0000 (16:07 +0800)]
support op col2im_1d (llama/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 agosupport OP cross_entropy_loss, cross_entropy_loss_back (llama/25236)
Neo Zhang [Tue, 7 Jul 2026 07:48:50 +0000 (15:48 +0800)]
support OP cross_entropy_loss, cross_entropy_loss_back (llama/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 (llama/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 (llama/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 agofix unsupport ACC UT cases for noncontiguous (llama/25124)
Neo Zhang [Tue, 7 Jul 2026 07:40:38 +0000 (15:40 +0800)]
fix unsupport ACC UT cases for noncontiguous (llama/25124)

* fix unsupport ACC UT cases for noncontiguous

* update ops.md

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

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

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

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

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 (llama/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 (llama/25366)
Hongqiang Wang [Tue, 7 Jul 2026 02:57:52 +0000 (19:57 -0700)]
opencl: general flash attention decode performance optimizations (llama/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 agometal: add col2im_1d op (f32/f16/bf16) (llama/25176)
Pascal [Mon, 6 Jul 2026 18:47:36 +0000 (20:47 +0200)]
metal: add col2im_1d op (f32/f16/bf16) (llama/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 (llama/24216)
Johannes Gäßler [Mon, 6 Jul 2026 18:04:53 +0000 (20:04 +0200)]
CUDA: remove -sm row, refactor cuBLAS (llama/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 agoCUDA: extend K-type validation to V-types for flash attention (llama/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 (llama/24403)

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

* reorder

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

2 months agoggml-cpu: Enable tiled matmul on AIX (llama/25199)
shalinib-ibm [Mon, 6 Jul 2026 10:18:17 +0000 (15:48 +0530)]
ggml-cpu: Enable tiled matmul on AIX (llama/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 (llama/25245)
hokanosekai [Mon, 6 Jul 2026 08:35:57 +0000 (10:35 +0200)]
vulkan: fix 32-bit integer overflow in CEIL_DIV (llama/25245)

2 months agoggml-hip: enable -ffast-math for HIP builds (llama/23862)
a-huk [Mon, 6 Jul 2026 07:02:26 +0000 (09:02 +0200)]
ggml-hip: enable -ffast-math for HIP builds (llama/23862)

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

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

2 months agoggml : fix tensor-parallel + -ncmoe crash on MoE models (llama/25028)
liminfei-amd [Sun, 5 Jul 2026 17:56:11 +0000 (01:56 +0800)]
ggml : fix tensor-parallel + -ncmoe crash on MoE models (llama/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) (llama/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 (llama/25303)
fairydreaming [Sun, 5 Jul 2026 15:26:24 +0000 (17:26 +0200)]
cuda : concat implementation for quantized types (llama/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 agoggml : fix broken CPU concat implementation for quantized types (llama/25247)
fairydreaming [Sat, 4 Jul 2026 11:37:37 +0000 (13:37 +0200)]
ggml : fix broken CPU concat implementation for quantized types (llama/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 agocuda: enable topk-moe fusion for 288 experts (llama/25267)
Piotr Wilkin (ilintar) [Fri, 3 Jul 2026 13:36:55 +0000 (15:36 +0200)]
cuda: enable topk-moe fusion for 288 experts (llama/25267)

* cuda: enable topk-moe fusion for 288 experts

The topk-moe fusion only accepted power-of-2 expert counts (or the
special-cased 576), so models with 288 experts (e.g. Step-3.7-Flash)
fell back to the unfused per-layer routing chain: softmax/sigmoid,
argsort, get_rows, sum_rows, div, clamp, scale. At batch size 1 that
is ~330 extra tiny graph nodes per token.

288 is a multiple of the warp size, so the existing kernel already
handles it; this adds the missing template instantiation and accepts
288 in the eligibility check.

Measured on gfx1151 with Step-3.7-Flash IQ4_XS (llama-bench,
-b 4096 -ub 4096 -fa 1 -dio 1 -ctk q8_0 -ctv q8_0; machine idle,
before/after paired so pp4096 stays matched as a load control):

  test            | before         | after
  ----------------+----------------+----------------
  pp4096          | 460.99 ± 0.45  | 462.47 ± 0.34   (unchanged)
  tg128           |  19.10 ± 0.04  |  19.56 ± 0.03   (+2.4%)
  tg128 @ d30000  |  12.68 ± 0.04  |  12.69 ± 0.03   (unchanged)

Prompt processing is unaffected (the fusion only touches decode
routing). The decode gain is ~+2.4% at shallow context and fades with
depth: by 30k tokens each step is attention-bound over the KV cache,
so removing the fixed routing overhead is no longer visible.

Assisted-By: Claude Fable 5 <redacted>
* Update tests/test-backend-ops.cpp

Co-authored-by: Oliver Simons <redacted>
* Add comment for case 288 in topk-moe.cu

---------

Co-authored-by: Oliver Simons <redacted>
2 months agoRemove redundant CUDA copies after gated_delta_net. (llama/23940)
Gaurav Garg [Fri, 3 Jul 2026 09:06:29 +0000 (14:36 +0530)]
Remove redundant CUDA copies after gated_delta_net. (llama/23940)

* Remove redundant CUDA copies after gated_delta_net.

Currently, GDN writes recurrent state snapshots into its output tail, then the graph immediately copies those snapshots into ssm_states_all. With MTP draft length 3, target decode uses K=4, so that becomes 4 extra ggml_cuda_cpy calls.

The change detects that gated_delta_net -> view -> cpy pattern and makes the CUDA GDN kernel write the state snapshot(s) directly into the recurrent cache, skipping the intermediate tail writes and copy kernels when safe.

* Address review comments

2 months agoopencl: allow loading precompiled binary kernels from library (llama/23042)
lhez [Wed, 1 Jul 2026 17:29:22 +0000 (10:29 -0700)]
opencl: allow loading precompiled binary kernels from library (llama/23042)

* opencl: allow loading binary kernel

* opencl: add libdl.h

* ggml-backend-dl is in ggml, which depends backend libs, thus
  ggml-opencl cannot depend on ggml-backend-dl
* add libdl.h to break cyclic dep

* opencl: allow loading bin kernel lib

* opencl: load `gemm_moe_mxfp4_f32_ns` from kernel lib if available

* opencl: load q8_0 gemm from kernel lib

* opencl: load q4_0 moe gemm from kernel lib

* opencl: load q4_1 moe gemm from kernel lib

* opencl: load q4_k moe gemm from kernel lib

* opencl: always declare `get_adreno_bin_kernel_func_t`

* opencl: rephrase message

* opencl: fix for rebase

* opencl: update doc

2 months agohexagon: flash attention rework (optimizations, accuracy improvements, etc) (llama...
Max Krasnyansky [Wed, 1 Jul 2026 13:59:19 +0000 (06:59 -0700)]
hexagon: flash attention rework (optimizations, accuracy improvements, etc) (llama/25085)

* hex-mm: fold mm quant tasks into the main matmul threads

* hex-mm: minor formatting fixes

* hex-mm: cleanup is_quant checks in dma dispatch

* hex-mm: fix dst-spad alignment

* hex-mm: move fp kernels in the hvx-mm-kernels header

* hex-mm: fuse with ADD

* hex-fa: factor out ukernels into separate headers and unify the rest

* hex-fa: move kernel-params compute into the host

* hex-fa: refactor vtcm alloc for consistency

* hex-fa: add support for FA_SELECT

* hex-fa: update tracing insrumentation to cover all functions

* hex-fa: update hvx fallback thresholds to recover t/g regressions

* hex-fa: update tracing instrumentation

* hex-fa: improved tracing with additional events

* hex-fa: optimize mask processing (fastdiv, etc)

* hex-fa: improve mask dma caching

* hmx-fa: change loop order to maximize mask cache hits

* hex-fa: remove over instrumentation

* hex-fa: breakdown QKV prep trace events

* hmx-fa: further mask proc optimizations

* hex-fa: mask broadcast is the common case, optimize for that

* hex-fa: use aligned loads where possible

* hex-fa: update loops to use uint32_t indices

* hmx-fa: fold vtcm init into q prep task

* hex-fa: update rest of the hmx funcs to use uint32_t

* hmx-fa: fold build_d into the main softmax loop

* hmx-fa: start kv dmas earlier

* hmx-fa: start mask dma a bit earlier

* hex-fa: precompute rows per task to avoid divs

* hmx-fa: specialize fa_o_store for f16 and f32

* hmx-fa: prelim support for Sinks

* hmx-fa: keep softmax accumulators in fp32

* hex-fa: add tanh_f16 and exp2_f16 and use that in FA

* hex-fa: use fp16 math in the hvx kernel

* hex-fa: avoid expensive float -> __fp16 cast for slopes and softcap

* hex-fa: replace most vec_exp_f32 with vec_exp2_f16

* hmx-fa: vectorize sinks update

* hex-fa: minor formatting

* hmx-fa: fold softcap loop into the tile load

* hmx-fa: use vectoralias to populate sinks

* hex-fa: remove redudant check

* hex-fa: fix vtcm size compute to use fp32 for accumulators

* hex-mm: fix trailing spaces

* hmx-fa: dont use -inf to init mask to avoid conversion overflows

* hex-fa: no need to explicitly guard -inf in the f16->f32 converter now

* hmx-fa: cleanup fa sinks handling

* hex-mm: fixed src2 stride handling when mm is fused with add

* hex-fa: make lto happy

2 months agoCUDA: consistent use of __restrict__ + PDL for FA (llama/25185)
Johannes Gäßler [Wed, 1 Jul 2026 08:55:14 +0000 (10:55 +0200)]
CUDA: consistent use of __restrict__ + PDL for FA (llama/25185)

2 months agoggml-cpu: add AVX2 optimization for nvfp4 dot product and use UE4M3 LUT (llama/23961)
ragz4125 [Wed, 1 Jul 2026 07:31:20 +0000 (13:01 +0530)]
ggml-cpu: add AVX2 optimization for nvfp4 dot product and use UE4M3 LUT (llama/23961)

2 months agoopencl: initial q1_0 support (llama/25160)
lhez [Wed, 1 Jul 2026 04:43:20 +0000 (21:43 -0700)]
opencl: initial q1_0 support (llama/25160)

* opencl: general q1_0 support

* opencl: add Adreno GEMM/GEMV for q1_0

2 months agocuda : prevent integer truncation and overflow errors when using KQ mask strides...
fairydreaming [Tue, 30 Jun 2026 18:47:05 +0000 (20:47 +0200)]
cuda : prevent integer truncation and overflow errors when using KQ mask strides in flash_attn_mask_to_KV_max kernel (llama/24945)

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agoCUDA: fix get_rows_back for tables with more than 65535 rows (grid-y clamp + stride...
Matt Jallo [Tue, 30 Jun 2026 12:16:24 +0000 (05:16 -0700)]
CUDA: fix get_rows_back for tables with more than 65535 rows (grid-y clamp + stride) (llama/25103)

2 months agoCUDA: fix Gemma E4B MTP FlashAttention (llama/25148)
Johannes Gäßler [Tue, 30 Jun 2026 12:06:54 +0000 (14:06 +0200)]
CUDA: fix Gemma E4B MTP FlashAttention (llama/25148)

* CUDA: fix Gemma E4B MTP FlashAttention

* remove unused template declaration

2 months agovulkan: roll bk loop in matmul for asahi linux (llama/24663)
Kevin Liu [Tue, 30 Jun 2026 10:27:38 +0000 (06:27 -0400)]
vulkan: roll bk loop in matmul for asahi linux (llama/24663)

* vulkan: roll bk loop in matmul for asahi linux

* vulkan: fix inline comment

* vulkan: revert BK-loop unroll change

* vulkan: edit spirv directly for asahi roll bk loop

* vulkan: remove trailing whitespace at the end of comments

2 months agoHIP: use hipBLAS for dense prefill on gfx900, keep MMQ for MoE (llama/24588)
zduford [Tue, 30 Jun 2026 09:51:38 +0000 (05:51 -0400)]
HIP: use hipBLAS for dense prefill on gfx900, keep MMQ for MoE (llama/24588)

* HIP: keep MMQ for gfx900 MoE and Q8_0, use hipBLAS for dense K-quants

Assisted-by: GitHub Copilot CLI
* HIP: tighten conditional block to be explicitly for gfx900

* HIP: Further simplified gfx900 conditional block

* removed unnecessary comment

2 months agoggml-webgpu: add support for NVFP4 (llama/25143)
Masashi Yoshimura [Tue, 30 Jun 2026 08:20:04 +0000 (17:20 +0900)]
ggml-webgpu: add support for NVFP4 (llama/25143)

2 months agoRevert "sched : reintroduce less synchronizations during split compute (#20793)"...
Oliver Simons [Tue, 30 Jun 2026 00:41:45 +0000 (02:41 +0200)]
Revert "sched : reintroduce less synchronizations during split compute (#20793)" (llama/25138)

2 months agovulkan: use flops instead of weight tensor size for submission heuristic (llama/25005)
Ruben Ortlam [Mon, 29 Jun 2026 13:24:44 +0000 (15:24 +0200)]
vulkan: use flops instead of weight tensor size for submission heuristic (llama/25005)

* vulkan: extract flops calculation into function

* use flops instead of matmul src0 tensor size for submission threshold

* use unsigned ints

2 months agoopencl: flash attention improvement (llama/25069)
Hongqiang Wang [Sat, 27 Jun 2026 22:36:06 +0000 (15:36 -0700)]
opencl: flash attention improvement (llama/25069)

* opencl: rework FA kernel for f16 and f32

* opencl: flash-attention prefill prepass kernels

- flash_attn_kv_pad_f16    pads the tail KV tile to a BLOCK_N multiple
- flash_attn_mask_pad_f16  pads the matching mask tile
- flash_attn_blk_f16       classifies each KV tile per query block as
                           fully masked / mixed / fully unmasked, so
                           the main kernel can skip fully-masked tiles
                           and the mask lookup for fully-unmasked ones

* opencl: FA kernels for q4_0 and q8_0

* opencl: `set_rows` for f32 to q8_0/q4_0

* opencl: dequant kernels for q4_0 and q8_0

* opencl: add FA tile tuning table with override

* opencl: wire host side for FA

* opencl: q4_0 MoE tensors are also SOA'ed

* opencl: cosmetic fix

* opencl: refactor, also clarify some code paths in comments

* opencl: fix inifity for `-cl-finite-math-only`

---------

Co-authored-by: Li He <redacted>
2 months agoAdded a cudaMemcpy2DAsync fast path to ggml_cuda_cpy (llama/25057)
Gaurav Garg [Sat, 27 Jun 2026 12:16:21 +0000 (17:46 +0530)]
Added a cudaMemcpy2DAsync fast path to ggml_cuda_cpy (llama/25057)

* [CUDA] Added a cudaMemcpy2DAsync fast path to ggml_cuda_cpy

Add a CUDA ggml_cpy fast path for same-type, same-shape strided copies that are just 2D pitched block copies.
When tensors are not fully contiguous but each row is contiguous, it now uses cudaMemcpy2DAsync instead of the slow element-wise scalar copy kernel.

This fixes the GDN recurrent snapshot update with -np 4, where rollback slots are separated by cache stride gaps.

* Add new tests that execute the new optimized strided copy path

* Return unsupported for strided copy in OpenVINO, as new tests are failing

2 months agosycl : fix failed ut cases of norm (llama/25044)
Neo Zhang [Sat, 27 Jun 2026 09:13:43 +0000 (17:13 +0800)]
sycl : fix failed ut cases of norm (llama/25044)

2 months agovulkan: fix step operator for 0 input (llama/25036)
Ruben Ortlam [Sat, 27 Jun 2026 08:57:31 +0000 (10:57 +0200)]
vulkan: fix step operator for 0 input (llama/25036)

2 months agosched : reintroduce less synchronizations during split compute (llama/20793)
Andreas Kieslinger [Fri, 26 Jun 2026 14:18:30 +0000 (16:18 +0200)]
sched : reintroduce less synchronizations during split compute (llama/20793)

* CUDA:  Improve performance via less synchronizations between token (llama/17795)

* Adds CPU-to-CUDA copy capability to
ggml_backend_cuda_cpy_tensor_async()

* Adds function to relax sync requirements between input copies on
supported backends (CUDA for now)

* Exchanges synchronous copy with async copy function.

* Adds macro guards to allow compilation in non-CUDA builds

* Reworked backend detection in ggml-backend.cpp to avoid linking
conflicts

* Relax requirement of checks in async CUDA copies from backend and buffer type to just buffer type, to avoid linking issues

* Minor cleanup

* Makes opt-in to relax use of explicit syncs more general. Backends like
vulkan which require a synchronization between HtoD copies and graph
execution could also adopt this change now.

* Reintroduces stricter check for CPU->CUDA backend async copy via
GGML_DEVICE_TYPE_CPU.

* Corrects initialization of ggml_backend_sync_mode in
ggml_backend_sched_split initialization

* Simplifies synchronizations to adhere to `saaasg` pattern.

* Apply suggestion from @ggerganov (src->buffer to buf_src)

Co-authored-by: Georgi Gerganov <redacted>
* Apply suggestion from @ggerganov (src->buffer to buf_src) v2

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

Co-authored-by: Georgi Gerganov <redacted>
* Apply suggestions from @johannesgaessler code review

Co-authored-by: Johannes Gäßler <redacted>
* Adds single-GPU synchronizations to multi-GPU settings to fix hip backend pipeline parallel bugs.

* Scheduler Hardening: Exclude hip/MUSA from copy_from_host CPU split ->
GPU split optimization

* Scheduler Hardening: Re-adding original additional synchronizations for
non-async backends

* Adds disclaimer to hip/musa exclusion of copy_from_host. Highlights that it is out of
precaution, but that no perf-impact is visible, and that it can be
revisited separately anytime.

---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Johannes Gäßler <redacted>
2 months agoopenvino: Update to OV 2026.2.1, self-contained release packages, operator improvemen...
Ravi Panchumarthy [Fri, 26 Jun 2026 12:07:19 +0000 (05:07 -0700)]
openvino: Update to OV 2026.2.1, self-contained release packages, operator improvements (llama/24974)

* Update to OV 2026.2.1, Make OV release packages self-contained

* Update to OV 2026.2.1, Make OV release packages self-contained

* OpenVINO Backend: Remove compute_op_type hardcoded sets (llama/222)

* OpenVINO Backend: Remove compute_op_type hardcoded sets

* revert get_op_type removal

* OpenVINO backend: enable softmax with sink input

* OpenVINO backend: opt mul_mat_id convert process for large size

* OpenVINO backend: Modify add_id to support 2D/4D

* OpenVINO Backend: Add glu_swiglu_oai

* PR review: fix paths

* PR review: fix path consistency

---------

Co-authored-by: Mostafa <redacted>
Co-authored-by: Xuejun <redacted>
2 months agovulkan: opt mul_mat_vecq for mi50 (llama/22933)
nullname [Fri, 26 Jun 2026 11:49:24 +0000 (19:49 +0800)]
vulkan: opt mul_mat_vecq for mi50 (llama/22933)

2 months agovulkan: add INTEL_XE1 arch enum and enable coopmat1 on Intel Xe-LPG Plus (llama/24404)
Jiang, Fish [Fri, 26 Jun 2026 11:26:22 +0000 (11:26 +0000)]
vulkan: add INTEL_XE1 arch enum and enable coopmat1 on Intel Xe-LPG Plus (llama/24404)

* vulkan: add INTEL_PRE_XE2 arch enum and enable coopmat1 on Intel Xe-LPG Plus (1/3, Xe1-ARLH)

Co-authored-by: Xia, Jie <redacted>
Co-authored-by: Liu, Russell <redacted>
* Address comments of bf16 and trailing whitespace

* Rename INTEL_PRE_XE2 to INTEL_XE1 and remove driver workaround

* Add Windows driver check

---------

Co-authored-by: Xia, Jie <redacted>
Co-authored-by: Liu, Russell <redacted>
2 months agowhisper : expose internal VAD speech segments (#3916)
Lin Xiaodong [Wed, 1 Jul 2026 11:10:16 +0000 (19:10 +0800)]
whisper : expose internal VAD speech segments (#3916)

When transcribing with params.vad = true, whisper already computes the speech
segments and keeps them in the state. Expose them so callers can reuse those
boundaries (for example to align or clip subtitles to speech) instead of running
a second, separate VAD pass.

Times are on the original audio timeline in centiseconds; the count is 0 when VAD
was not used. test-vad-full.cpp checks the segments are ordered and non-empty.

2 months agoci, examples : add package-lock.json to examples addon node (#3919)
Daniel Bevenius [Wed, 1 Jul 2026 07:04:21 +0000 (09:04 +0200)]
ci, examples : add package-lock.json to examples addon node (#3919)

* ci, examples : add package-lock.json to examples addon node

This commit commits the package-lock.json file for examples/addon.node.

This is needed to make the CI workflow work properly and after we
started pinning the action versions in the workflow, the CI started
failing because the package-lock.json was not committed. At least that
is what I think is happening.

* ci: use node 20.x and 22.x instead of 16.x and 18.x

* fix CMakeLists.txt target properties for addon.node

2 months agowhisper : map token timestamps to original time when VAD is enabled (#3910)
Lin Xiaodong [Wed, 1 Jul 2026 06:23:50 +0000 (14:23 +0800)]
whisper : map token timestamps to original time when VAD is enabled (#3910)

whisper_full_get_token_data().t0/t1 are in the VAD-processed timeline (silences
removed), so they don't line up with the original audio. Add
whisper_full_get_token_t0/t1 that map them back.

A token inside a speech segment is interpolated within it; a token that falls in a
removed inter-segment silence snaps to the nearest boundary, so it never lands in
the middle of a cut-out gap. Without VAD the raw times are returned unchanged.

2 months agowhisper : make voice_length() utf-8 aware for CJK (#3915)
Lin Xiaodong [Wed, 1 Jul 2026 06:21:35 +0000 (14:21 +0800)]
whisper : make voice_length() utf-8 aware for CJK (#3915)

* whisper : make voice_length() utf-8 aware for CJK

voice_length() weights each token by how long its text takes to say, which drives
how a segment's time is shared between its tokens. It looped over raw bytes, so
every CJK character (3 bytes) was counted ~3x and full-width punctuation never
matched, skewing token timestamps for Chinese/Japanese.

Decode one utf-8 code point at a time and give full-width ,。!? etc. the same
weights as their ASCII counterparts. Pure-ASCII text is unaffected.

* whisper : one statement per line in voice_length()

---------

Co-authored-by: linxiaodong <redacted>
2 months agoci : set GGML_NATIVE=OFF for sanitize builds (#3920)
Daniel Bevenius [Tue, 30 Jun 2026 15:47:22 +0000 (17:47 +0200)]
ci : set GGML_NATIVE=OFF for sanitize builds (#3920)

This commit sets GGML_NATIVE=OFF for all sanitize builds to avoid
the case where the compilation happens using a runner that support
instructions that may not be available on all runners leading to illegal
instruction and failed CI runs.

Refs: https://github.com/ggml-org/whisper.cpp/actions/runs/28444909499/job/84291639530?pr=3919

2 months agoexamples : Improved inference performance of Android example project (#3913)
Yongmin Yoo 유용민 [Tue, 30 Jun 2026 10:12:04 +0000 (19:12 +0900)]
examples : Improved inference performance of Android example project (#3913)

* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android example

* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android.java example

2 months agotalk-llama : sync llama.cpp
Georgi Gerganov [Fri, 26 Jun 2026 12:06:05 +0000 (15:06 +0300)]
talk-llama : sync llama.cpp

2 months agosync : ggml
Georgi Gerganov [Fri, 26 Jun 2026 12:05:10 +0000 (15:05 +0300)]
sync : ggml

2 months agoggml : bump version to 0.15.3 (ggml/1550)
Georgi Gerganov [Fri, 26 Jun 2026 11:37:43 +0000 (14:37 +0300)]
ggml : bump version to 0.15.3 (ggml/1550)

2 months agovulkan: Workaround compiler bug in conv2d coopmat2 path (llama/24924)
Jeff Bolz [Fri, 26 Jun 2026 09:53:32 +0000 (04:53 -0500)]
vulkan: Workaround compiler bug in conv2d coopmat2 path (llama/24924)

* vulkan: Workaround compiler bug in conv2d coopmat2 path

* apply same workaround to CONV_3D

* Apply suggestion from @jeffbolznv

2 months agoCUDA: add cublasSgemmBatched mapping for HIP/MUSA vendor headers (llama/25033)
leonardHONG [Fri, 26 Jun 2026 09:42:56 +0000 (17:42 +0800)]
CUDA: add cublasSgemmBatched mapping for HIP/MUSA vendor headers (llama/25033)

2 months agoggml-cpu: fix SVE leftover path in ggml_vec_dot_f32 (llama/24699)
Tarek Dakhran [Fri, 26 Jun 2026 07:41:56 +0000 (09:41 +0200)]
ggml-cpu: fix SVE leftover path in ggml_vec_dot_f32 (llama/24699)

* ggml-cpu: fix SVE leftover path in ggml_vec_dot_f32

2D convolutions with kernel size 9 produced different results on SVE
enabled ARM devices. After debugging it turned out that ggml_vec_dot_f32
was using data from inactive lanes.

Use svmla_f32_m(pg, sum1, ax1, ay1) so inactive lanes retain sum1.

* cont : clean-up

---------

Co-authored-by: Georgi Gerganov <redacted>
2 months agosycl : clamp softmax input to avoid underflow (llama/24941)
Jassieluo [Fri, 26 Jun 2026 07:02:42 +0000 (15:02 +0800)]
sycl : clamp softmax input to avoid underflow (llama/24941)

2 months agoCUDA: batch out_prod broadcast (dps2>1) path with cublasSgemmBatched (llama/24426)
leonardHONG [Fri, 26 Jun 2026 05:51:25 +0000 (13:51 +0800)]
CUDA: batch out_prod broadcast (dps2>1) path with cublasSgemmBatched (llama/24426)

2 months agoopencl: flush profiling batch at shutdown for incomplete batches (llama/25016)
shaofeiqi [Fri, 26 Jun 2026 01:48:24 +0000 (18:48 -0700)]
opencl: flush profiling batch at shutdown for incomplete batches (llama/25016)

2 months agoCUDA: Various fixes to `cpy.cu` (llama/25000)
Oliver Simons [Thu, 25 Jun 2026 15:29:23 +0000 (17:29 +0200)]
CUDA: Various fixes to `cpy.cu` (llama/25000)

* Add failing test-case to test-backend-ops

Extracted from https://github.com/ggml-org/llama.cpp/issues/24072

* Minimize repro with help of AI

N = 8 * (65535 - 1) + 1 = 524273

* Port and adjust workaround from https://github.com/LostRuins/koboldcpp/commit/0ba798341e0c70517cb226cb63c966b086a3b5b3

Fall-back should share code, also relax y-z constraint to be inclusive

* Add test-case + fallback also for y dim

* Fix x-guards which is 2^{31}-1, so inlusive of INT_MAX

* Fix overflow problems for transposed copy kernel

2 months agoggml : address integer overflows in binary ops CUDA implementation (llama/24706)
fairydreaming [Thu, 25 Jun 2026 08:06:44 +0000 (10:06 +0200)]
ggml : address integer overflows in binary ops CUDA implementation (llama/24706)

* ggml : address integer overflows in binary ops CUDA implementation

* ggml : add size_t casts to avoid integer overflows

* ggml : add more asserts checking integer overflows in binary ops CUDA implementation

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agosycl : support --split-mode tensor (llama/24152)
David Spruill [Thu, 25 Jun 2026 05:35:21 +0000 (01:35 -0400)]
sycl : support --split-mode tensor (llama/24152)

* Sycl tp stage1 (llama/1)

* SYCL: tensor parallelism (--split-mode tensor) for dual-GPU

Adds the comm_init/comm_free/comm_allreduce_tensor trio that the
meta-backend queries via get_proc_address to enable backend-specific
all-reduce, mirroring the pattern used by ggml-cuda.cu.

For N=2 (the common dual-GPU case) implements a degenerate ring
all-reduce with two size-branched paths:

  * Small (nelem < 32768): FP32 direct memcpy + per-device ADD kernel
    chained via depends_on(memcpy_event). 4 SYCL submissions/call.

  * Large (nelem >= 32768): BF16-compressed. Each device compresses
    FP32 -> BF16 in a local outbox, cross-device memcpys to the peer's
    inbox (HALF the PCIe bytes), then decompresses + adds into the
    local FP32 partial. 6 SYCL submissions/call but PCIe bytes halved
    -- wins for any tensor where PCIe dominates kernel time.

Threshold and BF16 path pattern mirror the CUDA NCCL allreduce.

Storage: ONE persistent uint8_t buffer per device, 4 * nelem bytes
(matches both path layouts: FP32 nelem floats; BF16 outbox+inbox =
2 * nelem uint16_t each). Single alloc+free per device keeps the
SYCL pool's strict-LIFO invariant trivial.

Initial impl handles N=2 FP32 contiguous tensors. Other cases return
false, causing the meta-backend to use its generic butterfly fallback.

Per-call sync is intentionally omitted. SYCL in-order queue semantics
ensure that the meta-backend's next compute on the same per-device
queue waits for our final ADD, and the next allreduce's first op on
the same persistent buffer waits via the same queue. Only comm_free
does an explicit final wait.

OneCCL is NOT used: OneCCL 2021.17 hardcodes single-device-per-process
in communicator_impl.hpp:47 (condition devices.size() == 1), which is
incompatible with llama.cpp's single-process multi-GPU model.

Measured on dual Intel Arc Pro B70 (NEO 26.05.x, oneAPI 2025.3 +
DPC++ nightly):

  Llama-3.3-70B Q4_K_M, -sm tensor -fa 1 -ctk f16 -ctv f16:
    pp512 = 377.08 t/s  (vs 313.65 layer mode = +20.2%)
    tg128 = 17.40 t/s   (vs   9.74 layer mode = +78.6%)

  Qwen3-Coder-Next-80B-A3B Q3_K_M (MoE):
    pp512 = 216.56 t/s  (vs 156.58 meta-backend butterfly = +38.3%)
    tg128 = 17.60 t/s   (vs  14.31 meta-backend butterfly = +23.0%)

  Qwen3-4B Q4_K_M:
    pp64  = 984.51 t/s, tg16 = 49.29 t/s

Llama-3.3-70B in SYCL TP now comfortably beats production layer mode
on both prefill and decode. Coder-Next-80B-A3B (MoE) also wins on
both — the BF16 path is what unlocks the many-medium-allreduces
prefill pattern.

Build/CMake: no changes. No new dependencies. ~210 lines added across
ggml-sycl.h and ggml-sycl.cpp.

* Fix comments

* documentation update to address PR feedback

* Bring over my device-to-device memcpy chagnes

* move the dev2dev_memcpy calls to the upstream 7-parameter variety

* Fix a typo and remove a trailing whitespace

2 months agosycl : fix the failed UT cases of conv_3d (llama/24900)
Neo Zhang [Thu, 25 Jun 2026 05:27:58 +0000 (13:27 +0800)]
sycl : fix the failed UT cases of conv_3d (llama/24900)

2 months agoopencl: support non-contig rows in norm (llama/24965)
lhez [Thu, 25 Jun 2026 02:21:25 +0000 (19:21 -0700)]
opencl: support non-contig rows in norm (llama/24965)

2 months agohexagon: MUL_MAT and MUL_MAT_ID rework : 32x32 tiled weight repack, kernel-params...
Max Krasnyansky [Wed, 24 Jun 2026 19:14:25 +0000 (12:14 -0700)]
hexagon: MUL_MAT and MUL_MAT_ID rework : 32x32 tiled weight repack, kernel-params, cached graphs (llama/24954)

* hex-mm: new weight layout and fusion updates

* hvx-mm: unroll the new tiled vec_dots to optimize hvx register util

* hex-mm: optimize dyn.quant format for q8_0 and q8_1 to reduce overhead in vec_dots.

* hvx-mm: parallel quantizer per block for large rows

* hvx-mm: simplify and futher optimize dyn.quant and vec_dots

* hvx-mm: keep intermediate per tile accumulators in fp16

* hmx-mm: optimize weight dequant by aligning the repacked tiles with the DMA

* hmx-mm: remove qweight scratch and just use vtcm_weight

* hmx-mm: remove all unused and obsolete code

* hmx-mm: the new tiled repack format is here to stay -- rename all x4x2 to _tiled

* hmx-mm: improve activation processing with dma prefetch

* hex-mm: fix hmx/hvx fallback logic and MUL_MAT_ID allocation (unbreaks OLMoE)

* hex-mm: align the weight tiles with dma just like we did in hmx-mm

* hex-mm: factor out common mm bits into htp/matmul-ops.h

* hex-mm: start moving mm kernel selection to the host

* hex-mm: move all of the matmul param compute into the host

* hmx-mm: restore pipelined mode

* hmx-mm: unroll the dequant functions to optimize register usage

* hmx-mm: further improve activation process

* hex-mm: use vtcm_seq_alloc for all vtcm allocations and define more common functions

* hex-mm: improve mm optimizer to acount for number of activation threads

* hex-mm: fix matmul-id kernel params selection (unbreaks OLMoE and LFM)

* hexagon: remove support for arch < v73 since HMX is now required for most use-cases

* hex-mm: cleanup naming for consistency

* hex-mm: make sure matmul fusion accounts for vtcm allocation

* hex-mm: minor cleanup for kernel_params definition

* hex-mm: replace hardcoded limits with proper checks for vtcm requirements

* hex-mm: add support for non-tiled mm as a fallback option and factor out hvx kernels into separate header

* hex-mm: remove unused functions

* hex-mm: add shorthand for MM_SELECT in run-tool script

* hvx-mm: factor out hvx/hmx microkernels and unify matmul entry and dispatch

* hex-mm: further cleanup matmul fallback path

* hex-mm: refactor matmul entry point and dispatch a bit further

* hexagon: update cmake build to enable hmx for everything

* hex-ops: optimize kernel_param updates and include summary in the logs

* hex-mm: add support for GGML_HEXAGON_MM_SELECT

* hex-mm: add hex-common header

* hex-mm: pass correct number of tasks to workpool

* hex-mm: add proper checks for no-work in dyn.quant tasks

* hex-mm: convert all quantizers into a macro

* hex-mm: fix hvx-flat fallback to pass all MUL_MAT tests

* hex-mm: vectorize q8_1 quantizer

* hex-mm: improve fused ffn mm stride handling

* hex-mm: consistent use of n_threads and pipeline in kernel_params

* hexagon: minor formatting

* hex-mm: update MUL_MAT_ID kernel_param handling to make sure host/npu are in sync

* hvx-mm: go back to accumulating in fp32 in tiled hvx kernels, more accurate and same perf

* hvx-mm: unroll the loops and remove masking that is not needed for tiled accums

* hmx-mm: optimize activation processing (slit loops, some unrolling, etc)

* hmx-mm: minor optimization for output processing

* hex-mm: consistent use of uint32_t and size_t in mm kernels

* hex-mm: remove legacy restrictions for rows to be multiple of 256

* hexagon: replace sprintf with snprintf

* hex-mm: relax hardcoded nrows checks and rely on VTCM size requirements

* hexagon: minor alignment fix

* hexagon: fix trailing spaces

* hex-mm: relax padding from 256 to 128 (leftovers)

* hex-mm: remove redundant checks for weight align to 128

we always use 2D dma for the weights and align them properly

* hmx-mm: MUL_MAT_ID better work distribution between hvx threads and hmx tracing

* hex-mm: specialize per-token mmid activation handling

* hex-profile: update python scripts to handle kernel-params section in the logging output

* hex-mm: move n_prefetch (aka dma_depth) into kernel params and remove unused fields

* hex-trace: use easier to parse format, simply and fix post-proc scripts

* hmx-mm: relax 32 row limit for output processing which helps utilization

* hmx-mm: use start-chunk idx for tracing info

* hmx-mm: parameterize activation dma pipeline

* hexagon: add support for simple graph caching to avoid recomputing kernel-params

* hex-mm: remove left-over repack functions

* hex-mm: tighten n_prefetch asserts

* hex-mm: remove duplicate round/align_up helper

* hexagon: cleanup common header used in host/npu

* hexagon: update early wakeup threshold

* hmx-mm: define cost constants and update solver to assume that repacked ne[1] is padded to 32

* hmx-mm: make precompute_matmul a bit more readable (split into smaller functions, etc)

* hex-mm: remove n_threads constraint

* hex-mm: minor formatting updates

* hex-mm: remove obsolete profiling logs

* hex-mm: restore hardcode gate to refuse lm-head to avoid repacking that tensor

2 months agovulkan: allow reducing the graph submission batches to avoid timeouts (llama/24872)
Wagner Bruna [Wed, 24 Jun 2026 14:29:24 +0000 (11:29 -0300)]
vulkan: allow reducing the graph submission batches to avoid timeouts (llama/24872)

2 months agovulkan: fail the build when a shader fails to compile (llama/24450)
liminfei-amd [Wed, 24 Jun 2026 09:42:03 +0000 (17:42 +0800)]
vulkan: fail the build when a shader fails to compile (llama/24450)

* vulkan-shaders-gen: fail the build when a shader fails to compile

vulkan-shaders-gen did not detect shader-compile subprocess failures, so a
broken libggml-vulkan could be produced while the build reported success and
the breakage only surfaced at run time. execute_command() discarded the child
exit code (POSIX waitpid passed nullptr for status; the Windows branch never
called GetExitCodeProcess) and string_to_spv decided success only from whether
stderr was empty, so a non-zero exit with empty stderr, or a subprocess that
failed to launch, was treated as success.

Return the child exit code from execute_command() (WEXITSTATUS on POSIX,
GetExitCodeProcess on Windows), treat a non-zero exit or non-empty stderr or a
launch exception as a failure, and record it in an atomic flag. main() checks
the flag after process_shaders() and returns EXIT_FAILURE before writing the
output files, so the build stops instead of emitting a broken backend.

Fixes #24393

Signed-off-by: liminfei-amd <redacted>
* vulkan-shaders-gen: simplify compile_failed access and drop unreachable return

Address review feedback on #24450:
- Access the std::atomic<bool> compile_failed directly (= / implicit bool)
  instead of .store()/.load(); the flag stays atomic because the worker
  threads in process_shaders() set it concurrently.
- Remove the unreachable trailing return -1 in execute_command(): on POSIX the
  child _exit()s after execvp and the parent returns (fork()<0 throws); on
  Windows the block returns the exit code.

Signed-off-by: liminfei-amd <redacted>
---------

Signed-off-by: liminfei-amd <redacted>
2 months agovulkan: Apply bias before softmax in FA, to avoid overflow (llama/24909)
Jeff Bolz [Wed, 24 Jun 2026 03:34:00 +0000 (22:34 -0500)]
vulkan: Apply bias before softmax in FA, to avoid overflow (llama/24909)

2 months agovulkan: support all backend tests for SQR/SQRT/SIN/COS/CLAMP/LEAKY_RELU/NORM (llama...
Jeff Bolz [Tue, 23 Jun 2026 14:48:24 +0000 (09:48 -0500)]
vulkan: support all backend tests for SQR/SQRT/SIN/COS/CLAMP/LEAKY_RELU/NORM (llama/24582)

* vulkan: make SQR/SQRT/SIN/COS/CLAMP/LEAKY_RELU use unary.comp

* vulkan: make NORM support noncontig

* add noncontiguous row test cases for norm/l2_norm, handle this in the CPU backend and l2_norm.comp

* fix supports_op for cuda and webgpu

2 months agovulkan: Support GET_ROWS_BACK (llama/24883)
Jeff Bolz [Tue, 23 Jun 2026 13:39:37 +0000 (08:39 -0500)]
vulkan: Support GET_ROWS_BACK (llama/24883)