]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/log
pkg/ggml/sources/whisper.cpp
3 months agoggml: `gguf_init_from_callback` and `gguf_init_from_buffer` (llama/22341)
Gilad S [Mon, 25 May 2026 09:33:29 +0000 (11:33 +0200)]
ggml: `gguf_init_from_callback` and `gguf_init_from_buffer` (llama/22341)

* ggml: implement `gguf_init_from_buffer`

* test: `gguf_init_from_buffer`

* fix: memory breakdown for a model loaded with `no_alloc` from a file is consistent with being loaded from a buffer

* fix: use `GGML_UNUSED`

Co-authored-by: Copilot <redacted>
* fix: remove `total_size` from `gguf_reader`

* fix: file offset calculation, rename `offset` to `data_offset`

Co-authored-by: Copilot <redacted>
* refactor: extract model loader bug fixes to another PR

* feat: add `gguf_init_from_callback`

* fix: always require a max expected size

* fix: change `gguf_reader_callback_t`'s `output` type to `void *`, change `max_expected_size` and offsets to `uint64_t`

* fix: harden against offset overflow in buffer read

* fix: remove seek behavior from the callback

* feat: `max_chunk_read == 0` means `SIZE_MAX`

* fix: seeking in a gguf file with no tensors

---------

Co-authored-by: Copilot <redacted>
3 months agoreadme : add AMD ROCm/HIP GPU build instructions (#3823)
Kaihui-AMD [Mon, 25 May 2026 09:27:42 +0000 (17:27 +0800)]
readme : add AMD ROCm/HIP GPU build instructions (#3823)

Signed-off-by: Kaihui-AMD <redacted>
3 months agotalk-llama : sync llama.cpp
Georgi Gerganov [Mon, 25 May 2026 09:18:31 +0000 (12:18 +0300)]
talk-llama : sync llama.cpp

3 months agosync : ggml
Georgi Gerganov [Mon, 25 May 2026 09:14:40 +0000 (12:14 +0300)]
sync : ggml

3 months agoggml : bump version to 0.12.1 (ggml/1508)
Georgi Gerganov [Mon, 25 May 2026 09:13:21 +0000 (12:13 +0300)]
ggml : bump version to 0.12.1 (ggml/1508)

3 months agoggml : Parallelize quant LUT init (llama/23595)
Jeff Bolz [Mon, 25 May 2026 07:15:46 +0000 (02:15 -0500)]
ggml : Parallelize quant LUT init (llama/23595)

- Use OpenMP to parallelize iq2xs_init_impl and iq3xs_init_impl.
- Move the OpenMP detection from ggml-cpu to ggml-base.
- Update OpenMP dependencies in ggml-config.cmake.in.

3 months agoTP: fix entirely zero-sized slices per device (llama/23525)
Johannes Gäßler [Sun, 24 May 2026 06:19:33 +0000 (08:19 +0200)]
TP: fix entirely zero-sized slices per device (llama/23525)

3 months agoopencl: batch profiling to improve speed and prevent memory leaks (llama/23495)
shaofeiqi [Sun, 24 May 2026 06:11:43 +0000 (23:11 -0700)]
opencl: batch profiling to improve speed and prevent memory leaks (llama/23495)

3 months agohexagon: apply repl optimization in flash attn softmax as #22993 (llama/23455)
Yiwei Shao [Sun, 24 May 2026 02:56:59 +0000 (19:56 -0700)]
hexagon: apply repl optimization in flash attn softmax as #22993 (llama/23455)

3 months agoggml : Check the right iface method before using the fallback 2d get (llama/23514)
dskwe [Sat, 23 May 2026 10:49:24 +0000 (18:49 +0800)]
ggml : Check the right iface method before using the fallback 2d get (llama/23514)

3 months agovulkan: fix windows find_package of SPIRV-Headers (llama/23215)
Jeff Bolz [Sat, 23 May 2026 07:44:46 +0000 (02:44 -0500)]
vulkan: fix windows find_package of SPIRV-Headers (llama/23215)

* vulkan: fix windows find_package of SPIRV-Headers

* not windows-only

3 months agoopencl: generalize Adreno MoE kernels on M (llama/23449)
Shawn Gu [Sat, 23 May 2026 00:08:41 +0000 (17:08 -0700)]
opencl: generalize Adreno MoE kernels on M (llama/23449)

3 months agoSYCL: improve MoE prefill throughput (llama/23142)
Alexey Kopytko [Fri, 22 May 2026 12:50:17 +0000 (21:50 +0900)]
SYCL: improve MoE prefill throughput (llama/23142)

- change `k_copy_src1_to_contiguous` so that uses a precomputed contiguous mapping where all rows "owned" by an expert are in one slice with a know starts and ends
- switch the `O(n_as * n_routed_rows)` contraption to a counting sort-based procedure with `O(n_as + n_routed_rows)` complexity

3 months agosycl : Level Zero detection in ggml_sycl_init (llama/23097)
Alexey Kopytko [Fri, 22 May 2026 12:49:45 +0000 (21:49 +0900)]
sycl : Level Zero detection in ggml_sycl_init (llama/23097)

* [SYCL] Centralize Level Zero detection in ggml_sycl_init

* use the same wording

* get back the warning

3 months agoSYCL : gated_delta_net K>1 (llama/23174)
karavayev [Fri, 22 May 2026 12:48:56 +0000 (08:48 -0400)]
SYCL : gated_delta_net K>1 (llama/23174)

* sycl_gated_delta_net K>1

* editor_config

3 months agoSYCL: add BF16 to DMMV kernel path (~4x tg speedup on Intel Arc) (llama/21580)
Katostrofik [Fri, 22 May 2026 12:48:24 +0000 (08:48 -0400)]
SYCL: add BF16 to DMMV kernel path (~4x tg speedup on Intel Arc) (llama/21580)

* SYCL: add BF16 to DMMV kernel path for ~4x token generation speedup

BF16 models had no dedicated token generation kernel — they fell through
to the generic full-GEMM path, resulting in ~14% memory bandwidth
utilization on Intel Arc GPUs. This adds BF16 support to the DMMV
(dequantize mul-mat-vec) path, matching the existing F16 implementation.

Fixes #20478

* SYCL: fix BF16 DMMV out-of-bounds when ncols % 64 != 0

The qk=1 kernel (used for F16 and BF16) iterates with stride
2*GGML_SYCL_DMMV_X (= 64 on Intel targets where WARP_SIZE=16). When
ncols is a multiple of DMMV_X (32) but not of 2*DMMV_X (64), the last
warp iteration accesses elements at col >= ncols, producing NaN for the
final row and wrong values for interior rows.

Fix: tighten can_use_dequantize_mul_mat_vec to require ne[0] %
(2*DMMV_X) == 0 for F16/BF16 types, and update the ASSERT in the BF16
launcher to match. Quantized types use block-structured kernels with
different access patterns and keep the existing DMMV_X check.

Verified: test-backend-ops MUL_MAT passes 913/913 on Intel Arc Pro B70.
Previously failing: m=128/129 n=1 k=1056 cases (NaN and ERR > 0.0005).

Co-Authored-By: Claude Sonnet 4.6 <redacted>
---------

Co-authored-by: Claude Sonnet 4.6 <redacted>
3 months agoggml-zendnn : add Q8_0 quantization support (llama/23414)
Sachin Sharma [Fri, 22 May 2026 11:16:55 +0000 (16:46 +0530)]
ggml-zendnn : add Q8_0 quantization support (llama/23414)

* ggml-zendnn : add Q8_0 quantization support

* ggml-zendnn : sync with latest ZenDNN

* ggml-zendnn : address review comments for Q8_0

3 months agoCUDA: fix PDL CC check for JIT compilation (llama/23471)
Johannes Gäßler [Thu, 21 May 2026 21:35:29 +0000 (23:35 +0200)]
CUDA: fix PDL CC check for JIT compilation (llama/23471)

3 months agovulkan: fuse snake activation (mul, sin, sqr, mul, add) (llama/22855)
Pascal [Thu, 21 May 2026 17:39:42 +0000 (19:39 +0200)]
vulkan: fuse snake activation (mul, sin, sqr, mul, add) (llama/22855)

* vulkan: fuse snake activation (mul, sin, sqr, mul, add)

Add snake.comp shader with F32 / F16 / BF16 pipelines and
ggml_vk_snake_dispatch_fused. The matcher recognizes the naive 5 op
decomposition emitted by audio decoders (BigVGAN, Vocos) for snake
activation y = x + sin(a*x)^2 * inv_b and rewrites it to a single
elementwise kernel.

test_snake_fuse from the CUDA PR now also compares CPU naive vs
Vulkan fused across F32 / F16 / BF16.

* vulkan: address jeffbolznv review for fused snake activation

Rename T / C to ne0 / ne1 in the shader and push constants to match
the standard naming convention used across the Vulkan backend.

Tighten ggml_vk_can_fuse_snake: require x and dst to be contiguous
(the shader uses idx = i0 + i1 * ne0) and require a / inv_b to be
tightly packed on the broadcast dim (the shader reads data_a[i1]).

* vulkan: tighten snake fusion type checks for all operands (address jeffbolznv review)

* vulkan: reject snake fusion when ne[2] or ne[3] > 1 (address jeffbolznv review)

* vulkan: address 0cc4m review for fused snake activation

snake.comp is renamed to follow the ggml DATA_A_* / A_TYPE convention.
A_TYPE now applies to the activation tensor data_a instead of the
broadcast multiplier, and the bindings become data_a (A_TYPE), data_b
(float), data_c (float) and data_d (D_TYPE). A header at the top of
the shader maps each buffer to its role in y = x + sin(b * x)^2 * c.

On the C++ side, ggml_vk_can_fuse_snake reuses the existing snake_pattern
constant instead of duplicating the op list, sin_node is extracted as a
named local alongside the other chain nodes, and the broadcast operands
a and inv_b are now required to be GGML_TYPE_F32 to match the hardcoded
float bindings on data_b and data_c (the previous a->type == x->type
would silently reject any future BF16 or F16 chain once the supports_op
gate for SIN / SQR is lifted). ggml_vk_snake_dispatch_fused gets an
explicit GGML_TYPE_F32 case and GGML_ABORT on default in place of the
silent f32 fallback, and a stale comment about data_a[i1] / data_inv_b[i1]
is refreshed to match the new binding names.

3 months agofix(flash-attn): replace f32 with kv_type and q_type (llama/23372)
Chen Yuan [Thu, 21 May 2026 14:58:49 +0000 (10:58 -0400)]
fix(flash-attn): replace f32 with kv_type and q_type (llama/23372)

3 months agometal : optimize concat kernel and fix set kernel threads (llama/23411)
Georgi Gerganov [Thu, 21 May 2026 10:34:08 +0000 (13:34 +0300)]
metal : optimize concat kernel and fix set kernel threads (llama/23411)

* metal : fix GGML_OP_SET kernel threads

* tests : extend test_cpy to support different src/dst shapes

Extend test_cpy to support different source and destination tensor shapes
for CPY operations (reshaping), where the total number of elements must match.

- Renamed ne -> ne_src, added ne_dst parameter (default: use src shape)
- Added 50 new reshaping test cases covering 1D<->2D<->3D<->4D conversions
- Tests exercise 1024 boundary, small shapes, and large dimensionality changes
- Fixed dangling reference bug (storing & to temporary std::array)
- Updated all existing test calls with permute/transpose args for compatibility

Assisted-by: llama.cpp:local pi
* metal : optimize concat kernel with row batching for small widths

When ne0 < 256, batch multiple rows into a single threadgroup to improve
occupancy. This avoids underutilizing the GPU when processing narrow tensors.

- Dispatch nth = min(256, ne0) threads per group
- Calculate nrptg (rows per threadgroup) to fill up to 256 threads
- Update kernel index calculation to handle the row batching
- Add boundary check for i1 >= ne1

Assisted-by: llama.cpp:local pi
* tests : clean-up

* tests : refactor CPY shape tests to use dimension permutations

Replace 75 hardcoded test cases with a loop over permutations of
{3, 5, 7, 32} (total elements: 3360). Each src permutation is tested
against canonical sorted and reverse dst, skipping identical shapes.
Covers F32, F16, and Q4_0 (when both src and dst ne0 == 32).

Assisted-by: llama.cpp:local pi
3 months agoggml : Check the right iface method before using the fallback 2d get (llama/23306)
Matt Corallo [Thu, 21 May 2026 06:24:40 +0000 (06:24 +0000)]
ggml : Check the right iface method before using the fallback 2d get (llama/23306)

Probably no backends implement only one of 2d get/set, but this
might be annoying for some future backend developer trying to add
2d get/set.

3 months agohexagon: ssm-conv fix for large prompts (llama/23307)
Todor Boinovski [Thu, 21 May 2026 05:14:13 +0000 (22:14 -0700)]
hexagon: ssm-conv fix for large prompts (llama/23307)

* hexagon: remove gathers and better handling of vtcm in ssm-conv

* hexagon: relax ssm-conv gating requirements

* hexagon: add new prefill ssm-conv backend test

* hexagon: remove trailing white space

* hex-rope: uninline rope_cache_init, otherwise it breaks after rebaseing with SSM_CONV changes

---------

Co-authored-by: Max Krasnyansky <redacted>
3 months agoopencl: refactor backend initilization (llama/23318)
lhez [Wed, 20 May 2026 16:57:36 +0000 (09:57 -0700)]
opencl: refactor backend initilization (llama/23318)

* opencl: refactor initialization

* opencl: refactor GPU identification

* opencl: rename for consistency

* opencl: cache global mem size in dev_ctx

* opencl: adjust log level

* opencl: load argsort and flash_attn kernels in supports_op

* argsort kernel must be built for supports_op for querying the max
  workgroups
* flash_attn kernel has many variants, only load them when needed

3 months agovulkan: optimize operations in the IM2COL shader (llama/22685)
Daniele [Wed, 20 May 2026 15:15:13 +0000 (17:15 +0200)]
vulkan: optimize operations in the IM2COL shader (llama/22685)

* vulkan: optimize operations in the IM2COL shader

* Add comments and improve the code formatting

3 months agohexagon: HMX quantized matmul rework (llama/23368)
Max Krasnyansky [Wed, 20 May 2026 14:39:01 +0000 (07:39 -0700)]
hexagon: HMX quantized matmul rework (llama/23368)

* hmx-mm: update debug logging in hmx-mm

* hmx-mm: update dequant logic to use HVX_vector_x2/4

* hmx-mm: remove non-pipelined version of the quantize matmul

It seems that we don't reall need non-pipelined version

* hmx-mm: use activation depth mode and update naming

Co-authored-by: Kim-Chyan Gan <redacted>
* hex-mm: minor hmx matmul naming updates

* hmx-mm: remove unused vars

* snapdragon: scripts bump default ubatch-size to 1K

* hexagon: combine HMX and power and clock settings into a single set_power call

* hmx-mm: remove leftover of the scale repl helper

* hexagon: fix editconf error

---------

Co-authored-by: Kim-Chyan Gan <redacted>
3 months agoProgrammatic Dependent Launch (PDL) for more performance on newer NVIDIA GPUs (Hopper...
Andreas Kieslinger [Wed, 20 May 2026 11:59:02 +0000 (13:59 +0200)]
Programmatic Dependent Launch (PDL) for more performance on newer NVIDIA GPUs (Hopper+) (llama/22522)

* Adds initial PDL setup.

* Adds PDL barriers based on simple heuristic: place "sync" before first input pointer access, and "launch" after last write, e.g. to tensors like dst.

* Further optimization pass of the first half of kernels

* Optimized PDL barriers for the second batch of kernels

* Further refinements after rebase.

* Moves pdl logic to separate function, removes some whitespace

* Strips post-hoc PDL logic

* Adds stream capture PDL setup. Enrolls quantize_q8_1 to leverage pdl to
overlap execution with previous kernels

* Enrolls mul_mat_vec_q, rms_norm_f32 and k_bin_bcast (partly) into PDL

* Enrolls mmvf, rope, set-rows and topk kernels for gpt-oss into PDL

* Introduce ggml_cuda_kernel_launch, to abstract away cudaLaunchKernelEx,
to enable hip/musa compatibility

* Enrolls cpy_scalar_contiguous, k_get_rows_float and rms_norm_f32

* Enrolls flash_attn_combine_results

* Fix: Drops needless and broken check of CUDA arch for PDL. PDL either
works or is without effect.

* Enrolls flash-attention kernels to pdl

* Fix: inlines ggml_cuda_kernel_launch, and uses perfect forwarding for
kernels args. This fixes PDL.

* Perf: Enrolls k_bin_bcast variadic template invocation into PDL, via
and template alias and template expansion

* Enrolls all remaining kernels for qwen3-coder-next into PDL

* Remove all PDL LC calls to create a baseline

* Added LC according to internal guidance and tested kernel performance.

* Enrols missing qwen3-5 kernels passively into PDL.

* Kernel optimizations (LC signals) for qwen3.5

* Enrolls ssm-scan kernels into PDL

* Adds GGML_CUDA_PDL command line option to toggle PDL.

* Fix: Ada and lower compilation by guarding PDL calls correctly

* Cleanup: Removes commented out GGML_CUDA_PDL_LC

* Cleanup: Removes experimental comments

* Adds 90-virtual to build script so that Hopper GPUs can leverage PDL.

* Adds stricter checks to enable PDL, adds env-check to disable it, and removes now superfluous compile option to enable PDL.

* Fix: Correct PDL en/disablement based on device-side arch check. Host
side check is UB. Required moving from macros to inlined functions

* Fix: default-disable PDL. Enable by setting GGML_CUDA_ENABLE_PDL=1

* Enable PDL by default for Hopper+ devices

* Enrolls softcap_f32 and two flash_attn kernels into PDL.

* Improves flash attn PDL barrier placement

* Fix: Perf regression on ada; excludes ada and below from PDL launches

* Improves some sync barrier placements

* Drops superfluous constructor

* Adds #endif guard comments

* Reverts experimental change to top-k-moe.cu, which moved expensive allocations
in front of the PDL barrier. It did not have a meaningful impact.

* Exchanges GGML_CUDA_DISABLE_PDL with GGML_CUDA_PDL. IFF GGML_CUDA_PDL=0
PDL is disabled

* Revert "Drops superfluous constructor". Adds const to remaining
arguments

This reverts commit 12b1d250da0089ae02a9bb71bbb3fd6d70f6f2f1.

* Cleanup: Removes and fixes some comments and whitespace

* Clarifies comment of sync-barrier position

* Relocates and refactors PDL launch functions and accessories

* Adds error checking to the regular kernel launch path

* Drops "auto" in favor of "ggml_cuda_kernel_params"

* Adds "const" to ggml_cuda_kernel_launch_params

* [Whitespace] Adds final newline to common.cuh to make editorconfig CI job happy

3 months agometal : optimize pad + cpy (llama/23354)
Georgi Gerganov [Wed, 20 May 2026 06:42:00 +0000 (09:42 +0300)]
metal : optimize pad + cpy (llama/23354)

* metal : optimize pad

* metal : optinmize cpy

* cont : better row packing in threadgroup

3 months agoggml-cuda: tune RDNA3 Q6_K MMVQ nwarps (llama/23349)
ravel7524 [Wed, 20 May 2026 01:52:21 +0000 (03:52 +0200)]
ggml-cuda: tune RDNA3 Q6_K MMVQ nwarps (llama/23349)

3 months agoopencl: add MoE support for q4_k, q5_k, q6_k on Adreno (llama/23303)
shaofeiqi [Tue, 19 May 2026 21:29:00 +0000 (14:29 -0700)]
opencl: add MoE support for q4_k, q5_k, q6_k on Adreno (llama/23303)

* opencl: add q4_k moe support

* opencl: add q5_k moe support

* opencl: add q6_k moe support

* opencl: adjust format

---------

Co-authored-by: Li He <redacted>
3 months agohexagon: add MROPE and IMROPE support in HTP rope op (llama/23317)
Aparna M P [Tue, 19 May 2026 21:10:13 +0000 (02:40 +0530)]
hexagon: add MROPE and IMROPE support in HTP rope op (llama/23317)

3 months agohexagon: enable support for NORM op (llama/23319)
Aparna M P [Tue, 19 May 2026 16:48:21 +0000 (22:18 +0530)]
hexagon: enable support for NORM op (llama/23319)

3 months agoggml-webgpu : extend GDN for K>1 (llama/23299)
Reese Levine [Tue, 19 May 2026 06:45:41 +0000 (23:45 -0700)]
ggml-webgpu : extend GDN for K>1 (llama/23299)

3 months agosycl: add GGML_SYCL_USE_ASYNC_MEM_OP env toggle (llama/22153)
Intel AI Get-to Market Customer Success and Solutions [Tue, 19 May 2026 06:44:02 +0000 (23:44 -0700)]
sycl: add GGML_SYCL_USE_ASYNC_MEM_OP env toggle (llama/22153)

* sycl: add GGML_SYCL_USE_ASYNC_MEM_OP env toggle

Signed-off-by: Chun Tao <redacted>
* Use async mem ops for correctness when SYCL graphs are explicitly on.

Signed-off-by: Tao, Chun <redacted>
---------

Signed-off-by: Chun Tao <redacted>
Signed-off-by: Tao, Chun <redacted>
Co-authored-by: Chun Tao <redacted>
3 months agorpc : keep last_graph_uid in the device context (llama/23273)
Radoslav Gerganov [Tue, 19 May 2026 06:42:36 +0000 (09:42 +0300)]
rpc : keep last_graph_uid in the device context (llama/23273)

With the introduction of MTP we can have multiple compute contexts for
the same RPC device. In this case last_graph_uid is not updated properly
when contexts are being switched. This patch fixes this by moving
last_graph_uid to the device context, making sure it is always updated.

closes: #23242

3 months agohexagon: add support for TRI op (llama/22822)
Pranav Dhinakar [Mon, 18 May 2026 21:04:57 +0000 (14:04 -0700)]
hexagon: add support for TRI op (llama/22822)

* Hexagon: TRI HVX Kernel addition to ggml hexagon HTP ops and context

* addressed PR review comments for TRI op

* hexagon: clang format

* hex-unary: remove merge conflict markers

* hex-ggml: remove duplicate op cases (merge conflict)

* hex-ggml: fix editor config errors

---------

Co-authored-by: Todor Boinovski <redacted>
Co-authored-by: Max Krasnyansky <redacted>
3 months agoggml-hexagon: add PAD op HVX kernel (llama/23078)
Pranav Dhinakar [Mon, 18 May 2026 20:39:36 +0000 (13:39 -0700)]
ggml-hexagon: add PAD op HVX kernel (llama/23078)

* ggml-hexagon: add PAD op HVX kernel

Implements GGML_OP_PAD on the Hexagon HTP backend using HVX vectorized
kernels. Supports zero-padding and circular padding across all 4 tensor
dimensions.

* hex-ggml: remove duplicate op cases (merge conflict)

* hex-pad: fix editorconfig checks and macro alignment

---------

Co-authored-by: Max Krasnyansky <redacted>
3 months agosycl: scalar SWAR byte-subtract in Q6_K MMVQ dot product (llama/22156)
Intel AI Get-to Market Customer Success and Solutions [Mon, 18 May 2026 05:12:21 +0000 (22:12 -0700)]
sycl: scalar SWAR byte-subtract in Q6_K MMVQ dot product (llama/22156)

Signed-off-by: Chun Tao <redacted>
Co-authored-by: Chun Tao <redacted>
3 months agosycl: route small f32 matmuls to oneMKL, bypass oneDNN (llama/22150)
Intel AI Get-to Market Customer Success and Solutions [Mon, 18 May 2026 05:11:51 +0000 (22:11 -0700)]
sycl: route small f32 matmuls to oneMKL, bypass oneDNN (llama/22150)

Signed-off-by: Chun Tao <redacted>
Co-authored-by: Chun Tao <redacted>
3 months agofeat: Support d_conv=15 for ssm-conv.cu (llama/23017)
Gabe Goodhart [Sun, 17 May 2026 21:05:11 +0000 (15:05 -0600)]
feat: Support d_conv=15 for ssm-conv.cu (llama/23017)

Branch: ModalityConditionalAdapters
AI-usage: none
Signed-off-by: Gabe Goodhart <redacted>
3 months agoCUDA: Continue directly including cuda/iterator (llama/23102)
Oliver Simons [Sun, 17 May 2026 16:00:10 +0000 (18:00 +0200)]
CUDA: Continue directly including cuda/iterator (llama/23102)

Cont of #22936, forgot to update one site

3 months agoggml-vulkan/CMakeLists: add a check for SPIRV-Headers (llama/22009)
Jan Ekström [Sun, 17 May 2026 11:12:11 +0000 (14:12 +0300)]
ggml-vulkan/CMakeLists: add a check for SPIRV-Headers (llama/22009)

* ci/run: set explicit SPIR-V Headers search path for macOS vulkan CI

For whatever reason, the files are under additional sub-path
`vulkan/` under the cmake directory, which does not match either
current LunarG macOS Vulkan SDK structure (`lib/cmake/SPIRV-Headers`),
nor what gets installed when you run the cmake build+install for
SPIRV-Headers itself on at least Linux (`share/cmake/SPIRV-Headers`).

This allows for SPIRV-Headers to be found, as currently the CI
runner's setup does not seem to include the relevant path in
list of search locations.

* ggml-vulkan/CMakeLists: add a check for SPIRV-Headers

This is installed by the project if it is built and installed.
Receiving an error during the configuration step is generally
preferred to receiving an error in the middle of a build.

3 months agovulkan: add cpy bf16 -> f32 pipelines (llama/22677)
Pascal [Sun, 17 May 2026 09:31:20 +0000 (11:31 +0200)]
vulkan: add cpy bf16 -> f32 pipelines (llama/22677)

3 months agovulkan: Support unaligned tensors for ROPE (llama/22637)
Jeff Bolz [Sun, 17 May 2026 09:30:16 +0000 (04:30 -0500)]
vulkan: Support unaligned tensors for ROPE (llama/22637)

3 months agovulkan: fuse SSM_CONV + BIAS + SILU (llama/22653)
Jeff Bolz [Sun, 17 May 2026 08:25:50 +0000 (03:25 -0500)]
vulkan: fuse SSM_CONV + BIAS + SILU (llama/22653)

3 months agovulkan: removed duplicate #include <memory> in headers (llama/23144)
Winston Ma [Sat, 16 May 2026 17:57:35 +0000 (01:57 +0800)]
vulkan: removed duplicate #include <memory> in headers (llama/23144)

3 months agoggml.h: correct ggml_silu_back arg docstring (a=dy, b=x) (ggml/1500)
Ori Pekelman [Thu, 21 May 2026 12:00:16 +0000 (12:00 +0000)]
ggml.h: correct ggml_silu_back arg docstring (a=dy, b=x) (ggml/1500)

3 months agoggml-alloc: fix out-of-bounds read in ggml_dyn_tallocr_remove_block (ggml/1492)
Dev-X25874 [Thu, 21 May 2026 11:58:08 +0000 (17:28 +0530)]
ggml-alloc: fix out-of-bounds read in ggml_dyn_tallocr_remove_block (ggml/1492)

3 months agoggml : bump version to 0.12.0 (ggml/1494)
Georgi Gerganov [Sat, 16 May 2026 12:59:09 +0000 (15:59 +0300)]
ggml : bump version to 0.12.0 (ggml/1494)

3 months agollama + spec: MTP Support (llama/22673)
Aman Gupta [Sat, 16 May 2026 12:06:23 +0000 (20:06 +0800)]
llama + spec: MTP Support (llama/22673)

* spec: support MTP

* fix batch size

* rename files

* cont : simplify (llama/7)

* MTP: clean-up (llama/9)

* MTP: clean-up

* review: use llama_context_type instead of llama_graph_type

* review: remove llama_model_has_mtp

* review: fix convert issues

* convert: fix pycheck

* review: formatting

* use `mtp-` for identifying mtp models

* convert: fix mtp conversion

* mtp -> draft-mtp

* remove unused llama_arch

* add need_embd in speculative

* llama: allow partial seq_rm for GDN models for speculative decoding

Currently speculative checkpoint needs to restart from a checkpoint
after some draft tokens are not accepted, this leads to some wastage in
running the target again. This PR adds the ability to rollback upto
`draft_max` by storing the GDN intermediates.

* fix pending state

* vulkan: add GDN partial rollback

* meta: extend check to axis 1

* metal: add GDN partial rollback

Extend the gated delta net kernel to store intermediate states for
partial rollback support on the Metal backend.

- Add K (snapshot slot count) as a function constant
- Read input state from slot 0 of the 3D state tensor
- Write intermediate states to different slots during token loop
- For K=1, maintain backward-compatible single-slot behavior

Ref: https://github.com/ggml-org/llama.cpp/commit/8c05923630110223669f069af2000e9cf10c02bc

Assisted-by: llama.cpp:local pi
* delta_net_base: use ggml_pad instead of new_tensor

* review: add need_rs_seq

* review: rename part_bounded to n_rs

* review: deslop comments

* review: rename, add asserts

* server : adjust checkpoint logic (llama/11)

* server : adjust checkpoint logic

* cont : rm asserts

* server-context: fix early exit

* spec : fix compatibility with n-gram and add TODOs (llama/13)

* metal : cleanup

* llama : fix faulty bitwise check in recurrent memory

* server : disable RS-based MTP in combination with other spec types

* spec : add TODOs

* cont : fix comment

* cont : update comment

* common : fix logic for ngram + mtp compat

* llama-memory: enable checkpointing with partial rollback

* cont: add test-case for loading into a dirty ctx

* llama-memory-recurrent: clear rs_idx in clear

* download: fix mtp path

* llama-arch: fix enorm op

* docs: update docs

* conversion: fix type annotations

---------

Co-authored-by: Georgi Gerganov <redacted>
3 months agoggml-hexagon: cpy: add contiguous fast-path in reshape copy (llama/23076)
Pranav Dhinakar [Thu, 14 May 2026 23:55:54 +0000 (16:55 -0700)]
ggml-hexagon: cpy: add contiguous fast-path in reshape copy (llama/23076)

3 months agoHIP: RDNA3 mma FA, faster AMD transpose, tune AMD (llama/22880)
Johannes Gäßler [Thu, 14 May 2026 20:58:58 +0000 (22:58 +0200)]
HIP: RDNA3 mma FA, faster AMD transpose, tune AMD (llama/22880)

Adds RDNA3 support to the CUDA mma FA kernel. To make the RDNA3 tensor cores work with the FP16 accumulation for VKQ the tiles they need to be 32 logical units long in direction of the attention head; for head sizes 80 and 112 that are not exactly divided by 32 the regular length of 16 with FP32 accumulation is used instead. The longer tiles also enable more efficient transposition for a warp size of 32 which is why it's also used for RDNA4. However, this scrambles the data layout of the accumulators along the attention head dimension. To prevent accidental misuse I added another entry to ggml_cuda_mma::data_layout.

I also tuned the kernel parameters for RDNA3, RDNA4, and CDNA1 in general, during which I discovered that the kernel can be made to work for head sizes up to 256 for CDNA. For RDNA3/4 I was not able to get better performance that the tile kernel for head sizes > 128.

3 months agoggml-webgpu: makes the flash attn vec path subgroup-aware (llama/23040)
Zheyuan Chen [Thu, 14 May 2026 16:31:36 +0000 (09:31 -0700)]
ggml-webgpu: makes the flash attn vec path subgroup-aware (llama/23040)

* ggml-webgpu: makes the flash attn vec path compile and size its split/reduce work from the device’s reported subgroup range instead of assuming 32 subgroup size.

* ggml-webgpu: remove the extra max_wg_size >= max_subgroup_size guard. Remove hardcoded 32 when determine the value of reduce_wg_size and vec_nwg_cap

3 months agologs : reduce (llama/23021)
Georgi Gerganov [Thu, 14 May 2026 10:05:52 +0000 (13:05 +0300)]
logs : reduce (llama/23021)

* logs : reduce

* args : fix envs

* server : fix build

* common : print verbosity level at start

* server : clean-up logs

* server : print prompt processing timings + sampling params

* minor : whitespaces

3 months agoggml-cpu: Add IME2 Instruction Support for the SpacemiT Backend (llama/22863)
alex-spacemit [Thu, 14 May 2026 09:39:30 +0000 (17:39 +0800)]
ggml-cpu: Add IME2 Instruction Support for the SpacemiT Backend (llama/22863)

3 months agovulkan: fix matmul integer pipeline selection (llama/23005)
Ruben Ortlam [Thu, 14 May 2026 08:36:54 +0000 (10:36 +0200)]
vulkan: fix matmul integer pipeline selection (llama/23005)

* vulkan: fix matmul integer pipeline selection

* gate pipeline creation with the right bools

3 months agoSYCL: fix multi-GPU system RAM exhaustion by using Level Zero allocations (llama...
Katostrofik [Thu, 14 May 2026 05:39:14 +0000 (01:39 -0400)]
SYCL: fix multi-GPU system RAM exhaustion by using Level Zero allocations (llama/21597)

* SYCL: fix multi-GPU system RAM exhaustion by using Level Zero allocations

Replace sycl::malloc_device with zeMemAllocDevice for GPU memory allocation
in the SYCL backend. sycl::malloc_device triggers the xe kernel driver's
DMA-buf/TTM path which mirrors every VRAM allocation 1:1 in system RAM.
zeMemAllocDevice uses the SVM/P2P path with no host staging.

On a dual Intel Arc Pro B70 system (64GB VRAM, 64GB RAM), a 15.6 GiB model
consumed 60 GiB of system RAM via sycl::malloc_device, causing OOM crashes.
With zeMemAllocDevice, the same workload uses ~6.7 GiB of system RAM with
no performance regression.

All Level Zero calls include automatic fallback to the original SYCL
allocation path if Level Zero interop is unavailable.

* SYCL: address review feedback - remove try/catch, check device types, deduplicate

- Remove try/catch from malloc/free/memcpy helpers, check backend and
  device type upfront instead (ggml_sycl_is_level_zero, ggml_sycl_is_dgpu)
- Move shared helpers (is_level_zero, is_dgpu, free_device) to common.cpp
  and declare in common.hpp to eliminate code duplication
- Use SYCL_CHECK(CHECK_TRY_ERROR()) for fallback sycl::free calls
- Guard dev2dev_memcpy L0 path to dGPU-to-dGPU only, preserving the
  host-staged path for iGPU-to-dGPU transfers
- Add Windows Level Zero SDK path detection (LEVEL_ZERO_V1_SDK_PATH)
  in CMakeLists.txt (co-authored with @arthw)

* SYCL: add build/runtime flags for Level Zero, address review feedback

Implements the architecture suggested by @arthw: compile-time and runtime
flags to cleanly separate Level Zero and SYCL memory API paths.

- Add GGML_SYCL_SUPPORT_LEVEL_ZERO cmake option (default ON). All Level
  Zero code is wrapped in #ifdef so the build works on systems without
  the Level Zero SDK installed (e.g. CPU-only CI servers). Both the
  loader library and headers are checked before enabling.

- Add GGML_SYCL_ENABLE_LEVEL_ZERO runtime env var (default 1). Controls
  whether Level Zero or SYCL memory APIs are used. Only one API style is
  used per session, no mixing. If Level Zero is enabled but the devices
  don't support the Level Zero backend, it auto-disables with a warning.

- Remove Level Zero code from dpct_malloc. It was unused (dpct::device_memory
  is not called anywhere in the backend) and used try/catch for flow control.

- Update SYCL.md with documentation for both new parameters.

Tested on Intel Arc Pro B70 (32GB), single-GPU and dual-GPU, with both
GGML_SYCL_SUPPORT_LEVEL_ZERO=ON and OFF builds. AI-assisted development
(Claude). Code reviewed and tested on my hardware.

* SYCL: unify Level Zero malloc/free call sites, address review feedback

Move ggml_sycl_malloc_device to common.cpp alongside ggml_sycl_free_device.
Both functions are now unconditionally available — Level Zero code is
#ifdef'd inside the functions, not at call sites. All call sites use
uniform SYCL_CHECK(CHECK_TRY_ERROR()) wrapping with no #ifdef blocks.

Addresses arthw's review: wrap all malloc/free in SYCL_CHECK for stack
traces on failure, eliminate duplicated #ifdef/else patterns at 6 call
sites (-29 lines net).

Co-Authored-By: Claude Opus 4.6 (1M context) <redacted>
* SYCL: add Level Zero SDK to CI, fix device check and missed alloc paths

Add Level Zero SDK installation to Ubuntu and Windows SYCL CI jobs
so the Level Zero code path is compiled and tested in CI.

Fix two bugs found during extended dual-GPU testing (no
ONEAPI_DEVICE_SELECTOR set):

- The Level Zero backend check was iterating all SYCL devices
  including CPU. The OpenCL CPU device caused Level Zero to be
  disabled for the GPUs, defeating the fix on multi-GPU systems.
  Added is_gpu() filter so only GPU devices are checked.

- sycl_ext_malloc_device/sycl_ext_free (tensor reorder temp buffers)
  were still calling sycl::malloc/sycl::free directly, bypassing the
  Level Zero path. Routed through ggml_sycl_malloc_device/free_device
  for consistency with the other device memory call sites.

Co-Authored-By: Claude Opus 4.6 (1M context) <redacted>
* SYCL: address arthw review feedback on Level Zero memory API structure

- Move ggml_sycl_malloc_device to static function in ggml-sycl.cpp;
  only ggml_sycl_free_device (used by common.cpp) stays in common.cpp
- Switch both helpers to use g_ggml_sycl_enable_level_zero global
  instead of per-call queue backend checks
- Remove #ifdef wrapper from global definition; always declare at 0,
  add #else branch in init block so it stays 0 when L0 not compiled in
- Update init loop comment to explain GPU-only device check
- CMakeLists: message(STATUS) before the if block; align option wording

AI-assisted implementation. Reviewed and tested on dual Intel Arc Pro
B70 (32 GB each): test-backend-ops OK on both GPUs, single/dual-GPU
Q4_K_M and Q8_0 bench correct, zeMemAllocDevice GTT delta confirmed
<5 MiB per 4 GiB allocation (vs ~4 GiB shadow with sycl::malloc_device).

Co-Authored-By: Claude Sonnet 4.6 <redacted>
* SYCL: remove unused cstdio/cstdlib includes from common.cpp

Leftover from the deleted ggml_sycl_queue_supports_level_zero helper.

Co-authored-by: Claude Sonnet 4.6 <redacted>
* Apply suggestions from code review

Co-authored-by: Neo Zhang <redacted>
* SYCL: preserve Level Zero allocation path during early malloc

* ci: fix Level Zero package conflict in Intel Docker build

* ci: find Level Zero loader in oneAPI package step

* ci: allow Windows SYCL package without Level Zero DLL

---------

Co-authored-by: Claude Opus 4.6 (1M context) <redacted>
Co-authored-by: Neo Zhang <redacted>
3 months agocmake : add CMakePresets.json [no ci] (#3808)
Daniel Bevenius [Mon, 25 May 2026 09:25:15 +0000 (11:25 +0200)]
cmake : add CMakePresets.json [no ci] (#3808)

This commit adds a CMakePresets.json file similar to the one in
llama.cpp.

The motivation for this is that this provides sharable named
configuration which can be used with cmake --preset <name>.

It also allows for extendins these preset with a
CMakeUserPresets.json for specific hardware (like CPUs),
architectures, and toolchains etc.

3 months agofix: in bindings/ruby/test/jfk_reader/jfk_reader in jfk_reader.c (#3756)
OrbisAI Security [Mon, 25 May 2026 06:19:23 +0000 (11:49 +0530)]
fix: in bindings/ruby/test/jfk_reader/jfk_reader in jfk_reader.c (#3756)

* fix: V-002 security vulnerability

Automated security fix generated by Orbis Security AI

* fix(ruby): use Ruby allocator macros in jfk_reader and fix memory leak

- Replace calloc/free with ALLOC_N/xfree to match Ruby binding conventions
  (ALLOC_N handles overflow checking and raises NoMemoryError on failure)
- Free temporary samples buffer after conversion loop (was leaked)
- Add NULL check for fopen return value with rb_raise
- Add comment clarifying n_samples is a compile-time constant

Co-Authored-By: Claude Opus 4.6 <redacted>
* fix(ruby): return false instead of rb_raise in memory_view callback

rb_memory_view_get_func_t callbacks should communicate errors via
return value (false), not exceptions. rb_memory_view_get has no
exception-handling wrapper around get_func calls.

Co-Authored-By: Claude Opus 4.6 <redacted>
* replacing ALLOC_N with rb_protect as ALLOC_N raises Ruby exceptions

---------

Co-authored-by: Claude Opus 4.6 <redacted>
3 months agocommon : fix server /inference fails to decode in-memory audio (regression) (#3818)
Pascal [Fri, 22 May 2026 06:27:35 +0000 (08:27 +0200)]
common : fix server /inference fails to decode in-memory audio (regression) (#3818)

* common: add memory buffer overload of read_audio_data

whisper-server /inference without --convert passed the uploaded file
bytes to read_audio_data as a filename, so ma_decoder_init_file tried
to open a path starting with "RIFF" and failed. every request returned
HTTP 400 "Invalid request" on builds without WHISPER_FFMPEG, which is
the default.

factor the PCM extraction into a shared helper and add an overload that
decodes straight from a memory buffer via ma_decoder_init_memory, which
the function already used for the stdin path. server now calls it with
the upload content. the filename overload behavior is unchanged.

3 months agoci : use github ubuntu-22.04-arm runner instead of qemu (#3815)
Daniel Bevenius [Thu, 21 May 2026 08:59:58 +0000 (10:59 +0200)]
ci : use github ubuntu-22.04-arm runner instead of qemu (#3815)

* ci : use github ubuntu-22.04-arm runner instead of qemu

This commit updates the ubuntu-22-gcc-arm64 job to use a arm github
runner instead of QEMU.

The motivation for this is that we get intermittent failure specifically
related to QEMU. For example:
```console
Segmentation fault (core dumped)
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
dpkg: error processing package libc-bin (--configure):
installed libc-bin package post-installation script subprocess returned error exit status 139
Processing triggers for ca-certificates (20240203~22.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Errors were encountered while processing:
libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)
```
This is an attempt to try to avoid QEMU and hence avoid this issue.

* ci : remove QEMU where possible

3 months agowhisper : set bench data for each iteration (#3812)
Daniel Bevenius [Tue, 19 May 2026 06:58:43 +0000 (08:58 +0200)]
whisper : set bench data for each iteration (#3812)

* whisper : set bench data for each iteration

This commit updates whisper_bench_ggml_mul_mat_str to intialize the
tensors data for each iteration.

The motivation for this is that is currently possible for a previous
run's results, F32 values, to leak into the next run. When it is time
for the F16 iteration then F32 results can cause NaN values to appear
in the tensor values causing the F16 iteration to fail.

Refs:https://github.com/ggml-org/whisper.cpp/actions/runs/25901678402/job/76152894644?pr=3735

* ci : set GGML_NATIVE=OFF if x86_64

This commit sets GGML_NATIVE=OFF for x86_64 architectures.

The motivation for this is to try to get CI to pass and the theory is
that the libggml-cpu.so library in the ccache might have been built by a
runner that supports a different instruction set. When another runner
that does not support that instruction set tries to use it, it will fail
with a segmentation fault.

I'm not sure about this yet but going to try this out and if it does not
work I'll ssh into the runner to debug further.

3 months agoexamples : fix memory leak in read_audio_data (#3810)
petterreinholdtsen [Mon, 18 May 2026 10:16:39 +0000 (12:16 +0200)]
examples : fix memory leak in read_audio_data (#3810)

This commit addresses a memory leak in the `read_audio_data` function
where it is currently possible that a call to `ma_decoder_init_file`
succeeds and the function returns early without calling
`ma_decoder_uninit`. A similar situation can occur with
`ma_decoder_init_memory`.

Refs: https://bugs.debian.org/1124796

Co-authored-by: Daniel Bevenius <redacted>
3 months agoserver : Return speaker information in JSON (#3782)
Andreas Lubbe [Mon, 18 May 2026 07:18:04 +0000 (09:18 +0200)]
server : Return speaker information in JSON (#3782)

3 months agoserver: add support for carry_initial_prompt (#3781)
Andreas Lubbe [Fri, 15 May 2026 12:03:17 +0000 (14:03 +0200)]
server: add support for carry_initial_prompt (#3781)

* Add support for carry_initial_prompt on the server

* Update README

3 months agotalk-llama : sync llama.cpp
Georgi Gerganov [Thu, 14 May 2026 08:53:43 +0000 (11:53 +0300)]
talk-llama : sync llama.cpp

3 months agosync : ggml
Georgi Gerganov [Thu, 14 May 2026 08:53:30 +0000 (11:53 +0300)]
sync : ggml

3 months agoggml-webgpu: only use subgroup-matrix path when head dims are divisible by sg_mat_k...
Zheyuan Chen [Wed, 13 May 2026 22:12:40 +0000 (15:12 -0700)]
ggml-webgpu: only use subgroup-matrix path when head dims are divisible by sg_mat_k / sg_mat_n (llama/23020)

3 months agoFix for issue #22974. Cast intermediate results to float before adding and casting...
scutler-nv [Wed, 13 May 2026 20:36:14 +0000 (13:36 -0700)]
Fix for issue #22974. Cast intermediate results to float before adding and casting the result to the destination type. Avoids half+half operator ambiguity. (llama/22994)

3 months agoopencl: add q5_0 and q5_1 MoE for Adreno (llama/22985)
shaofeiqi [Wed, 13 May 2026 18:57:31 +0000 (11:57 -0700)]
opencl: add q5_0 and q5_1 MoE for Adreno (llama/22985)

* opencl: add q5_0 moe support

* opencl: add q5_1 moe support

* opencl: avoid potential leak

* opencl: suppress unused var warning when building for non-Adreno

---------

Co-authored-by: Li He <redacted>
3 months agoopencl: fix crash when warming up MoE on Adreno (llama/22876)
lhez [Wed, 13 May 2026 18:24:33 +0000 (11:24 -0700)]
opencl: fix crash when warming up MoE on Adreno (llama/22876)

3 months agoflush the gpu profile timestamp before the queryset is overflowed (llama/22995)
Masashi Yoshimura [Wed, 13 May 2026 17:22:44 +0000 (02:22 +0900)]
flush the gpu profile timestamp before the queryset is overflowed (llama/22995)

3 months agohexagon: add unary tanh op (llama/22999)
Max Krasnyansky [Wed, 13 May 2026 13:59:28 +0000 (06:59 -0700)]
hexagon: add unary tanh op (llama/22999)

3 months agoggml-zendnn : adaptive fallback to CPU backend for small batch sizes (llama/22681)
Sachin Sharma [Wed, 13 May 2026 06:13:47 +0000 (11:43 +0530)]
ggml-zendnn : adaptive fallback to CPU backend for small batch sizes (llama/22681)

* ggml-zendnn : add runtime env var GGML_ZENDNN_ADAPTIVE_FALLBACK to control adaptive fallback (default: enabled)

* ggml-zendnn : restore original fallback logic when adaptive fallback is disabled

3 months agohexagon: eliminate scalar VTCM loads via HVX splat helpers (llama/22993)
Trivikram Reddy [Wed, 13 May 2026 00:28:02 +0000 (19:28 -0500)]
hexagon: eliminate scalar VTCM loads via HVX splat helpers (llama/22993)

* hexagon: add hvx_vec_repl helpers and use those for splat-from-vtcm usecase

* hmx-mm: optimize per-group scale handling

* hmx-fa: optimize slope load from vtcm

* hmx-fa: use aligned access where possible in hmx-utils

* hexagon: add hvx_vec_repl_2x_f16 helper and consolidate repl helpers

---------

Co-authored-by: Max Krasnyansky <redacted>
3 months agoopencl: add opt-in Adreno xmem F16xF32 GEMM for prefill (llama/22755)
yzyyzyhhh [Tue, 12 May 2026 20:10:37 +0000 (04:10 +0800)]
opencl: add opt-in Adreno xmem F16xF32 GEMM for prefill (llama/22755)

* ggml-opencl: add Adreno xmem F16xF32 GEMM for prefill

* ggml-opencl: address Adreno xmem review comments

* ggml-opencl: align xmem gemm kernel naming

---------

Co-authored-by: Your Name <redacted>
3 months agoggml-webgpu: Enables running gpt-oss-20b (llama/22906)
Masashi Yoshimura [Tue, 12 May 2026 14:27:40 +0000 (23:27 +0900)]
ggml-webgpu: Enables running gpt-oss-20b (llama/22906)

* Enable to run gpt-oss-20b and refactor mulmat-q

* disable test-backend-ops in ubuntu-24-webgpu

3 months agoggml-webgpu: address precision issues for multimodal (llama/22808)
Chen Yuan [Tue, 12 May 2026 14:27:04 +0000 (10:27 -0400)]
ggml-webgpu: address precision issues for multimodal (llama/22808)

* fix(mixed-types): use f32 for precision and update the shared memory calculation logic for f32

* fix(unary): correct the gelu, gelu quick and gelu erf functions

* fix(flash-attn-tile): fix the hardcode v type

* fix(flash_attn): fix tile path

* fix: pass editorconfig and address the type conflicts

* fix: remove reduant pipeline keys

* fix: remove inline min/max group size functions and revert the flash attn path order

* fix: use clamp to avoid NaN for GELU

* fix: use the right range for exp, 80 is safer for f32 exp

3 months agovulkan: Fix Windows performance regression on Intel GPU BF16 workloads for Xe2 and...
Masato Nakasaka [Tue, 12 May 2026 10:15:34 +0000 (03:15 -0700)]
vulkan: Fix Windows performance regression on Intel GPU BF16 workloads for Xe2 and newer (llama/22461)

* refactor

* Use l_warptile only when coopamt is available for BF16

3 months agovulkan: Check shared memory size for mmq shaders (llama/22693)
Jeff Bolz [Tue, 12 May 2026 09:41:58 +0000 (04:41 -0500)]
vulkan: Check shared memory size for mmq shaders (llama/22693)

3 months agometal : promote mul_mv/mul_mm batch divisors to function constants (llama/22711)
guyfischman [Tue, 12 May 2026 05:15:02 +0000 (07:15 +0200)]
metal : promote mul_mv/mul_mm batch divisors to function constants (llama/22711)

* metal : promote mul_mv/mul_mm batch divisors to function constants

* metal : take op directly in get_pipeline_mul_mv_ext

3 months agoopencl: add q4_1 MoE for Adreno (llama/22856)
Shawn Gu [Mon, 11 May 2026 18:57:26 +0000 (11:57 -0700)]
opencl: add q4_1 MoE for Adreno (llama/22856)

* Q4_1 MoE CLC pass sanity check

* remove unnecessary code

* opencl: remove unnecessary asserts and reformat

* opencl: fix supports_op for q4_1 moe

* q4_1 moe is supported by Adreno with certain shapes

---------

Co-authored-by: Li He <redacted>
3 months agoCUDA: handle OW > 65535 in im2col (2D and 3D) (llama/22944)
CrispStrobe [Mon, 11 May 2026 17:48:29 +0000 (19:48 +0200)]
CUDA: handle OW > 65535 in im2col (2D and 3D) (llama/22944)

`im2col_cuda` and `im2col_3d_cuda` both dispatch with
`block_nums.y = OW`. CUDA caps grid Y at 65535. Conv1d encoders on
raw 16 kHz audio with T > 65535 (~ 4 s) trip the limit -- e.g. SEANet
at 11 s lands at OW = 176000 -- and the launch returns
`invalid configuration argument`.

Clamp `block_nums.y` to `MIN(OW, MAX_GRIDDIM_Y)` and loop inside the
kernel with stride `MAX_GRIDDIM_Y`. Same in-kernel stride pattern
already used for the z axis (`MAX_GRIDDIM_Z`). Both 2D `im2col_kernel`
and 3D `im2col_3d_kernel` need the same fix. Bit-identical for
OW <= 65535 (single iteration of the new outer loop).

Tested on T4 / Jetson Orin with a SEANet encoder running on 11 s /
16 kHz audio (im2col reaching OW ~ 176000); pre-fix launch returns
`invalid configuration argument`, post-fix runs to completion.
Existing test-backend-ops im2col cases unchanged.

3 months agoGgml/cuda snake fusion hardening (llama/22912)
Pascal [Mon, 11 May 2026 16:42:08 +0000 (18:42 +0200)]
Ggml/cuda snake fusion hardening (llama/22912)

* cuda: tighten snake fusion type checks for all operands (defensive, sync vulkan)

* cuda: reject snake fusion when ne[2] or ne[3] > 1 (mirror vulkan PR review)

* cuda: merge type_ok and types_ok into a single types_ok (address am17an review)

* cuda: filter ADD/SUB/MUL/DIV in supports_op to F32/F16

bin_bcast only dispatches F32/F16 type triplets, mirror the
vulkan filter so unsupported types fall back through cpy
instead of aborting.

* test-backend-ops: extend snake_fuse to rank-4 with ne[2]/ne[3] > 1 cases

3 months agovulkan: Support asymmetric FA in scalar/mmq/coopmat1 paths (llama/22589)
Jeff Bolz [Mon, 11 May 2026 10:49:03 +0000 (05:49 -0500)]
vulkan: Support asymmetric FA in scalar/mmq/coopmat1 paths (llama/22589)

3 months agoCUDA: directly include cuda/iterator (llama/22936)
Oliver Simons [Mon, 11 May 2026 10:16:38 +0000 (12:16 +0200)]
CUDA: directly include cuda/iterator (llama/22936)

Before, we relied on a transient import from `cub/cub.cuh`, which is
bad practice to do as cub may not always expose cuda/iterator

3 months agoAdd OP im2col_3d (llama/22903)
Neo Zhang [Mon, 11 May 2026 05:01:47 +0000 (13:01 +0800)]
Add OP im2col_3d (llama/22903)

* add im2col_3d

* format code

* update the ops.md

3 months agoggml-virtgpu : include missing mutex header (llama/22810)
Oliver Walsh [Sun, 10 May 2026 15:32:41 +0000 (16:32 +0100)]
ggml-virtgpu : include missing mutex header (llama/22810)

Add missing `#include <mutex>` in ggml-backend-device.cpp.

Fixes: #22809
Signed-off-by: Oliver Walsh <redacted>
3 months agometal : tighten input-position loop in kernel_conv_transpose_1d (ggml/1477)
CrispStrobe [Sun, 10 May 2026 14:45:00 +0000 (16:45 +0200)]
metal : tighten input-position loop in kernel_conv_transpose_1d (ggml/1477)

For a given output position j on the time axis, only input positions
i such that i*s0 <= j < i*s0 + K contribute -- i.e.
i in [ceil((j - K + 1)/s0), floor(j/s0)] intersected with [0, IL-1].
That's at most ceil(K/s0) values (typically 2 for stride==K/2
transposed convs).

The current kernel iterates the full IL range and filters with an
`if`, amplifying per-thread work by IL/ceil(K/s0) (~160x for IL=320,
K=10, s0=5 -- a representative codec-decoder shape). On Apple M1
the wasted work trips the macOS GPU watchdog
(kIOGPUCommandBufferCallbackErrorImpactingInteractivity) on long
graphs.

Compute i_min, i_max analytically before the inner loop and iterate
only [i_min, i_max]. Output is bit-identical (same multiplies and
adds in the same order); loop bound shrinks by IL/ceil(K/s0).

Tested on M1 with a downstream consumer running a TTS codec at full
T_codec; end-to-end codec decode ~3-4x faster, zero watchdog hits
across long synthesis runs vs ~30% pre-patch.

3 months agoggml: install ggml.pc in <libdir>/pkgconfig (ggml/1480)
Steve Lhomme [Sun, 10 May 2026 14:35:38 +0000 (16:35 +0200)]
ggml: install ggml.pc in <libdir>/pkgconfig (ggml/1480)

That's always how it's done: https://github.com/search?q=path%3ACMakeLists.txt%20%22%24%7BCMAKE_INSTALL_LIBDIR%7D%2Fpkgconfig%22&type=code

3 months agoRevert "ggml-cuda : add explicit casts to -INFINITY for float and half2 types"
Daniel Bevenius [Thu, 14 May 2026 03:28:56 +0000 (05:28 +0200)]
Revert "ggml-cuda : add explicit casts to -INFINITY for float and half2 types"

This reverts commit a2839b4404de473bc7af127b7b308d530afda024.

Reverting this as after closer inspection these only warnings and not
errors.

3 months agoRevert "ggml-cuda : add ar_add() to avoid ambiguous operator+ for half/bfloat16 in...
Daniel Bevenius [Thu, 14 May 2026 03:27:13 +0000 (05:27 +0200)]
Revert "ggml-cuda : add ar_add() to avoid ambiguous operator+ for half/bfloat16 in CUDA 11.8"

This reverts commit 5cd228494af3973294e90aad95b58c2ede400f43.

Reverting in favor of:
https://github.com/ggml-org/llama.cpp/pull/22994

3 months agosquash! ci : update ONEAPI version to 2025.3.3-0-devel-ubuntu24.04
Daniel Bevenius [Tue, 12 May 2026 09:15:56 +0000 (11:15 +0200)]
squash! ci : update ONEAPI version to 2025.3.3-0-devel-ubuntu24.04

3 months agoci : update ONEAPI version to 2025.3.3-0-devel-ubuntu24.04
Daniel Bevenius [Tue, 12 May 2026 06:36:14 +0000 (08:36 +0200)]
ci : update ONEAPI version to 2025.3.3-0-devel-ubuntu24.04

3 months agoggml-cuda : add ar_add() to avoid ambiguous operator+ for half/bfloat16 in CUDA 11.8
Daniel Bevenius [Tue, 12 May 2026 06:30:00 +0000 (08:30 +0200)]
ggml-cuda : add ar_add() to avoid ambiguous operator+ for half/bfloat16 in CUDA 11.8

3 months agoggml-cuda : add explicit casts to -INFINITY for float and half2 types
Daniel Bevenius [Tue, 12 May 2026 05:59:24 +0000 (07:59 +0200)]
ggml-cuda : add explicit casts to -INFINITY for float and half2 types

This commit adds explicit casts to float for -INFINITY.

The motivation for this is that in CUDA 11.8.0, the -INFINITY macro is
defined as a double (a header provided NVCC). This triggers a warning
and hence causes a CI failure in whisper.cpp. I belive that this header
might have been updated in CUDA 12 which is why we don't see this
warning.

Refs: https://github.com/ggml-org/whisper.cpp/actions/runs/25713948217/job/75500081939?pr=3803
Refs: https://github.com/ggml-org/llama.cpp/issues/22824

3 months agodevops : add spirv-headers to vulkan dockerfile
Daniel Bevenius [Tue, 12 May 2026 04:38:12 +0000 (06:38 +0200)]
devops : add spirv-headers to vulkan dockerfile

3 months agoRevert "try using CCCL 12.4.127 with cuda 11.8.0 to fix CI failure"
Daniel Bevenius [Mon, 11 May 2026 13:17:13 +0000 (15:17 +0200)]
Revert "try using CCCL 12.4.127 with cuda 11.8.0 to fix CI failure"

This reverts commit be867eadf553801eb7d1c383ed47a90fdd3d4b18.

Sorry about this noise, I thought it was worth a try.

3 months agotry using CCCL 12.4.127 with cuda 11.8.0 to fix CI failure
Daniel Bevenius [Mon, 11 May 2026 12:44:23 +0000 (14:44 +0200)]
try using CCCL 12.4.127 with cuda 11.8.0 to fix CI failure

3 months agoRevert "try to fix window cublas CI failure"
Daniel Bevenius [Mon, 11 May 2026 12:39:16 +0000 (14:39 +0200)]
Revert "try to fix window cublas CI failure"

This reverts commit a4d91768aa2ae8cf7083650b3e4dc214413f92b7.