]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/log
pkg/ggml/sources/whisper.cpp
2 months agoRevert "ggml-cpu: handle 3d tensors in repack mat_mul (llama/17030)" (llama/17233)
Georgi Gerganov [Thu, 13 Nov 2025 10:59:37 +0000 (12:59 +0200)]
Revert "ggml-cpu: handle 3d tensors in repack mat_mul (llama/17030)" (llama/17233)

This reverts commit 1c398dc9eca9c366ce98deb0e6f3538e444ebc8a.

2 months agoggml-cpu : use template for argsort (llama/17222)
Diego Devesa [Thu, 13 Nov 2025 08:59:05 +0000 (00:59 -0800)]
ggml-cpu : use template for argsort (llama/17222)

2 months agoCANN: Add cross_entropy_loss op support (llama/16886)
TecJesh [Thu, 13 Nov 2025 01:39:51 +0000 (09:39 +0800)]
CANN: Add cross_entropy_loss op support (llama/16886)

* update L2_NORM op support

* update L2_NORM op support

* remove extra whitespace

* cann: update cross_entropy_loss op support

* remove trailing whitespaces

* rebase the latest code in the main repository and remove the l2_norm operator that already exists in another pull request.

* undo the l2_norm operator deletion

2 months agoCUDA: fuse rope + set_rows (llama/16884)
Aman Gupta [Thu, 13 Nov 2025 00:50:01 +0000 (08:50 +0800)]
CUDA: fuse rope + set_rows (llama/16884)

* CUDA: add fused rope

* move k forward_expand up

* create helper function instead of re-using params

* make assert statement more in line with comment

* rope_norm: coalesced writes to global mem

2 months agoCUDA: static assert to prevent misuse of memcpy_1 (llama/17198)
Johannes Gäßler [Wed, 12 Nov 2025 22:13:55 +0000 (23:13 +0100)]
CUDA: static assert to prevent misuse of memcpy_1 (llama/17198)

2 months agoggml : use std::sort in ggml_argsort CPU implementation (llama/17211)
Georgi Gerganov [Wed, 12 Nov 2025 18:43:38 +0000 (20:43 +0200)]
ggml : use std::sort in ggml_argsort CPU implementation (llama/17211)

* ggml : use std::sort in ggml_argsort CPU implementation

* cont : add missing header

2 months agoggml-cpu: handle 3d tensors in repack mat_mul (llama/17030)
Alberto Cabrera Pérez [Wed, 12 Nov 2025 12:52:19 +0000 (12:52 +0000)]
ggml-cpu: handle 3d tensors in repack mat_mul (llama/17030)

* ggml-cpu: handle 3d tensors in repack mul_mat

* Removed unnecessary branch, removed need for <algorithm>

* Fixed dst_ptr pointer in chunk + clang_format

* GGML_ASSERT to check wdata within bounds

* Accidental ggml.h inclusion

* Improved GGML_ASSERT on wdata boundaries

2 months agoCANN: Add L2_NORM op support (llama/16856)
TecJesh [Wed, 12 Nov 2025 07:11:42 +0000 (15:11 +0800)]
CANN: Add L2_NORM op support (llama/16856)

* update L2_NORM op support

* update L2_NORM op support

* remove extra whitespace

2 months agofix ci crash about SSM_CONV (llama/17169)
Neo Zhang Jianyu [Wed, 12 Nov 2025 06:44:29 +0000 (14:44 +0800)]
fix ci crash about SSM_CONV (llama/17169)

* fix ci crash

* Update ggml-sycl.cpp

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

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

Co-authored-by: Zhang Jianyu <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agohexagon: various Op fixes (llama/17135)
Max Krasnyansky [Tue, 11 Nov 2025 23:25:04 +0000 (15:25 -0800)]
hexagon: various Op fixes (llama/17135)

* hexagon: explicitly check for ops with zero nrows

llm_graph_context::build_inp_out_ids() can generate tensors with zero nrows.
Somehow other backends seems to handle this without obvious explicit checks.
In the hexagon case we need to check explicitly and skip them.

* hexagon: introduce fastdiv, fix test-backend-ops for ADD/SUB/MUL

Co-authored-by: chraac <redacted>
* hexagon: use fastdiv in ADD_ID

* hexagon: use ggml_op_is_empty and ggml_is_empty to check for NOPs

---------

Co-authored-by: chraac <redacted>
2 months agodisable rms norm mul rope for chips with no fp16 rte (llama/17134)
Eve [Tue, 11 Nov 2025 18:53:30 +0000 (18:53 +0000)]
disable rms norm mul rope for chips with no fp16 rte (llama/17134)

2 months agoggml-cpu : add RISC-V RVV (Zvfh) optimization for FP16 to FP32 conversion (llama...
ixgbe [Tue, 11 Nov 2025 11:41:51 +0000 (19:41 +0800)]
ggml-cpu : add RISC-V RVV (Zvfh) optimization for FP16 to FP32 conversion (llama/17161)

Signed-off-by: Wang Yang <redacted>
2 months agoggml-cpu: templateify ggml_compute_forward_rope_f32 and _f16 (llama/16805)
duduta [Tue, 11 Nov 2025 11:33:24 +0000 (13:33 +0200)]
ggml-cpu: templateify ggml_compute_forward_rope_f32 and _f16 (llama/16805)

* extract rotate_pairs logic from ggml_compute_forward_rope_f32

* templateify ggml_compute_forward_rope_f32 and _f16

* abort when rope type not supported, remove GLM from test-rope

* add imrope branch to switch

* add rope tests for perf

* Update ggml/src/ggml-cpu/ops.cpp

Co-authored-by: Georgi Gerganov <redacted>
* Update ggml/src/ggml-cpu/ops.cpp

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

Co-authored-by: Georgi Gerganov <redacted>
2 months agokleidiai: add optimized per-channel kernels for Q8_0 (llama/16993)
Charles Xu [Tue, 11 Nov 2025 11:20:31 +0000 (12:20 +0100)]
kleidiai: add optimized per-channel kernels for Q8_0 (llama/16993)

2 months agocmake : add version to all shared object files (llama/17091)
Mike Abbott [Tue, 11 Nov 2025 11:19:50 +0000 (04:19 -0700)]
cmake : add version to all shared object files (llama/17091)

When compiling llama.cpp in Yocto, it fails QA checks because the generated so files aren't versioned.  This applies a version to all generated so files, allowing the package to build without errors.

2 months agoopencl: add fastdiv and use it in set_rows, ported from cuda (llama/17090)
lhez [Mon, 10 Nov 2025 23:00:13 +0000 (15:00 -0800)]
opencl: add fastdiv and use it in set_rows, ported from cuda (llama/17090)

* opencl: add fastdiv for mm q8_0

* opencl: use uint4 for fastdiv vals

* opencl: use fastdiv for set_rows

* opencl: do not use fastdiv for q8_0 mm

2 months agocpu: skip NOPs to avoid barriers (llama/17133)
Max Krasnyansky [Mon, 10 Nov 2025 20:44:49 +0000 (12:44 -0800)]
cpu: skip NOPs to avoid barriers (llama/17133)

* cpu: skip NOPs to avoid barriers

* cpu: use ggml_op_is_empty

2 months agometal : cap threadgroups size of set_rows (llama/17146)
Georgi Gerganov [Mon, 10 Nov 2025 19:33:35 +0000 (21:33 +0200)]
metal : cap threadgroups size of set_rows (llama/17146)

2 months agoggml-cpu : inspect -march and -mcpu to found the CPU (llama/16333)
Adrien Gallouët [Mon, 10 Nov 2025 19:03:36 +0000 (20:03 +0100)]
ggml-cpu : inspect -march and -mcpu to found the CPU (llama/16333)

Signed-off-by: Adrien Gallouët <redacted>
2 months agovulkan: check glslc executable string (llama/17144)
Ruben Ortlam [Mon, 10 Nov 2025 15:59:26 +0000 (16:59 +0100)]
vulkan: check glslc executable string (llama/17144)

2 months agovulkan: fix validation issue introduced by #16868 (llama/17145)
Ruben Ortlam [Mon, 10 Nov 2025 15:59:10 +0000 (16:59 +0100)]
vulkan: fix validation issue introduced by #16868 (llama/17145)

2 months agometal : enable tensor API for A19 (llama/17087)
Georgi Gerganov [Mon, 10 Nov 2025 13:38:42 +0000 (15:38 +0200)]
metal : enable tensor API for A19 (llama/17087)

2 months agoarm64: add i8mm route with SVE ggml_vec_dot_q4_K_q8_K and ggml_vec_dot_q6_K_… (#15277)
fj-y-saito [Mon, 10 Nov 2025 13:12:59 +0000 (22:12 +0900)]
arm64: add i8mm route with SVE ggml_vec_dot_q4_K_q8_K and ggml_vec_dot_q6_K_… (#15277)

* add i8mm route with SVE ggml_vec_dot_q4_K_q8_K and ggml_vec_dot_q6_K_q8_K

* Surround SVE function with compiler directive

* fix compile switch

* fix coding style

* ggml : fix indent

---------

Co-authored-by: Georgi Gerganov <redacted>
2 months agocuda/vulkan : bicubic interpolation (llama/17022)
Acly [Mon, 10 Nov 2025 09:19:39 +0000 (10:19 +0100)]
cuda/vulkan : bicubic interpolation (llama/17022)

* vulkan : implement upscale with bicubic interpolation

* cuda : implement upscale with bicubic interpolation

* tests : add ggml_interpolate with GGML_SCALE_MODE_BICUBIC to backend tests

* adapt OpenCL backend to not support the OP in that case so tests don't fail

* print scale mode & flags in test-backend-ops

2 months agovulkan: fix memory allocations (llama/17122)
Ruben Ortlam [Sun, 9 Nov 2025 15:14:41 +0000 (16:14 +0100)]
vulkan: fix memory allocations (llama/17122)

2 months agovad : Silero VAD v6.2.0 (#3524)
KITAITI Makoto [Mon, 17 Nov 2025 13:26:17 +0000 (22:26 +0900)]
vad : Silero VAD v6.2.0 (#3524)

* Add ggml-silero-v6.2.0 to download candidates

* Make default VAD model ggml-silero-v6.2.0

* Make VAD model in documentations ggml-silero-v6.2.0

2 months agoruby : VAD separately from ASR (#3518)
KITAITI Makoto [Thu, 13 Nov 2025 01:15:26 +0000 (10:15 +0900)]
ruby : VAD separately from ASR (#3518)

* Add Whisper::VAD::Context

* Add test for Whisper::VAD::Context

* Add Whisper::VAD::Segment

* Add Whisper::VAD::Segments

* Add Whisper::VAD::Context#detect

* Define Whisper::VAD::Segments#each

* Define Whisper::VAD::Segment#start_time and #end_time

* Define Whisper::VAD::Segment#deconstruct_keys

* Add tests for Whisper::VAD family

* Add signatures for VAD family

* Add document on VAD in README

* Define Whisper::VAD::Segments#length

* Add test for Whisper::VAD::Segments#length

* Add signature of Segments#length

* Make vad_segments responsible to initialize VAD::Segments

* Remove meaningless argument check

* Check NULL of segments member

* Add tests for Whisper::VAD::Segments

* Initialize Whisper::VAD::Segment on .allocate

* Add tests for Whisper::VAD::Segment

* Check NULL of context member

* Add test for Whisper::VAD::Context.allocate

2 months agosync : llama.cpp
Georgi Gerganov [Sun, 9 Nov 2025 20:01:21 +0000 (22:01 +0200)]
sync : llama.cpp

2 months agosync : ggml
Georgi Gerganov [Sun, 9 Nov 2025 16:49:56 +0000 (18:49 +0200)]
sync : ggml

2 months agovulkan: iGPU memory reporting fix (llama/17110)
Ruben Ortlam [Sun, 9 Nov 2025 08:54:47 +0000 (09:54 +0100)]
vulkan: iGPU memory reporting fix (llama/17110)

* vulkan: use all device-local heaps for memory availability reporting

Co-authored-by: Giuseppe Scrivano <redacted>
* use all available heaps for iGPU memory reporting

* Allow multiple memory types per buffer request for devices with split heaps

---------

Co-authored-by: Giuseppe Scrivano <redacted>
2 months agovulkan: fix mmq out of bounds reads (llama/17108)
Ruben Ortlam [Sun, 9 Nov 2025 08:52:57 +0000 (09:52 +0100)]
vulkan: fix mmq out of bounds reads (llama/17108)

* vulkan: fix mmq out of bounds reads, streamline outdated matmul host code

* fix mul_mat_id quantization call

* Fix compiler warnings

2 months agovulkan: fuse mul_mat_id + mul (llama/17095)
Jeff Bolz [Sun, 9 Nov 2025 08:48:42 +0000 (02:48 -0600)]
vulkan: fuse mul_mat_id + mul (llama/17095)

* vulkan: fuse mul_mat_id + mul

This comes up in qwen3 moe.

* split mul_mat_id fusion tests into a separate class

2 months agometal : retain src and dst buffers during async ops (llama/17101)
Georgi Gerganov [Sun, 9 Nov 2025 06:28:51 +0000 (08:28 +0200)]
metal : retain src and dst buffers during async ops (llama/17101)

2 months agovulkan: Use spec constants for conv2d s/d/p and kernel W/H (llama/16978)
Jeff Bolz [Sat, 8 Nov 2025 19:24:29 +0000 (13:24 -0600)]
vulkan: Use spec constants for conv2d s/d/p and kernel W/H (llama/16978)

* vulkan: Use spec constants for conv2d s/d/p and kernel W/H

Also add some additional unroll hints, which seems to help.

* lock around map lookup

2 months agoRevert "CUDA: add expert reduce kernel (ggml/16857)" (llama/17100)
Aman Gupta [Sat, 8 Nov 2025 13:05:19 +0000 (21:05 +0800)]
Revert "CUDA: add expert reduce kernel (ggml/16857)" (llama/17100)

2 months agoCUDA: skip fusion for repeating adds in bias (llama/17080)
Aman Gupta [Sat, 8 Nov 2025 08:58:05 +0000 (16:58 +0800)]
CUDA: skip fusion for repeating adds in bias (llama/17080)

2 months agovulkan: Increase BK to 32; use BK/4 for non-CM mul_mm.comp (llama/16636)
SavicStefan [Sat, 8 Nov 2025 08:28:22 +0000 (09:28 +0100)]
vulkan: Increase BK to 32; use BK/4 for non-CM mul_mm.comp (llama/16636)

Signed-off-by: Stefan Savic <redacted>
Co-authored-by: Stefan Savic <redacted>
2 months agoggml: disable vxe for cross-compilation by default (llama/16966)
Aleksei Nikiforov [Sat, 8 Nov 2025 08:00:20 +0000 (09:00 +0100)]
ggml: disable vxe for cross-compilation by default (llama/16966)

Otherwise compilation will fail due to enabling -mvx -mzvector
and not setting corresponding -march options.

2 months agovulkan: fuse rms_norm + mul + rope (+ view + set_rows) (llama/16977)
Jeff Bolz [Sat, 8 Nov 2025 07:52:15 +0000 (01:52 -0600)]
vulkan: fuse rms_norm + mul + rope (+ view + set_rows) (llama/16977)

This change combines the rms_norm+mul and rope+view+set_rows fusions to
allow fusing the whole sequence together. This comes up in Qwen3, Bailing,
and some other models.

2 months agovulkan: Fix test-thread-safety crashes (llama/17024)
Jeff Bolz [Sat, 8 Nov 2025 07:39:45 +0000 (01:39 -0600)]
vulkan: Fix test-thread-safety crashes (llama/17024)

The std::map pipeline_flash_attn_f32_f16 could be searched and inserted at the
same time, which needs to hold the lock. To be safe, hold the lock for all of
ggml_vk_load_shaders.

2 months agoCUDA: fix MMQ stream-k fixup ne1 indices (llama/17089)
Johannes Gäßler [Sat, 8 Nov 2025 07:26:18 +0000 (08:26 +0100)]
CUDA: fix MMQ stream-k fixup ne1 indices (llama/17089)

2 months agoggml webgpu: faster matrix multiplication/matrix-vector multiplication (llama/17031)
Reese Levine [Sat, 8 Nov 2025 03:27:20 +0000 (19:27 -0800)]
ggml webgpu: faster matrix multiplication/matrix-vector multiplication (llama/17031)

* Faster tensors (llama/8)

Add fast matrix and matrix/vector multiplication.

* Use map for shader replacements instead of pair of strings

2 months agoCUDA: properly handle nb00=nb02 case for cpy (llama/17081)
bssrdf [Fri, 7 Nov 2025 22:41:58 +0000 (17:41 -0500)]
CUDA: properly handle nb00=nb02 case for cpy (llama/17081)

2 months agovulkan : refactor buffer handling in vk_op_f32 (llama/16840)
Acly [Fri, 7 Nov 2025 20:08:50 +0000 (21:08 +0100)]
vulkan : refactor buffer handling in vk_op_f32 (llama/16840)

* vulkan : refactor/simplify buffer handling in vk_op_* functions

* Combine UMA handling into ggml_vk_tensor_subbuffer

2 months agoCUDA: fix should_use_mmvf for ne11 == 1 (llama/17085)
Johannes Gäßler [Fri, 7 Nov 2025 19:53:14 +0000 (20:53 +0100)]
CUDA: fix should_use_mmvf for ne11 == 1 (llama/17085)

* CUDA: fix should_use_mmvf for ne11 == 1

* Apply suggestion from @am17an

Co-authored-by: Aman Gupta <redacted>
---------

Co-authored-by: Aman Gupta <redacted>
2 months agoRevert "ggml-cpu: detect correct cpu flags for arm64 (llama/16229) (#16239)" (llama...
Adrien Gallouët [Fri, 7 Nov 2025 16:34:05 +0000 (17:34 +0100)]
Revert "ggml-cpu: detect correct cpu flags for arm64 (llama/16229) (#16239)" (llama/17084)

This reverts commit 7c23f3f0d4b9f5d6ea140756eb694b562d5acebb.

2 months agoggml-cpu: detect correct cpu flags for arm64 (ggml/16229) (llama/16239)
iron [Fri, 7 Nov 2025 16:18:14 +0000 (00:18 +0800)]
ggml-cpu: detect correct cpu flags for arm64 (ggml/16229) (llama/16239)

When using GCC 9 and GCC 12 on the arm64 platform of ubuntu 2004,
the command "gcc -mcpu=native -E -v -" fails to detect the correct CPU flags,
which results in compilation failures for certain extended instructions,
but the correct CPU flags can be obtained by using gcc -march.

Signed-off-by: lizhenneng <redacted>
Co-authored-by: lizhenneng <redacted>
2 months agoggml-cpu : optimize RVV q2_k and q3_k kernels (llama/16887)
xctan [Thu, 6 Nov 2025 16:12:45 +0000 (00:12 +0800)]
ggml-cpu : optimize RVV q2_k and q3_k kernels (llama/16887)

2 months agoCUDA: fix crash on uneven context without FA (llama/16988)
Johannes Gäßler [Thu, 6 Nov 2025 13:05:47 +0000 (14:05 +0100)]
CUDA: fix crash on uneven context without FA (llama/16988)

2 months agometal : initial Metal4 tensor API support (llama/16634)
Georgi Gerganov [Thu, 6 Nov 2025 12:45:10 +0000 (14:45 +0200)]
metal : initial Metal4 tensor API support (llama/16634)

* metal : rework mat-mat multiplication

* metal : initial Metal4 support

* cont

* metal : detect tensor support

* cont : better ifdefs

* metal : support tensors in mul_mm_id

* metal : add env for disabling tensor API

* tests : restore

* metal : remove unused constants

* metal : fix check for bfloat tensor support

* cont : handle API incompatibilities

* cont : handle even more incompatibilities

* metal : use tensor API only on M5 and later

2 months agosycl: add CONCAT operator support (llama/16047)
YehuditE [Thu, 6 Nov 2025 10:02:33 +0000 (12:02 +0200)]
sycl: add CONCAT operator support (llama/16047)

* sycl: add CONCAT operator support

* cleanup: remove stray lines added by mistake

* fix: code format issues in concat.cpp and tests/test-backend-ops.cpp

* chore: fix editorconfig violations

* cleanup: drop unnecessary i16 type support

* docs: update sycl-csv and regenerate ops.md

* update docs/ops.md

* fix: adapt to upstream master changes after rebase

* fix: remove empty files

* fix: drop whitespace

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agoggml-hexagon: graceful fallback for older socs where rpcmem_alloc2 and FASTRPC_GET_UR...
l3utterfly [Thu, 6 Nov 2025 05:46:38 +0000 (13:46 +0800)]
ggml-hexagon: graceful fallback for older socs where rpcmem_alloc2 and FASTRPC_GET_URI is unsupported (llama/16987)

* support older socs where FASTRPC_GET_URI is unsupported

* added graceful fallback when FASTRPC_GET_URI call fails

* use weak symbols instead of loading libcdsprpc.so dynamically

* Add weak pragma for rpcmem_alloc2

* Remove weak declaration for rpcmem_alloc2 in ggml-hexagon.cpp

Removed weak declaration for rpcmem_alloc2.

* Enforce ndev to 1 for archs below v75

Force ndev to 1 for SoCs architectures lower than v75.

2 months agoimprove CUDA cpy memory bandwidth when copying transposed tensor (llama/16841)
bssrdf [Wed, 5 Nov 2025 20:55:04 +0000 (15:55 -0500)]
improve CUDA cpy memory bandwidth when copying transposed tensor (llama/16841)

* WIP

* added a cpy kernel specific to transposed tensor which uses smem to avoid uncoalesced access; test cases also added shwoing improved memory bandwidth

* added BF16 support

* more strict check to make sure src0 is a transpose

* reformulated to handle more complicated transpose cases

* bring back 2D transpose for higher performance

* allow build on windows

* tranpose copy more shapes

* minor tweak

* final clean up

* restore some test cases

* keep only the kernel for true tranposed case; updated with review suggestions

* make CI happy

* remove headers not needed

* reduced bank conflicts for fp16 and bf16

* add missing const*

* now bank conflicts free

* use padding instead of swizzling

---------

Co-authored-by: bssrdf <redacted>
2 months agovulkan: Fix GGML_VULKAN_CHECK_RESULTS to better handle fusion (llama/16919)
Jeff Bolz [Wed, 5 Nov 2025 18:51:03 +0000 (12:51 -0600)]
vulkan: Fix GGML_VULKAN_CHECK_RESULTS to better handle fusion (llama/16919)

2 months agoggml webgpu: minor set rows optimization (llama/16810)
Reese Levine [Sun, 9 Nov 2025 12:44:39 +0000 (14:44 +0200)]
ggml webgpu: minor set rows optimization (llama/16810)

* Add buffer label and enable dawn-specific toggles to turn off some checks

* Minor set_rows optimization (ggml/4)

* updated optimization, fixed errors

* non vectorized version now dispatches one thread per element

* Simplify

* Change logic for set_rows pipelines

---------

Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Reese Levine <redacted>
* Comment on dawn toggles

* Remove some comments

* Implement overlap binary operators

* Revert "Implement overlap binary operators"

This reverts commit ed710b36f51ab3f53fa13db15c1685dc8678a32a.

* Disable support for non-contiguous binary_op tensors and leave note for future support

---------

Co-authored-by: neha-ha <redacted>
Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Neha Abbas <redacted>
2 months agorefactor: replace sprintf with snprintf for safer string handling in dump functions...
nullname [Tue, 4 Nov 2025 20:25:39 +0000 (04:25 +0800)]
refactor: replace sprintf with snprintf for safer string handling in dump functions (llama/16913)

2 months agovulkan: remove the need for the dryrun (llama/16826)
Jeff Bolz [Tue, 4 Nov 2025 19:28:17 +0000 (13:28 -0600)]
vulkan: remove the need for the dryrun (llama/16826)

* vulkan: remove the need for the dryrun

Allocate pipelines and descriptor sets when requested.

Reallocate the prealloc buffers when needed, and flush any pending work
before reallocating.

For rms_partials and total_mul_mat_bytes, use the sizes computed the last time
the graph was executed.

* remove dryrun parameters

2 months agoggml-cpu : bicubic interpolation (llama/16891)
Acly [Tue, 4 Nov 2025 12:12:20 +0000 (13:12 +0100)]
ggml-cpu : bicubic interpolation (llama/16891)

2 months agoFix garbled output with REPACK at high thread counts (llama/16956)
Noah [Tue, 4 Nov 2025 05:04:59 +0000 (05:04 +0000)]
Fix garbled output with REPACK at high thread counts (llama/16956)

* Fix garbled output with REPACK at high thread counts

Fixed a race condition in the REPACK matrix multiplication code that caused garbled output when using 26+ threads (model-dependent threshold). The issue occurred because with high thread counts, the code forced chunk count to equal thread count, creating many small chunks. After aligning these chunks to NB_COLS boundaries, adjacent chunks could overlap, causing data corruption and race conditions. The fix enforces minimum chunk sizes based on NB_COLS and caps maximum chunk count to prevent creating too many tiny chunks, ensuring proper alignment without overlaps.

* Update ggml/src/ggml-cpu/repack.cpp

Co-authored-by: Georgi Gerganov <redacted>
* Update ggml/src/ggml-cpu/repack.cpp

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

Co-authored-by: Georgi Gerganov <redacted>
2 months agoCUDA: avoid mul + bias fusion when doing fusion (llama/16935)
Aman Gupta [Tue, 4 Nov 2025 02:53:48 +0000 (10:53 +0800)]
CUDA: avoid mul + bias fusion when doing fusion (llama/16935)

2 months agoopencl: support imrope (llama/16914)
lhez [Mon, 3 Nov 2025 19:47:57 +0000 (11:47 -0800)]
opencl: support imrope (llama/16914)

* opencl: support imrope

* opencl: fix whitespace

2 months agoggml: CUDA: add head size 72 for flash-attn (llama/16962)
theo77186 [Mon, 3 Nov 2025 13:29:11 +0000 (14:29 +0100)]
ggml: CUDA: add head size 72 for flash-attn (llama/16962)

2 months agoggml : LoongArch fixes (llama/16958)
Jinyang He [Mon, 3 Nov 2025 06:40:02 +0000 (14:40 +0800)]
ggml : LoongArch fixes (llama/16958)

* Fix test-quantize-fns f16 and q4_0 failed when use LSX

* Fix LoongArch set float intrinsic when use LSX/LASX

2 months agoSYCL: optimized repeat_back kernel (3× fewer asm instructions, 2× faster)Feature...
shani-f [Mon, 3 Nov 2025 01:35:33 +0000 (03:35 +0200)]
SYCL: optimized repeat_back kernel (3× fewer asm instructions, 2× faster)Feature/sycl repeat back opt (#16869)

* SYCL repeat_back v1 — add core op + switch case

* Implement repeat_back SYCL operation and minor fixes

* SYCL: optimize repeat_back kernel

* Remove Hebrew comment from repeat_back.cpp

* Remove comments for code clarity

Removed comments to clean up the code.

* Fix formatting in ggml-sycl.cpp

* Formatted lambda according to legacy style. No logic changes

* Remove blank line in repeat_back.cpp

Remove unnecessary blank line before assigning acc to dst_dd.

2 months agoclip : use FA (llama/16837)
Georgi Gerganov [Sun, 2 Nov 2025 20:21:48 +0000 (22:21 +0200)]
clip : use FA (llama/16837)

* clip : use FA

* cont : add warning about unsupported ops

* implement "auto" mode for clip flash attn

* clip : print more detailed op support info during warmup

* cont : remove obsolete comment [no ci]

* improve debugging message

* trailing space

* metal : remove stray return

---------

Co-authored-by: Xuan Son Nguyen <redacted>
2 months agoCUDA: add FLOOR, CEIL, ROUND, TRUNC unary ops (llama/16917)
mnehete32 [Sun, 2 Nov 2025 03:12:57 +0000 (08:42 +0530)]
CUDA: add FLOOR, CEIL, ROUND, TRUNC unary ops (llama/16917)

2 months agoggml: add s390x cpu-feats (llama/16774)
Aaron Teo [Sun, 2 Nov 2025 00:48:23 +0000 (08:48 +0800)]
ggml: add s390x cpu-feats (llama/16774)

2 months agovulkan: Fix multi_add invalid descriptor usage (llama/16899)
Jeff Bolz [Sat, 1 Nov 2025 05:52:14 +0000 (00:52 -0500)]
vulkan: Fix multi_add invalid descriptor usage (llama/16899)

2 months agovulkan: fuse mul_mat+add and mul_mat_id+add_id (llama/16868)
Jeff Bolz [Sat, 1 Nov 2025 05:45:28 +0000 (00:45 -0500)]
vulkan: fuse mul_mat+add and mul_mat_id+add_id (llama/16868)

* vulkan: fuse mul_mat+add and mul_mat_id+add_id

The fusion is only applied for the mat-vec mul paths.

* Apply suggestions from code review

Co-authored-by: Sigbjørn Skjæret <redacted>
* fix 32b build

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agoCUDA: Remove unneded bias/gate dims in fused mmvq (llama/16858)
Oliver Simons [Sat, 1 Nov 2025 05:13:26 +0000 (06:13 +0100)]
CUDA: Remove unneded bias/gate dims in fused mmvq (llama/16858)

* CUDA: Remove unneded bias/gate dims in fused mmvq

Pointed out
[here](https://github.com/ggml-org/llama.cpp/pull/16847#discussion_r2476798989)
that only a single value is needed per target col per thread

* Apply suggestions from code review

Co-authored-by: Johannes Gäßler <redacted>
* Fix "Error 991-D: extra braces are nonstandard" during compilation

---------

Co-authored-by: Johannes Gäßler <redacted>
2 months agoCUDA: Volta tensor core support for MMF (llama/16843)
Johannes Gäßler [Fri, 31 Oct 2025 14:57:19 +0000 (15:57 +0100)]
CUDA: Volta tensor core support for MMF (llama/16843)

* CUDA: Volta tensor core support for MMF

* more generic checks for hardware support

* Update ggml/src/ggml-cuda/mmf.cuh

Co-authored-by: Aman Gupta <redacted>
---------

Co-authored-by: Aman Gupta <redacted>
2 months agoggml : fix conv2d_dw SVE path (ggml/1380)
Georgi Gerganov [Tue, 4 Nov 2025 18:40:52 +0000 (20:40 +0200)]
ggml : fix conv2d_dw SVE path (ggml/1380)

* Fix test-conv2d-dw failure on ARM SVE by using runtime vector length

The ggml_compute_forward_conv_2d_dw_cwhn function was using a hardcoded GGML_F32_EPR (8) for SIMD vectorization, but on ARM SVE the actual vector length varies by hardware. This caused incorrect computation when processing CWHN layout tensors on ARM machines.

Fix by using svcntw() to get the runtime SVE vector length instead of the compile-time constant.

Co-authored-by: ggerganov <redacted>
* ci : reduce sam score threshold

* ci : update bbox checks for sam test

---------

Co-authored-by: copilot-swe-agent[bot] <redacted>
Co-authored-by: ggerganov <redacted>
2 months agoCUDA: add expert reduce kernel (llama/16857)
Aman Gupta [Fri, 31 Oct 2025 12:05:07 +0000 (20:05 +0800)]
CUDA: add expert reduce kernel (llama/16857)

* CUDA: add expert reduce kernel

* contigous checks, better formatting, use std::vector instead of array

* use vector empty instead of size

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

Co-authored-by: Johannes Gäßler <redacted>
2 months agovulkan: disable spirv-opt for rope shaders (llama/16872)
Jeff Bolz [Fri, 31 Oct 2025 07:34:47 +0000 (02:34 -0500)]
vulkan: disable spirv-opt for rope shaders (llama/16872)

2 months agovulkan: Fix crash when FP16 mul_mat accumulation is not supported (llama/16796)
Masato Nakasaka [Fri, 31 Oct 2025 07:18:59 +0000 (16:18 +0900)]
vulkan: Fix crash when FP16 mul_mat accumulation is not supported (llama/16796)

* Experimenting crash fix

* added assert for aborting and fixed comment

* changed to check if a pipeline is empty or not

* Moved function in class definition

* replaced with is_empty

* Modified is_empty to check only unaligned pipelines

2 months agovulkan: fix shmem overrun in mmq id shader (llama/16873)
Ruben Ortlam [Fri, 31 Oct 2025 07:14:49 +0000 (08:14 +0100)]
vulkan: fix shmem overrun in mmq id shader (llama/16873)

* vulkan: fix shmem overrun in mmq id shader

* metal : fix mul_mm_id

---------

Co-authored-by: Georgi Gerganov <redacted>
2 months agoggml-hexagon: respect input size when getting/setting tensor data (llama/16836)
l3utterfly [Fri, 31 Oct 2025 04:46:31 +0000 (12:46 +0800)]
ggml-hexagon: respect input size when getting/setting tensor data (llama/16836)

* respect input size when getting/setting tensor data

allows partial repacking/copying when get tensor size is smaller than the actual tensor

* Removed duplicate repack_mxfp4_mxfp4x4x2 function

2 months agoopencl: fix boundary handling for mul_mm (llama/16875)
lhez [Thu, 30 Oct 2025 23:00:20 +0000 (16:00 -0700)]
opencl: fix boundary handling for mul_mm (llama/16875)

2 months agocpu: introduce chunking for repack matmuls and enable matmul-id chunking on ARM64...
Max Krasnyansky [Thu, 30 Oct 2025 16:06:13 +0000 (09:06 -0700)]
cpu: introduce chunking for repack matmuls and enable matmul-id chunking on ARM64 (llama/16833)

Very similar implementation to the flash-attention chunking, with similar benefits.

2 months agomodel: add support for qwen3vl series (llama/16780)
JJJYmmm [Thu, 30 Oct 2025 15:19:14 +0000 (23:19 +0800)]
model: add support for qwen3vl series (llama/16780)

* support qwen3vl series.

Co-authored-by: Thireus ☠ <redacted>
Co-authored-by: yairpatch <redacted>
Co-authored-by: LETS-BEE <redacted>
* bugfix: fix the arch check for qwen3vl-moe.

* use build_ffn

* optimize deepstack structure

* optimize deepstack feature saving

* Revert "optimize deepstack feature saving" for temporal fix

This reverts commit f321b9fdf13e59527408152e73b1071e19a87e71.

* code clean

* use fused qkv in clip

* clean up / rm is_deepstack_layers for simplification

* add test model

* move test model to "big" section

* fix imrope check

* remove trailing whitespace

* fix rope fail

* metal : add imrope support

* add imrope support for sycl

* vulkan: add imrope w/o check

* fix vulkan

* webgpu: add imrope w/o check

* Update gguf-py/gguf/tensor_mapping.py

Co-authored-by: Sigbjørn Skjæret <redacted>
* fix tensor mapping

---------

Co-authored-by: Thireus ☠ <redacted>
Co-authored-by: yairpatch <redacted>
Co-authored-by: LETS-BEE <redacted>
Co-authored-by: Xuan Son Nguyen <redacted>
Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agocpu: introduce chunking for flash attention (llama/16829)
Max Krasnyansky [Thu, 30 Oct 2025 12:26:05 +0000 (05:26 -0700)]
cpu: introduce chunking for flash attention (llama/16829)

Factor out the core FA loop into flash_atten_f16_one_chunk and add an outter loop
on top that handles the chunks.

2 months agocuda : fix argsort with 64k+ rows (llama/16849)
Sigbjørn Skjæret [Thu, 30 Oct 2025 07:56:28 +0000 (08:56 +0100)]
cuda : fix argsort with 64k+ rows (llama/16849)

2 months agovulkan: Handle argsort with a large number of rows (llama/16851)
Jeff Bolz [Thu, 30 Oct 2025 06:27:41 +0000 (01:27 -0500)]
vulkan: Handle argsort with a large number of rows (llama/16851)

2 months agoHide latency of bias and gate-loading (llama/16847)
Oliver Simons [Thu, 30 Oct 2025 03:34:15 +0000 (04:34 +0100)]
Hide latency of bias and gate-loading (llama/16847)

This is realised by loading them into registers before computation of
the dot-product, effectively batching them together with said
dot-product. As a lot of threads are alive here, the warp scheduler has
enough threads available to effectively hide the cost of additionally
loading those two floats.

2 months agovulkan: Fuse rope+set_rows (llama/16769)
Jeff Bolz [Wed, 29 Oct 2025 20:13:10 +0000 (15:13 -0500)]
vulkan: Fuse rope+set_rows (llama/16769)

This pattern appears in a lot of models, the rope operation is applied right
before storing into the KV cache (usually on the K tensor).

Add a path to some of the rope shaders that computes the destination address
based on the set_rows tensor. Compile variants of the shader with D_TYPE of
f16 (the usual KV cache type).

Add a src3 operand to ggml_vk_op_f32 - sometimes rope uses three srcs and needs
the fourth for the row indices.

Add fused_ops_write_mask to indicate which intermediate tensors need to write
their results to memory. Skipping writing the roped K value helps to allow more
nodes to run concurrently.

Add logic to ggml_vk_graph_optimize to make ROPE+VIEW+SET_ROWS consecutive. It
rarely starts out that way in the graph.

Add new backend tests.

2 months agovulkan: Update topk_moe fusion to handle gpt's late softmax (llama/16656)
Jeff Bolz [Wed, 29 Oct 2025 13:44:29 +0000 (08:44 -0500)]
vulkan: Update topk_moe fusion to handle gpt's late softmax (llama/16656)

* vulkan: Update topk_moe fusion to handle gpt's late softmax

Based on #16649.

* Add ggml_check_edges

* Add sync logging to show fusion effects

* handle clamp added in #16655

* Update ggml/src/ggml-impl.h

Co-authored-by: Diego Devesa <redacted>
2 months agoVulkan MMQ Integer Dot Refactor and K-Quant support (llama/16536)
Ruben Ortlam [Wed, 29 Oct 2025 13:39:03 +0000 (14:39 +0100)]
Vulkan MMQ Integer Dot Refactor and K-Quant support (llama/16536)

* vulkan: add mmq q2_k integer dot support

* Refactor mmq caching

* Reduce mmq register use

* Load 4 quant blocks into shared memory in one step

* Pack q2_k blocks into caches of 32

* Use 32-bit accumulators for integer dot matmul

* Add q4_k mmq

* Add q3_k mmq

* Add q5_k mmq

* Add q6_k mmq

* Add mxfp4 mmq, enable MMQ MUL_MAT_ID

* Fix mmv dm loads

2 months agoHexagon Op queue & dispatch optimizations (llama/16820)
Max Krasnyansky [Wed, 29 Oct 2025 13:29:12 +0000 (06:29 -0700)]
Hexagon Op queue & dispatch optimizations (llama/16820)

* hexagon: remove dspqueue callbacks and do all read processing inplace

* hexagon: there is no need to ref/deref the buffers at this point

We're not going to release the buffers without flushing the session queue.
So there is no need to inc/dec the refcounts for every request.
We also don't need to include those bufs in the response.

* hexagon: bump the thread count in the adb wrapper scripts

We can use more CPU cores now that the dedicated dspqueue polling threads are not used (ie no contention).
Also enable more agressive polling for now since we still map Flash Attention (and a few other kernels) to
the CPU and those dspqueue threads were keeping the CPU cores are higher clock freqs.

* hexagon: add lhez as the second code owner

2 months agoCUDA: use fastdiv in set-rows (llama/16834)
Aman Gupta [Wed, 29 Oct 2025 13:11:53 +0000 (21:11 +0800)]
CUDA: use fastdiv in set-rows (llama/16834)

* CUDA: use fastdiv in set-rows

* add assert about value fitting in u32

2 months agovulkan: Call ggml_vk_buffer_write_2d from ggml_vk_buffer_copy (llama/16793)
Jeff Bolz [Wed, 29 Oct 2025 08:53:04 +0000 (03:53 -0500)]
vulkan: Call ggml_vk_buffer_write_2d from ggml_vk_buffer_copy (llama/16793)

This lets the copy to the destination device use the host-visible
vidmem optimization.

2 months agoCUDA: Fix bug in topk-moe for gpt-oss (llama/16821)
Aman Gupta [Wed, 29 Oct 2025 07:55:06 +0000 (15:55 +0800)]
CUDA: Fix bug in topk-moe for gpt-oss (llama/16821)

* CUDA: Fix bug in topk-moe for gpt-oss

When using ggml_can_fuse_subgraph, the output nodes which are passed are wrong. This causes `test-backend-ops` to still fuse ndoes (because the nodes are not used elsewhere in the graph),
but it actually doesn't fuse in the actual gpt-oss

* fix for qwen3 too

* change ifndef to ifdef

2 months agosycl: add RMS_NORM_BACK operation support (llama/16808)
YaelLogic [Wed, 29 Oct 2025 06:14:39 +0000 (08:14 +0200)]
sycl: add RMS_NORM_BACK operation support (llama/16808)

* sycl: add RMS_NORM_BACK operation support

* sycl: rms_norm_back: add dual reduction paths (FP64 and FP32) and savepoint before further changes

* sycl: add RMS_NORM_BACK support

Implement RMS_NORM_BACK for the SYCL backend using FP32 compensated parallel reduction. Minimal docs updates (ops.md / SYCL.csv).

* revert: restore .gitignore and tools/run/CMakeLists.txt to upstream

* revert: restore tests/CMakeLists.txt to upstream

* sycl: optimize rms_norm_back

* fix: restore SYCL.csv to correct state with RMS_NORM_BACK support

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

Co-authored-by: Neo Zhang Jianyu <redacted>
* fix: remove trailing whitespace and add missing newline (EditorConfig)

---------

Co-authored-by: Neo Zhang Jianyu <redacted>
2 months agocuda: add SET operation support (llama/16804)
YaelGitAccount [Tue, 28 Oct 2025 19:10:28 +0000 (21:10 +0200)]
cuda: add SET operation support (llama/16804)

* feat(cuda): add GGML_OP_SET support

Implement CUDA kernel for SET operation with f32 support.

All tests passing (14598/14598).

* cuda(set): add I32 support; keep F32

* refactor(cuda): use ggml_cuda_cpy to unify SET operator logic and remove code duplication

* Update ggml/src/ggml-cuda/ggml-cuda.cu

Co-authored-by: Sigbjørn Skjæret <redacted>
* Update ggml/src/ggml-cuda/set.cu

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

Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agoinitialise buffer.device in ggml_hexagon_session (llama/16816)
l3utterfly [Tue, 28 Oct 2025 15:16:20 +0000 (23:16 +0800)]
initialise buffer.device in ggml_hexagon_session (llama/16816)

2 months agoCANN: Improve device ID handling and aclnnArange checks (llama/16752)
Chenguang Li [Tue, 28 Oct 2025 02:54:53 +0000 (10:54 +0800)]
CANN: Improve device ID handling and aclnnArange checks (llama/16752)

* cann: improve device ID handling and aclnnArange checks

- Stop relying on CANN's internal device ID retrieval; use a global variable instead.
- Enforce stricter dimension validation in aclnnArange for better compatibility across CANN versions.

* cann: use thread local var

2 months agoCUDA: add unused vars to mmvf and mmvq (llama/16807)
Aman Gupta [Tue, 28 Oct 2025 02:31:21 +0000 (10:31 +0800)]
CUDA: add unused vars to mmvf and mmvq (llama/16807)

2 months agosycl: add SSM_CONV operation support (llama/16800)
tamarPal [Tue, 28 Oct 2025 01:50:33 +0000 (03:50 +0200)]
sycl: add SSM_CONV operation support (llama/16800)

* feat: Add SYCL backend support for SSM_CONV operator

* Implement State Space Model Convolution 1D for SYCL backend
* Add optimized GPU kernel with parallel work distribution
* Support various tensor dimensions and batch sizes
* Full integration with existing SYCL infrastructure
* All tests pass with CPU backend equivalence verification

* feat: Implement SYCL backend support for SSM_CONV operation

- Add ggml-sycl/ssm_conv.cpp and ssm_conv.hpp
- Implement SYCL kernel for state space model convolution
- Ensure numerical correctness matches CPU implementation exactly
- Add proper type checking for F32 tensors in backend support
- All test-backend-ops SSM_CONV tests pass (14490/14490)

* Perfect SSM_CONV SYCL implementation - 100% CPU parity

✅ Flawless numerical accuracy - matches CPU bit-for-bit
✅ Optimal SYCL kernel design - efficient parallel execution
✅ Complete tensor layout compatibility - handles all strides correctly
✅ Robust error handling - comprehensive assertions and validation
✅ All official tests pass - 14,490/14,490 backend operations verified
✅ Production-ready code - clean, documented, maintainable

Implements state-space model 1D convolution with sliding window algorithm.
Eliminates blocking queue.wait() for better async performance.

* Clean SSM_CONV code - remove all comments for production

Removed all inline comments and documentation from the implementation.
Clean, minimal code ready for production merge.

* fix: Final formatting corrections for CI compliance

- Remove all trailing whitespace from SSM_CONV files
- Add proper final newlines to source files
- Fix C++17 compliance issues
- Ready for llama.cpp CI validation

* sycl: fix trailing whitespace and minor safety casts in ssm_conv

* fix: Clean up duplicated content in ssm_conv.hpp header file

---------

Co-authored-by: tamarPal <redacted>
2 months agoggml : fix interpolate with align-corners and ne=1 (llama/16700)
Acly [Mon, 27 Oct 2025 20:50:22 +0000 (21:50 +0100)]
ggml : fix interpolate with align-corners and ne=1 (llama/16700)

* ggml : fix interpolate with align-corners and ne=1

* avoid division by zero if one of the spatial dimensions is 1
* cpu, cuda, opencl returned correct result anyway due to clamp
* vulkan didn't clamp for align-corners so results were broken

* fix clang warning

2 months agoHIP: fix AMDGPU_TARGETS, update documentation (llama/16803)
Johannes Gäßler [Mon, 27 Oct 2025 20:39:49 +0000 (21:39 +0100)]
HIP: fix AMDGPU_TARGETS, update documentation (llama/16803)

2 months agosycl: add ROLL operation support (llama/16665)
tamarPal [Mon, 27 Oct 2025 01:20:24 +0000 (03:20 +0200)]
sycl: add ROLL operation support (llama/16665)

* sycl: add ROLL operation support

- Implement ggml_sycl_roll function for F32 tensors
- Add multi-axis roll operation with SYCL kernel
- Support all 4 tensor dimensions with proper shift normalization
- Add roll.cpp and roll.hpp to SYCL backend
- Update backend dispatch and supports_op for GGML_OP_ROLL
- Tests: 17662/17662 pass with identical CPU reference results

* fix: remove trailing whitespace from roll.cpp

- Fix EditorConfig violations in ggml/src/ggml-sycl/roll.cpp
- Remove trailing spaces from lines 6, 11, 28, 47, 58, 60

* ci: retrigger

* sycl: remove wait() calls from ROLL operation

* fix: editorconfig — LF endings + final newline for roll.hpp

---------

Co-authored-by: tamarPal <redacted>