]> git.djapps.eu Git - pkg/ggml/sources/ggml/log
pkg/ggml/sources/ggml
5 weeks agoggml webgpu: Split shared state (webgpu_context) into global state and per-thread...
Nikhil Jain [Wed, 28 Jan 2026 04:53:36 +0000 (20:53 -0800)]
ggml webgpu: Split shared state (webgpu_context) into global state and per-thread state (llama/18976)

* Squashed commit of the following:

commit b3c6bf4b0450d8d452b934df27a0fb7cb53cd755
Author: Abhijit Ramesh <redacted>
Date:   Mon Dec 1 18:29:00 2025 -0800

    ggml webgpu: fix xielu parameter passing (llama/11)

    The XIELU operation was incorrectly using static_cast to convert
    float parameters to uint32_t, which converted numeric values instead
    of preserving IEEE 754 bit patterns. This caused incorrect values
    to be interpreted by the GPU shader.

    * Use reinterpret_cast to preserve float bit patterns when passing
      through uint32_t params buffer
    * Update WGSL shader parameter types from u32 to f32
    * Re-enable XIELU support (was disabled due to numerical issues)

    Fixes NMSE test failures for XIELU operation on WebGPU backend.

commit 5ca9b5e49ea7cddc9ab7c8b43a11a9c76a4dff4a
Author: neha-ha <redacted>
Date:   Tue Nov 18 12:17:00 2025 -0800

    Refactored pipelines and workgroup calculations (llama/10)

    * refactored pipelines

    * refactored workgroup calculation

    * removed commented out block of prior maps

    * Clean up ceiling division pattern

    ---------

Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Reese Levine <redacted>
Author: James Contini <redacted>
Date:   Wed Oct 29 23:13:06 2025 -0700

    formatted embed wgsl and ggml-webgpu.cpp

commit e1f6baea31645e5d96ad53664acae856f74b96f4
Author: James Contini <redacted>
Date:   Wed Oct 29 23:08:37 2025 -0700

    implemented REPL_Template support and removed bug in unary operators kernel

commit 8c70b8fece445cdc9a8c660dbddbf201e52da2bb
Author: James Contini <redacted>
Date:   Wed Oct 15 16:14:20 2025 -0700

    responded and dealt with PR comments

commit f9282c660c10dec4487d434549bdb707a9cd9f37
Author: James Contini <redacted>
Date:   Sun Oct 12 13:41:41 2025 -0700

    removed unnecesarry checking if node->src[1] exists for unary operators

commit 4cf28d7dec41c29186d66152735b244c5699f9dc
Author: James Contini <redacted>
Date:   Sun Oct 12 13:32:45 2025 -0700

    All operators (inlcluding xielu) working

commit 74c6add1761a59d2c2ff60b60e8ad3c8300f6d3e
Author: James Contini <redacted>
Date:   Fri Oct 10 13:16:48 2025 -0700

    fixed autoconfig

commit 362749910be4f0120c8ffb21ceddeb7d2c088e51
Author: James Contini <redacted>
Date:   Fri Oct 10 13:10:46 2025 -0700

    removed vestigial files

commit cb0858333785757804c5104e59c4981843207c16
Author: James Contini <redacted>
Date:   Fri Oct 10 12:59:32 2025 -0700

    abides by editor-config

commit 5360e2852a4b51197d7d67d0a5d42e908b02d7ed
Author: James Contini <redacted>
Date:   Fri Oct 10 12:45:57 2025 -0700

    rms_norm double declaration bug atoned

commit 7b09baa4aa53711be5a126043670cc182c78bfcd
Merge: 8a6ec843 74b8fc17
Author: James Contini <redacted>
Date:   Fri Oct 10 11:50:03 2025 -0700

    resolving merge conflicts

commit 8a6ec843a50ab82f8cef59b4558eb63f318ba02d
Author: James Contini <redacted>
Date:   Wed Oct 8 18:06:47 2025 -0700

    unary operators pass ggml tests

commit c3ae38278a2db236adc5912c9140e4f0d63f2c19
Author: James Contini <redacted>
Date:   Wed Oct 1 16:22:40 2025 -0700

    neg passes backend test

commit aa1c9b2f8877a405470ca56709c42a1fd43713de
Author: James Contini <redacted>
Date:   Tue Sep 30 23:55:27 2025 -0700

    neg f16xf32xip builds and runs, havent actually ran a model that uses neg kernel yet though

Co-authored-by: James Contini <redacted>
Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Abhijit Ramesh <redacted>
* Remove extra code and format

* Add ops documentation (finally)

* ggml webgpu: add SOFTPLUS unary operator

Implements SOFTPLUS (log(1 + exp(x))) with f16/f32 support. Uses f32
precision for intermediate calculations to prevent f16 overflow.

* Add shader implementation and 4 variants (f32/f16, inplace/non-inplace)
* Register pipelines and device support
* Follow Vulkan backend numerical stability pattern

* ggml webgpu: add EXPM1 unary operator

Implements EXPM1 (exp(x) - 1) with f16/f32 support.

* Add shader implementation and 4 variants (f32/f16, inplace/non-inplace)
* Register pipelines and device support

* ggml webgpu: add FLOOR unary operator

Implements FLOOR (rounds down to nearest integer) with f16/f32 support.

* Add shader implementation and 4 variants (f32/f16, inplace/non-inplace)
* Register pipelines and device support

* ggml webgpu: add CEIL unary operator

Implements CEIL (rounds up to nearest integer) with f16/f32 support.

* Add shader implementation and 4 variants (f32/f16, inplace/non-inplace)
* Register pipelines and device support

* ggml webgpu: add ROUND unary operator

Implements ROUND (rounds to nearest integer) with f16/f32 support.

* Add shader implementation and 4 variants (f32/f16, inplace/non-inplace)
* Register pipelines and device support

* ggml webgpu: add TRUNC unary operator

Implements TRUNC (truncates towards zero) with f16/f32 support.

* Add shader implementation and 4 variants (f32/f16, inplace/non-inplace)
* Register pipelines and device support

* docs : update WebGPU support for unary operators (FLOOR, CEIL, ROUND, TRUNC, EXPM1, SOFTPLUS)

* Updates to webgpu get_memory

* Move shared state (webgpu_context) and device creation out of registration context, device context, and buffer context, and move into backend context

* Small cleanup

* Move Instance, Device, Adapter, Device creation, and capabilities to global state while moving Queue, pipelines, and buffers to per-thread state.

* Cleanups

* More cleanup

* Move staging_buf mutex to global context

* Resolve merge

* Resolve merge

* Resolve merge

* Clean up merge errors, delete forward declaration, and run clang-format

* Rename device_init to backend_init

* Move webgpu_context to backend_context

* Move buffer context members into global context and refactor function calls

* Run clang-format

* Remove commends

* Move parameter buffers to per-thread, add single memset_tensor param buf

* Fix CI compilation issue

* Fix builds for emscripten not supporting subgroups

* cleanup

* cleanup

---------

Co-authored-by: Reese Levine <redacted>
5 weeks agoggml-zendnn : update ZenDNN git tag to main branch (llama/19133)
Vishal Singh [Tue, 27 Jan 2026 22:21:36 +0000 (03:51 +0530)]
ggml-zendnn : update ZenDNN git tag to main branch (llama/19133)

5 weeks agoCUDA: tune GLM 4.7 Flash FA kernel selection logic (llama/19097)
Johannes Gäßler [Tue, 27 Jan 2026 13:28:56 +0000 (14:28 +0100)]
CUDA: tune GLM 4.7 Flash FA kernel selection logic (llama/19097)

5 weeks agoggml-cpu: aarm64: q6_K repack gemm and gemv (and generic) implementations (i8mm)...
Alberto Cabrera Pérez [Tue, 27 Jan 2026 09:08:10 +0000 (09:08 +0000)]
ggml-cpu: aarm64: q6_K repack gemm and gemv (and generic) implementations (i8mm) #18860 (llama/18888)

* Boilerplate for q6_K repack

* q6_K repack to q6_Kx8 implementation

Signed-off-by: Alberto Cabrera <redacted>
* q6_K generic gemv and gemm

* wip, gemm_q6_K 8x8

* Still WIP: loading of q8s, q6h and q6l

* first working version of q6_K gemm

* Moved q6 loads outside of sb block, Unrolled inner loop

* Replaced modulo with mask

* First implementation of GEMV

* ggml_vdotq_s32 -> vdotq_s32

* Reduce width of accumulators in q6_K gemv

* Bsums instead of calc bias. Preload scales to use vget_lane. Unroll.

* Reuse scales in GEMM (same GEMV opt)

* Added todos for bsum and different qh repack

* Arch fallback

* VSLIQ for merging qh adn ql

* Removed TODO, already tested

* Apply suggestions

Co-authored-by: Georgi Gerganov <redacted>
* Removed unused import

---------

Signed-off-by: Alberto Cabrera <redacted>
Co-authored-by: Georgi Gerganov <redacted>
5 weeks agoReduce CPU-side stalls due to the CUDA command buffer being full (llama/19042)
Gaurav Garg [Tue, 27 Jan 2026 06:52:44 +0000 (06:52 +0000)]
Reduce CPU-side stalls due to the CUDA command buffer being full (llama/19042)

* [CUDA] Reduce CPU-side stalls due to the CUDA command buffer being full

With pipeline parallelism, during prompt processing, the CPU-side CUDA command buffer gets full, stalling the CPU. Due to this, enough work doesn't get submitted to the GPU, causing bubbles in the GPU timeline.
Fix this by setting the CUDA environment variable CUDA_SCALE_LAUNCH_QUEUES to 4x to increase the command buffer size.

* Set the env variable in the CUDA backend registry allocation

* Add link to PR in code comment

* Remove warning logs and update documentation

5 weeks agoggml-cpu: Enable FP16 MMA kernels on PPC (llama/19060)
shalinib-ibm [Tue, 27 Jan 2026 03:52:34 +0000 (09:22 +0530)]
ggml-cpu: Enable FP16 MMA kernels on PPC (llama/19060)

5 weeks agoopencl: add flattened q6_K mv (llama/19054)
lhez [Fri, 30 Jan 2026 08:34:38 +0000 (10:34 +0200)]
opencl: add flattened q6_K mv (llama/19054)

5 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 30 Jan 2026 08:33:57 +0000 (10:33 +0200)]
sync : llama.cpp

5 weeks agoCUDA: fix padding of GQA to power of 2 in FA (llama/19115)
Johannes Gäßler [Mon, 26 Jan 2026 22:24:58 +0000 (23:24 +0100)]
CUDA: fix padding of GQA to power of 2 in FA (llama/19115)

5 weeks agoCUDA: faster FA for GQA > 1 but not power of 2 (llama/19092)
Johannes Gäßler [Sun, 25 Jan 2026 20:19:47 +0000 (21:19 +0100)]
CUDA: faster FA for GQA > 1 but not power of 2 (llama/19092)

5 weeks agometal : fix recommendedMaxWorkingSetSize availability on legacy iOS/macOS (llama...
ccbinn [Sun, 25 Jan 2026 18:07:19 +0000 (02:07 +0800)]
metal : fix recommendedMaxWorkingSetSize availability on legacy iOS/macOS (llama/19088)

Co-authored-by: chenbin11 <redacted>
5 weeks agoggml-cpu: Use tiled FA for prompt-processing (llama/19012)
Aman Gupta [Sun, 25 Jan 2026 15:25:58 +0000 (23:25 +0800)]
ggml-cpu: Use tiled FA for prompt-processing (llama/19012)

* ggml-cpu: Use tiled FA for prompt-processing

the FA performance is gimped on CPU on long contexts because it essentially uses a vector kernel. This PR adds a tiled FA for PP. Perf tuning for tile sizes done on a AMD EPYC single-socket 64-c machine.

* fix out of bounds for mask

* skip rows where there are all masks

* skip tile if mask is inf

* store mask in worksize

* check inf tile earlier

5 weeks agokv-cache : support V-less cache (llama/19067)
Georgi Gerganov [Sun, 25 Jan 2026 13:48:56 +0000 (15:48 +0200)]
kv-cache : support V-less cache (llama/19067)

* kv-cache : support V-less cache

* cuda : better check for V_is_K_view

* cuda : improve V_is_K_view check

* graph : add comments

* hparams : refactor

5 weeks agoCUDA: re-use MLA K data for V in MMA FA (llama/19057)
Johannes Gäßler [Sat, 24 Jan 2026 09:09:36 +0000 (10:09 +0100)]
CUDA: re-use MLA K data for V in MMA FA (llama/19057)

5 weeks agoggml-cuda: enable cuda-graphs for `n-cpu-moe` (llama/18934)
Aman Gupta [Sat, 24 Jan 2026 06:25:20 +0000 (14:25 +0800)]
ggml-cuda: enable cuda-graphs for `n-cpu-moe` (llama/18934)

* ggml-cuda: add split-wise cuda graph

* add n-cpu-moe compare_llama_bench.py

* fix hip/musa builds

5 weeks agoggml-hexagon: flash-attn opt (llama/19025)
nullname [Sat, 24 Jan 2026 06:02:07 +0000 (14:02 +0800)]
ggml-hexagon: flash-attn opt (llama/19025)

* optimize flash attention kernel by improving score computation and online softmax update

* wip

* Refactor online softmax update in flash attention kernel for improved performance

* Optimize flash attention kernel by replacing float array with HVX_Vector for score computation

* wip

5 weeks agouse malloc to support both iGPU and dGPU in same time (llama/18992)
Neo Zhang [Fri, 23 Jan 2026 12:54:10 +0000 (20:54 +0800)]
use malloc to support both iGPU and dGPU in same time (llama/18992)

* use malloc to support both iGPU and dGPU in same time

* support windows

---------

Co-authored-by: Neo Zhang Jianyu <redacted>
5 weeks agoggml-cpu: aarm64: q5_K repack gemm and gemv (and generic) implementations (i8mm)...
Alberto Cabrera Pérez [Fri, 23 Jan 2026 07:55:08 +0000 (07:55 +0000)]
ggml-cpu: aarm64: q5_K repack gemm and gemv (and generic) implementations (i8mm) (llama/18860)

* Boilerplate for q5_Kx8 REPACK on ARM and fallback

Signed-off-by: Alberto Cabrera <redacted>
* Implements make_block_q5_Kx8 by extending make_block_q4_Kx8

Signed-off-by: Alberto Cabrera <redacted>
* q5_K repack gemm and gemv generics

* Gemm and Gemv ARM implementations (i8mm)

* Improved qh manipulation looking at non-repack vec_dot implementation

* Full unroll

* Apply Q5_K Gemv vand and vshl optimizations to gemm. Improve comments.

Signed-off-by: Alberto Cabrera <redacted>
* Fix wrong fallback definitions of Q5_K

Signed-off-by: Alberto Cabrera <redacted>
* Fixed comments. Reverted unnecessary formatting

Signed-off-by: Alberto Cabrera <redacted>
* Fixed typo in generic definitions

* Switching AND + Shift with Shift Insert. Better op interleaving.

* Vectorize + unroll the block scales

* Apply gemm optimizations to gemv

* Improve bias calculation

---------

Signed-off-by: Alberto Cabrera <redacted>
5 weeks agomla : make the V tensor a view of K (llama/18986)
Georgi Gerganov [Thu, 22 Jan 2026 20:09:01 +0000 (22:09 +0200)]
mla : make the V tensor a view of K (llama/18986)

* mla : pass V as a view of K to the FA op

* cuda : adjust mla logic to new layout

* kv-cache : fix rope shift

* tests : remove comment

* cuda : fix reusable_cutoff

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

Co-authored-by: Johannes Gäßler <redacted>
5 weeks agoCUDA: fix alignment check for FA (llama/19023)
Johannes Gäßler [Thu, 22 Jan 2026 19:39:25 +0000 (20:39 +0100)]
CUDA: fix alignment check for FA (llama/19023)

5 weeks agoopencl: enable the general fp mm for non-cont input and as a fallback for specialized...
lhez [Thu, 22 Jan 2026 18:29:25 +0000 (10:29 -0800)]
opencl: enable the general fp mm for non-cont input and as a fallback for specialized kqv kernel for adreno (llama/18970)

* opencl: add `copy_to_contiguous` and utilize mm kernels

* opencl: only copy to cont for f32 and f16 tensors

* opencl: use cont mm for fallback when dst is large

* opencl: use nb local to copy-to-cont

* opencl: use local offset as well

5 weeks agoCUDA: add gqa_ratio 4 for GLM 4.7 flash (llama/18953)
Aman Gupta [Thu, 22 Jan 2026 10:51:53 +0000 (18:51 +0800)]
CUDA: add gqa_ratio 4 for GLM 4.7 flash (llama/18953)

5 weeks agoopencl: add TRI op support (llama/18979)
shaofeiqi [Thu, 22 Jan 2026 06:05:54 +0000 (22:05 -0800)]
opencl: add TRI op support (llama/18979)

5 weeks agoggml-zdnn : mark zDNN buffers as non-host (llama/18967)
Aleksei Nikiforov [Thu, 22 Jan 2026 00:16:21 +0000 (01:16 +0100)]
ggml-zdnn : mark zDNN buffers as non-host (llama/18967)

While buffers reside in host memory,
additional transformation is needed to use buffers with zDNN.

Fixes #18848

5 weeks agovulkan: Remove transfer_ctx, do everything in compute_ctx. (llama/18945)
Jeff Bolz [Wed, 21 Jan 2026 17:01:40 +0000 (11:01 -0600)]
vulkan: Remove transfer_ctx, do everything in compute_ctx. (llama/18945)

* vulkan: Remove transfer_ctx, do everything in compute_ctx.

We had a bug where a set_tensor_async (using transfer_ctx) didn't get
submitted before the graph_compute (using compute_ctx) that came after
it. To avoid this sort of issue, just do everything in compute_ctx.

Remove transfer_cmd_pool, which was already unused.

* fix crash with perf logger

5 weeks agovulkan: support flash attention GQA/split_k with small batches (llama/18938)
Jeff Bolz [Wed, 21 Jan 2026 16:43:43 +0000 (10:43 -0600)]
vulkan: support flash attention GQA/split_k with small batches (llama/18938)

5 weeks agoRevert "vulkan: force full subgroups for flash attention to fix intel subgroup crash...
Masato Nakasaka [Wed, 21 Jan 2026 16:13:43 +0000 (01:13 +0900)]
Revert "vulkan: force full subgroups for flash attention to fix intel subgroup crash (#17356)" (llama/18831)

This reverts commit 980b7cd17e055c8c587f79ffda7eb4fddf405566.

5 weeks agovulkan: Use mul_mat_vec_id for small values of n (llama/18918)
Jeff Bolz [Wed, 21 Jan 2026 15:22:02 +0000 (09:22 -0600)]
vulkan: Use mul_mat_vec_id for small values of n (llama/18918)

Change ggml_vk_mul_mat_vec_id_q_f16 to loop over the batch dimension and
update the indexing calculations in get_offsets.

Mat-vec is faster than mat-mat for small values of n. We don't get the same
reuse of the weights as in the non-ID path, but with this the cost is linear
in n rather than n>1 being far slower than n==1.

5 weeks agoCUDA: Fix builds for older CCCL versions by ifdefing strided_iterator (llama/18964)
Oliver Simons [Wed, 21 Jan 2026 01:34:29 +0000 (02:34 +0100)]
CUDA: Fix builds for older CCCL versions by ifdefing strided_iterator (llama/18964)

* CUDA: Fix builds for older CCCL versions by ifdefing strided_iterator

Strided iterator was added in [CCCL
3.1](https://github.com/NVIDIA/cccl/releases/tag/v3.1.0), which is packaged into
[CTK
13.1](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#id5)

* Unindent as per code review request

5 weeks agoCUDA: Replace init_offsets kernel with iterators in cub-based argsort (llama/18930)
Oliver Simons [Tue, 20 Jan 2026 12:11:01 +0000 (13:11 +0100)]
CUDA: Replace init_offsets kernel with iterators in cub-based argsort (llama/18930)

* CUDA: Replace `init_offsets` with iterators in argsort

This is a QOL improvement, saving us the cost of materializing the
iterator

* Remove unnecessary include from top-k.cu

5 weeks agoggml : cleanup path_str() (llama/18928)
Adrien Gallouët [Tue, 20 Jan 2026 10:42:49 +0000 (11:42 +0100)]
ggml : cleanup path_str() (llama/18928)

- Remove pragmas as `std::codecvt_utf8` is not used.
- Avoid implicit `strlen()`.

Signed-off-by: Adrien Gallouët <redacted>
5 weeks agometal : enable FA for MLA heads (llama/18950)
Georgi Gerganov [Tue, 20 Jan 2026 10:21:28 +0000 (12:21 +0200)]
metal : enable FA for MLA heads (llama/18950)

5 weeks agoggml : add ggml_build_forward_select (llama/18550)
Georgi Gerganov [Mon, 19 Jan 2026 18:03:19 +0000 (20:03 +0200)]
ggml : add ggml_build_forward_select (llama/18550)

* ggml : add ggml_build_forward_select

* cuda : adapt CUDA graph compat to new feature

* vulkan : update logic to handle command buffer closing

* ggml : check compute for fusion

* ggml : add comment

5 weeks agoopencl: fix q6_K mv for m=1 (llama/18893)
lhez [Sat, 17 Jan 2026 21:50:32 +0000 (13:50 -0800)]
opencl: fix q6_K mv for m=1 (llama/18893)

5 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 30 Jan 2026 08:33:07 +0000 (10:33 +0200)]
sync : llama.cpp

5 weeks agoggml webgpu: support for backend sampling (llama/18880)
Reese Levine [Fri, 30 Jan 2026 08:32:34 +0000 (10:32 +0200)]
ggml webgpu: support for backend sampling (llama/18880)

5 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 30 Jan 2026 08:31:30 +0000 (10:31 +0200)]
sync : llama.cpp

5 weeks agoggml : extend ggml_pool_1d + metal (llama/16429)
Thore Koritzius [Fri, 16 Jan 2026 14:59:56 +0000 (15:59 +0100)]
ggml : extend ggml_pool_1d + metal (llama/16429)

* chore: resolve conflicts

* feat: ggml metal impl

* fix: ggml_metal_kargs_pool_1d struct

* fix: require contiguous input

* chore: test pool_1d

* chore: limit pool1d test cases to p0=0 and s0=k0 to conform with asserts

* chore: add p0 and s0 to testing

* fix: allow padding for cpu and metal

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

* fix: correct single-threaded loop

* ggml : cleanup

* tests : add ne[1] != 1 tests

* fix: ne[1] handling in np

* cont : fixes

---------

Co-authored-by: Georgi Gerganov <redacted>
5 weeks agoggml-blas: hide warnings from included BLAS headers (llama/18818)
Perry Naseck [Fri, 16 Jan 2026 11:38:25 +0000 (06:38 -0500)]
ggml-blas: hide warnings from included BLAS headers (llama/18818)

* fix compile def openblas, blis for compat libs, nvpl compile def, warn if no blas vendor set

* ggml-blas: hide warnings from included BLAS headers

5 weeks agoCANN: Remove unused `ggml_cann_get_device` function (llama/18625)
Raul Torres [Fri, 16 Jan 2026 08:34:09 +0000 (08:34 +0000)]
CANN: Remove unused `ggml_cann_get_device` function (llama/18625)

5 weeks agoCANN: fix an issue where get_env was not fully renamed (llama/18796)
Chenguang Li [Fri, 16 Jan 2026 08:24:04 +0000 (16:24 +0800)]
CANN: fix an issue where get_env was not fully renamed (llama/18796)

* CANN: fix an issue where get_env was not fully renamed

* ci: add cann with acl group

* ci: define use_acl_graph using GitHub Action

* ci: update cann dockerfile with acl graph

5 weeks agoCANN: support gated linear attn (llama/18653)
hipudding [Fri, 16 Jan 2026 08:18:49 +0000 (16:18 +0800)]
CANN: support gated linear attn (llama/18653)

* CANN: support gated linear attn

This change adds support for the GGML_OP_GATED_LINEAR_ATTN operator.
The feature was implemented by YushengZhao. Because the previous
submission was based on an outdated codebase, this PR was rebased to
merge.

Co-authored-by: YushengZhao <redacted>
Co-authored-by: hipudding <redacted>
* CANN: optimize OP gla

Optimize gla for high preformance

* Remove unused comments

---------

Co-authored-by: 赵禹昇 <redacted>
Co-authored-by: YushengZhao <redacted>
5 weeks agoOpenCL: add SOLVE_TRI op support (llama/18846)
shaofeiqi [Thu, 15 Jan 2026 19:17:17 +0000 (11:17 -0800)]
OpenCL: add SOLVE_TRI op support (llama/18846)

5 weeks agocuda : print less debug logs when disabling cuda graphs (llama/18868)
Georgi Gerganov [Thu, 15 Jan 2026 18:53:01 +0000 (20:53 +0200)]
cuda : print less debug logs when disabling cuda graphs (llama/18868)

5 weeks agoCUDA: fix allignment on register spill for FA (llama/18815)
Johannes Gäßler [Thu, 15 Jan 2026 14:14:50 +0000 (15:14 +0100)]
CUDA: fix allignment on register spill for FA (llama/18815)

5 weeks agoggml-cpu: optimize ggml_vec_dot_bf16 for Power9 (llama/18837)
shalinib-ibm [Thu, 15 Jan 2026 09:31:18 +0000 (15:01 +0530)]
ggml-cpu: optimize ggml_vec_dot_bf16 for Power9 (llama/18837)

5 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 30 Jan 2026 08:30:32 +0000 (10:30 +0200)]
sync : llama.cpp

5 weeks agohexagon: support for OP_CPY, host buffers now optional (llama/18822)
Max Krasnyansky [Fri, 30 Jan 2026 08:28:03 +0000 (10:28 +0200)]
hexagon: support for OP_CPY, host buffers now optional (llama/18822)

5 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 30 Jan 2026 08:26:54 +0000 (10:26 +0200)]
sync : llama.cpp

5 weeks agoCUDA: Factor out and re-use `block_reduce` function (llama/18785)
Oliver Simons [Thu, 15 Jan 2026 02:44:54 +0000 (03:44 +0100)]
CUDA: Factor out and re-use `block_reduce` function (llama/18785)

* CUDA: Refactor and expose two_stage_warp_reduce_* function

* Use `two_stage_warp_reduce` also in softmax kernel, move smem out of it

Moving smem out of `__device__` function to `__global__` function
allows for explicit smem reuse, as either compiler or cuda rt seem to not
free it afterwards (`cudaFuncSetAttribute` fails when not accounting for
it once for each call to two_stage_warp_reduce)

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

Co-authored-by: Aman Gupta <redacted>
* Use two_stage_warp_reduce in group_norm_f32

* Use two_stage_warp_reduce in rms_norm_f32

* Fix smem calculation which expects bytes

* Make `two_stage_warp_reduce` accept all values warp_reduce accepts

Also integrate it into norm_f32 function

* Use two_stage_warp_reduce in l2_norm_f32

* Use type traits for block reduction for better legibility

Also adresss other requests by @am17an such as variable renaming

* Make norm tests cover all cuda paths

* Mark columns % WARP_SIZE !=0 as supported for RMS_NORM_BACK

Unit-tests passed locally, let's see if they pass in the CI as well

* Use `enum class` for `block_reduce_method`

This is more type-safe than plain enum

* Rename variables as suggested in code review by @am17an

* Rename two_stage_warp_reduce -> block_reduce

* Fix trailing whitespace in common.cuh

* Make condition of static_assert type-dependent

This delays evaluation until the template is actually instantiated.
Otherwise, some compilers may evaluate the assert when parsing the
template, resulting in build errors as observed here:

https://github.com/ggml-org/llama.cpp/actions/runs/20960323123/job/60235530068?pr=18785

* Inline definitions

---------

Co-authored-by: Aman Gupta <redacted>
5 weeks agovulkan: Check maxStorageBufferRange in supports_op (llama/18709)
Jeff Bolz [Wed, 14 Jan 2026 09:59:05 +0000 (03:59 -0600)]
vulkan: Check maxStorageBufferRange in supports_op (llama/18709)

* vulkan: Check maxStorageBufferRange in supports_op

* skip maxStorageBufferRange check when shader64BitIndexing is enabled

5 weeks agoCUDA : fix typo in clang pragma comment [no ci] (llama/18830)
Daniel Bevenius [Wed, 14 Jan 2026 09:31:49 +0000 (10:31 +0100)]
CUDA : fix typo in clang pragma comment [no ci] (llama/18830)

5 weeks agovulkan: work around Intel fp16 bug in mmq (llama/18814)
Ruben Ortlam [Wed, 14 Jan 2026 08:41:23 +0000 (09:41 +0100)]
vulkan: work around Intel fp16 bug in mmq (llama/18814)

5 weeks agoggml-metal: do not copy headers for embedded, use current binary dir for embedded...
Perry Naseck [Wed, 14 Jan 2026 07:22:25 +0000 (02:22 -0500)]
ggml-metal: do not copy headers for embedded, use current binary dir for embedded (llama/18705)

5 weeks agoHIP: add fattn-mma-f16 for RDNA4 (llama/18481)
yulo [Tue, 13 Jan 2026 12:52:16 +0000 (20:52 +0800)]
HIP: add fattn-mma-f16 for RDNA4 (llama/18481)

* finish VQ mma

* flash_attn_ext_f16_iter

* KQ_rowsum

* correct exp

* fix scale error

* fix softmax scale

* fix softmax scale

* enable fattn on cpu side

* fix random error

* disable fattn-mma-f16 on rdna3

* fix wrong col for rdna

* use identity mat to transpose

* resolve conflicts

* basic tuning for DeepSeek-R1-Distill-Qwen-1.5B

* fix volta compile error

* align rdna4 policy for fattn

* adjust fattn policy

* adjust kernel selection logic

* update as the review comments

* keep fattn-wmma logic

* adjust kernel selection logic

---------

Co-authored-by: zhang hui <redacted>
Co-authored-by: Johannes Gäßler <redacted>
8 weeks agosync : llama.cpp
Georgi Gerganov [Tue, 13 Jan 2026 12:18:51 +0000 (14:18 +0200)]
sync : llama.cpp

8 weeks agoCUDA : fix unused argument when USE_CUDA_GRAPH=OFF (llama/18800)
Georgi Gerganov [Tue, 13 Jan 2026 10:25:53 +0000 (12:25 +0200)]
CUDA : fix unused argument when USE_CUDA_GRAPH=OFF (llama/18800)

8 weeks agovulkan: change memory_logger to be controlled by an env var (llama/18769)
Jeff Bolz [Mon, 12 Jan 2026 12:32:55 +0000 (06:32 -0600)]
vulkan: change memory_logger to be controlled by an env var (llama/18769)

8 weeks agovulkan: Use VK_EXT_shader_64bit_indexing to handle large mat_mul(_id) (llama/18678)
Jeff Bolz [Mon, 12 Jan 2026 11:32:13 +0000 (05:32 -0600)]
vulkan: Use VK_EXT_shader_64bit_indexing to handle large mat_mul(_id) (llama/18678)

This fixes incoherent output in Llama-4-Maverick-17B-128E-PAB-Q8_0, which
has a mul_mat_id with an A matrix that's Q8_0 8192 x 5120 x 128.

This should work when the number of blocks in the A matrix is less than 2^32
(for mul_mat_vec or mul_mm_cm2), or for mul_mm I think the limit is like
2^32*LOAD_VEC_A elements.

- Divide batch_stride by QUANT_K earlier, so the block index calculation works in 32b.
- Each vk_pipeline_struct has a linked list of pipelines that will allow it to handle
variants. So far this change just adds a single use case for this, compiling with the
e64BitIndexingEXT flag.
- Use the 64b indexing variant when the A matrix is larger than maxStorageBufferRange.

64-bit indexing has some cost - around 3-5% in MoE models, so it's worth the effort
to avoid enabling it unconditionally.

8 weeks agovulkan: Disable large coopmat matmul configuration on proprietary AMD driver (llama...
Ruben Ortlam [Mon, 12 Jan 2026 06:29:35 +0000 (07:29 +0100)]
vulkan: Disable large coopmat matmul configuration on proprietary AMD driver (llama/18763)

* vulkan: Disable large coopmat matmul configuration on proprietary AMD driver

* Also disable the large tile size

8 weeks agoVulkan: Optimize Matmul parameters for AMD GPUs with Coopmat support (llama/18749)
Ruben Ortlam [Sun, 11 Jan 2026 16:33:33 +0000 (17:33 +0100)]
Vulkan: Optimize Matmul parameters for AMD GPUs with Coopmat support (llama/18749)

* vulkan: Enable and optimize large matmul parameter combination for AMD

* limit tuning to AMD GPUs with coopmat support

* use tx_m values instead of _l

8 weeks agosync : llma.cpp
Georgi Gerganov [Sun, 11 Jan 2026 07:18:21 +0000 (09:18 +0200)]
sync : llma.cpp

8 weeks agoopencl: add SOFTPLUS op support (llama/18726)
shaofeiqi [Sun, 11 Jan 2026 05:57:44 +0000 (21:57 -0800)]
opencl: add SOFTPLUS op support (llama/18726)

8 weeks agotest-backend-ops: fix mxfp4 tests on blackwell (llama/18736)
Aman Gupta [Sat, 10 Jan 2026 17:12:57 +0000 (01:12 +0800)]
test-backend-ops: fix mxfp4 tests on blackwell (llama/18736)

8 weeks agoHIP: adjust RDNA3.5 MMQ kernel selction logic (llama/18666)
Johannes Gäßler [Sat, 10 Jan 2026 16:19:01 +0000 (17:19 +0100)]
HIP: adjust RDNA3.5 MMQ kernel selction logic (llama/18666)

8 weeks agocmake : update blas logic (llama/18205)
Perry Naseck [Sat, 10 Jan 2026 16:00:54 +0000 (11:00 -0500)]
cmake : update blas logic (llama/18205)

8 weeks agoCorrected: changed s13 = src1->nb[3] instead of nb[2] (llama/18724)
Michael Wand [Sat, 10 Jan 2026 09:16:07 +0000 (01:16 -0800)]
Corrected: changed s13 = src1->nb[3] instead of nb[2] (llama/18724)

8 weeks agoopencl: add EXPM1 op (llama/18704)
shaofeiqi [Fri, 9 Jan 2026 18:13:13 +0000 (10:13 -0800)]
opencl: add EXPM1 op (llama/18704)

8 weeks agoUpdates to webgpu get_memory (llama/18707)
Reese Levine [Fri, 9 Jan 2026 16:17:18 +0000 (08:17 -0800)]
Updates to webgpu get_memory (llama/18707)

8 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 9 Jan 2026 15:52:58 +0000 (17:52 +0200)]
sync : llama.cpp

8 weeks agollama: use host memory if device reports 0 memory (llama/18587)
Aaron Teo [Thu, 8 Jan 2026 21:34:56 +0000 (05:34 +0800)]
llama: use host memory if device reports 0 memory (llama/18587)

8 weeks agoggml-webgpu: Fix GGML_MEM_ALIGN to 8 for emscripten. (llama/18628)
Masashi Yoshimura [Thu, 8 Jan 2026 16:36:42 +0000 (01:36 +0900)]
ggml-webgpu: Fix GGML_MEM_ALIGN to 8 for emscripten. (llama/18628)

* Fix GGML_MEM_ALIGN to 8 for emscripten.

* Add a comment explaining the need for GGML_MEM_ALIGN == 8 in 64-bit wasm with emscripten

8 weeks agoggml webgpu: initial flashattention implementation (llama/18610)
Reese Levine [Thu, 8 Jan 2026 16:23:39 +0000 (08:23 -0800)]
ggml webgpu: initial flashattention implementation (llama/18610)

* FlashAttention (llama/13)

* Add inplace softmax

* Move rms_norm to split row approach

* Update debug for supports_op

* clean up debug statements

* neg f16xf32xip builds and runs, havent actually ran a model that uses neg kernel yet though

* neg passes backend test

* unary operators pass ggml tests

* rms_norm double declaration bug atoned

* abides by editor-config

* removed vestigial files

* fixed autoconfig

* All operators (inlcluding xielu) working

* removed unnecesarry checking if node->src[1] exists for unary operators

* responded and dealt with PR comments

* implemented REPL_Template support and removed bug in unary operators kernel

* formatted embed wgsl and ggml-webgpu.cpp

* Faster tensors (llama/8)

Add fast matrix and matrix/vector multiplication.

* Use map for shader replacements instead of pair of strings

* Wasm (llama/9)

* webgpu : fix build on emscripten

* more debugging stuff

* test-backend-ops: force single thread on wasm

* fix single-thread case for init_tensor_uniform

* use jspi

* add pthread

* test: remember to set n_thread for cpu backend

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

* Intermediate state

* Fast working f16/f32 vec4

* Working float fast mul mat

* Clean up naming of mul_mat to match logical model, start work on q mul_mat

* Setup for subgroup matrix mat mul

* Basic working subgroup matrix

* Working subgroup matrix tiling

* Handle weirder sg matrix sizes (but still % sg matrix size)

* Working start to gemv

* working f16 accumulation with shared memory staging

* Print out available subgroup matrix configurations

* Vectorize dst stores for sg matrix shader

* Gemv working scalar

* Minor set_rows optimization (llama/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

* Working subgroup matrix code for (semi)generic sizes

* Remove some comments

* Cleanup code

* Update dawn version and move to portable subgroup size

* Try to fix new dawn release

* Update subgroup size comment

* Only check for subgroup matrix configs if they are supported

* Add toggles for subgroup matrix/f16 support on nvidia+vulkan

* Make row/col naming consistent

* Refactor shared memory loading

* Move sg matrix stores to correct file

* Working q4_0

* Formatting

* Work with emscripten builds

* Fix test-backend-ops emscripten for f16/quantized types

* Use emscripten memory64 to support get_memory

* Add build flags and try ci

---------

Co-authored-by: Xuan Son Nguyen <redacted>
* Remove extra whitespace

* Move wasm single-thread logic out of test-backend-ops for cpu backend

* Disable multiple threads for emscripten single-thread builds in ggml_graph_plan

* Refactored pipelines and workgroup calculations (llama/10)

* refactored pipelines

* refactored workgroup calculation

* removed commented out block of prior maps

* Clean up ceiling division pattern

---------

Co-authored-by: Neha Abbas <redacted>
Co-authored-by: Reese Levine <redacted>
* Start work on flash attention

* Shader structure set up (many bugs still)

* debugging

* Working first test

* Working with head grouping, head sizes to 128, logit softcap, mask/sinks enabled, f32

* Generalize softmax to work with multiple subgroups, f16 accumulation, mask shared memory tiling

* Start work on integrating pre-wgsl

* Separate structs/initial shader compilation library into separate files

* Work on compilation choices for flashattention

* Work on subgroup matrix/tile size portability

* subgroup size agnostic online softmax

* Cleanups, quantization types

* more cleanup

* fix wasm build

* Refactor flashattention to increase parallelism, use direct loads for KV in somce cases

* Checkpoint

* formatting

* Update to account for default kv cache padding

* formatting shader

* Add workflow for ggml-ci webgpu

* Try passing absolute path to dawn in ggml-ci

* Avoid error on device destruction, add todos for proper cleanup

* Fix unused warning

* Forgot one parameter unused

* Move some flashattn computation to f32 for correctness

8 weeks agovulkan: fix push constant size for quantize_q8_1 (llama/18687)
Jeff Bolz [Thu, 8 Jan 2026 14:40:58 +0000 (08:40 -0600)]
vulkan: fix push constant size for quantize_q8_1 (llama/18687)

I added an assert to catch further mismatches, and it found several.
Fix those, too.

8 weeks agovulkan: optimize ssm_scan (llama/18630)
Jeff Bolz [Thu, 8 Jan 2026 14:16:54 +0000 (08:16 -0600)]
vulkan: optimize ssm_scan (llama/18630)

* vulkan: optimize ssm_scan

* fix warp vs subgroup naming

8 weeks agometal : add MoE kernel specialization for ne20=5 (llama/18667)
도로로도로또 [Thu, 8 Jan 2026 10:37:45 +0000 (19:37 +0900)]
metal : add MoE kernel specialization for ne20=5 (llama/18667)

Add template specialization for kernel_mul_mm_id_map0 with ne20=5
to support models using 5 active experts (e.g., VAETKI).

8 weeks agoggml: add env var GGML_OP_OFFLOAD_MIN_BATCH (llama/18535)
Doctor Shotgun [Thu, 8 Jan 2026 09:03:21 +0000 (01:03 -0800)]
ggml: add env var GGML_OP_OFFLOAD_MIN_BATCH (llama/18535)

* ggml: add env var GGML_OP_OFFLOAD_MIN_BATCH
* makes the min_batch_size for triggering op offload configurable via env var, defaulting to the prior hardcoded value of 32

* ggml: read GGML_OP_OFFLOAD_MIN_BATCH once and store to dev ctx

* cann: forward declaration of device context struct

* cann: move offload op check after device context declaration

* cuda: fix whitespace

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

Co-authored-by: Aman Gupta <redacted>
8 weeks agoopencl: add FILL op support (llama/18682)
shaofeiqi [Thu, 8 Jan 2026 06:04:50 +0000 (22:04 -0800)]
opencl: add FILL op support (llama/18682)

8 weeks agocuda : fix build on cuda 12.8 (llama/18672)
Oliver Walsh [Wed, 7 Jan 2026 21:32:44 +0000 (21:32 +0000)]
cuda : fix build on cuda 12.8 (llama/18672)

compute121 requires 12.9

Signed-off-by: Oliver Walsh <redacted>
8 weeks agovulkan: reject ops when a tensor is too large to allocate (llama/18646)
Jeff Bolz [Wed, 7 Jan 2026 11:03:32 +0000 (05:03 -0600)]
vulkan: reject ops when a tensor is too large to allocate (llama/18646)

8 weeks agovulkan: Warptile tuning for Intel Xe2/Xe3 (llama/18178)
virajwad [Wed, 7 Jan 2026 10:59:47 +0000 (02:59 -0800)]
vulkan: Warptile tuning for Intel Xe2/Xe3 (llama/18178)

* modify warptile tuning for xe3

* intel vendor check w/ coopmat support

* fix back formatting

* fix formatting change 2

* move intel check to chip specific tuning part

* Change to support both windows and linux

* modify m_warptile to l_warptile for intel

* modify warptile tuning for bf16 matmuls to fix regression (m_warptile to l_warptile)

* Code style changes

* Code style changes (2)

* Code style changes (3)

8 weeks agovulkan: more mul mat optimizations (llama/18533)
Eve [Wed, 7 Jan 2026 10:13:17 +0000 (10:13 +0000)]
vulkan: more mul mat optimizations (llama/18533)

* q4_k

* q5_k

* q2_k

* q4_1

* q5_1

* better buf index

8 weeks agoCANN: Fix rename for get_env (llama/18652)
hipudding [Wed, 7 Jan 2026 08:11:31 +0000 (16:11 +0800)]
CANN: Fix rename for get_env (llama/18652)

In #18624, get_env in ggml-cann was renamed to get_env_as_lowercase
to accurately reflect the function’s behavior and reduce the chance
of misuse. However, the update missed renaming call sites in other
files. This commit fixes that oversight.

8 weeks agoCANN: Rename `get_env` to `get_env_as_lowercase` (llama/18624)
Raul Torres [Wed, 7 Jan 2026 02:01:25 +0000 (02:01 +0000)]
CANN: Rename `get_env` to `get_env_as_lowercase` (llama/18624)

8 weeks agoHexagon add support for f16/f32 flash attention, scale, set-rows and improve f16...
Max Krasnyansky [Wed, 7 Jan 2026 01:38:29 +0000 (17:38 -0800)]
Hexagon add support for f16/f32 flash attention, scale, set-rows and improve f16/32 matmul (llama/18611)

* hexagon: improve fp16 matmul and add fp32/fp16 flash-attention

* hexagon: add support for set-rows fp32 -> fp16 with i32/i64 row-idx

* hexagon: add support for SCALE fp32

* hexagon: replace scalar fp32 -> fp16 copy with HVX

* hexagon: optimize flash_atten_ext with aligned VTCM buffers and DMA

- Implements double-buffered DMA prefetching for K, V, and Mask tensors.
- Ensures K and V rows in VTCM are padded to 128 bytes to support aligned HVX operations.
- Correctly synchronizes DMA transfers to prevent race conditions.
- Uses `FLASH_ATTN_BLOCK_SIZE` of 128 for efficient chunking.

* hexagon: use aligned mad_f16

* hexagon: flash_atten more aligned ops

* hexagon: optimize scale_f32 hvx helpers

* hexagon: unroll fa loops

* hexagon: remove unused set-rows log

* hexagon: flash_attn_ext add support for DMAing Q

- Update `op_flash_attn_ext` to include Q row size in scratchpad allocation.
- Pad Q row size to 128 bytes for alignment.
- Implement DMA transfer for Q tensor in `flash_attn_ext_f16_thread`.
- Update dot product computations to use VTCM-buffered Q data.

* hexagon: fix handling of NANs hvx dotproducts

* hexagon: cleanup spad allocation in flash-atten

* hexagon: improve fp16/fp32 matmul

- Introduced `vec_dot_f16_f16` and `vec_dot_f16_f16_rx2` kernels using efficient HVX dot product intrinsics.
- Added `quantize_fp32_f16` to copy/convert weights from DDR to VTCM
- Updated `op_matmul` to use the optimized path when VTCM capacity allows and broadcasting requirements are compatible.
- Implemented fallback logic to the original implementation for complex broadcasting scenarios.

* hexagon: fix HVX_ARCH check

* hexagon: matmul cleanup and fp16 fixes

Use aligned vec_dot_f16 for 2d matmuls and unaligned version for 4d.

* hexagon: fix fp16 x fp16 matmuls and some minor refactoring

* hexagon: add support for GET_ROWS f32 -> f32

Also optimize SET_ROWS threading a bit when we have just a few rows to process.

* hexagon: optimize set-rows threading

* hexagon: update adb/run-bench.sh to properly support experimental and verbose options

* hexagon: flash_atten use aligned vectors for dot products

8 weeks agoggml : optimize cuda ssm_scan using warp-level reduction (llama/18505)
Aadeshveer Singh [Tue, 6 Jan 2026 18:24:34 +0000 (23:54 +0530)]
ggml : optimize cuda ssm_scan using warp-level reduction (llama/18505)

* ggml : optimize cuda ssm_scan using warp-level reduction

* ggml : apply code review suggestions (style, const, constexpr)

* ggml : add TODO regarding stride consistency

8 weeks agovulkan: support buffer_from_host_ptr (llama/18467)
Jeff Bolz [Tue, 6 Jan 2026 16:37:07 +0000 (10:37 -0600)]
vulkan: support buffer_from_host_ptr (llama/18467)

* vulkan: support buffer_from_host_ptr

* hacky use of buffer_from_host_ptr for directio

* disable buffer_from_host_ptr cap

* use external memory for ggml_vk_host_malloc, revert model loader changes

* disable external_memory_host for MoltenVK

* take buffer memory types into account

* don't use external_memory_host for ggml_vk_host_malloc

8 weeks agoggml-cuda: refactor cuda graph usage (llama/18637)
Aman Gupta [Tue, 6 Jan 2026 15:48:45 +0000 (23:48 +0800)]
ggml-cuda: refactor cuda graph usage (llama/18637)

* ggml-cuda: refactor cuda graph usage

* use is_enabled() instead of enabled

8 weeks agommq.cu: tune mmq/rocblas switching for RDNA (llama/18537)
Beinsezii [Tue, 6 Jan 2026 15:26:07 +0000 (07:26 -0800)]
mmq.cu: tune mmq/rocblas switching for RDNA (llama/18537)

* Patch perf regression for mmq kernels in ROCm

recover performance regression for https://github.com/ggml-org/llama.cpp/issues/17917

* add n_experts branch like the cdna path

* mmq.cu: tune mmq/wmma switching for RDNA

* mmq.cu: move amd wmma mmq/wmma switching behind IS_RDNA3

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

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

Co-authored-by: Jiacheng (Jason) Chen <redacted>
Co-authored-by: jiachengjason <redacted>
Co-authored-by: Johannes Gäßler <redacted>
8 weeks agoggml : fix avx512bf16 build (llama/18623)
Adrien Gallouët [Tue, 6 Jan 2026 06:54:10 +0000 (07:54 +0100)]
ggml : fix avx512bf16 build (llama/18623)

- include `immintrin.h` when required
- remove unused m512bh

Signed-off-by: Adrien Gallouët <redacted>
8 weeks agoCANN: Make `valid_values` variable `static const` (llama/18627)
Raul Torres [Tue, 6 Jan 2026 03:53:28 +0000 (03:53 +0000)]
CANN: Make `valid_values` variable `static const` (llama/18627)

8 weeks agoggml webgpu: add CEIL operation support (llama/18605)
nwyin [Mon, 5 Jan 2026 19:38:57 +0000 (13:38 -0600)]
ggml webgpu: add CEIL operation support (llama/18605)

* ggml-webgpu: add CEIL operation support

      Add support for the CEIL unary operation in the WebGPU backend:
      - Add CEIL_FUNC shader template in unary_op.wgsl
      - Add 4 shader variants (f32, f16, inplace versions)
      - Initialize CEIL pipelines in ggml-webgpu.cpp
      - Register CEIL in supports_op function

* docs: update WebGPU ops support for CEIL

8 weeks agoCUDA: fix FA FP16 accumulator overflow for Granite (llama/18614)
Johannes Gäßler [Mon, 5 Jan 2026 18:51:13 +0000 (19:51 +0100)]
CUDA: fix FA FP16 accumulator overflow for Granite (llama/18614)

8 weeks agoggml-cuda: check for srcs outside the cgraph (llama/18583)
Aman Gupta [Mon, 5 Jan 2026 14:46:36 +0000 (22:46 +0800)]
ggml-cuda: check for srcs outside the cgraph (llama/18583)

* ggml-cuda: check for srcs outside the cgraph

* review: use leafs instead

8 weeks agovulkan: fix topk_moe_sigmoid_norm_bias failures in GLM-4.6 (llama/18582)
Jeff Bolz [Mon, 5 Jan 2026 10:51:39 +0000 (04:51 -0600)]
vulkan: fix topk_moe_sigmoid_norm_bias failures in GLM-4.6 (llama/18582)

8 weeks agovulkan: handle quantize_q8_1 overflowing the max workgroup count (llama/18515)
Jeff Bolz [Mon, 5 Jan 2026 10:30:14 +0000 (04:30 -0600)]
vulkan: handle quantize_q8_1 overflowing the max workgroup count (llama/18515)

* vulkan: handle quantize_q8_1 overflowing the max workgroup count

* vulkan: Fix small tile size matmul on lavapipe

* fix mul_mat_id failures

8 weeks agoCANN: add operator fusion support for ADD + RMS_NORM (llama/17512)
Chenguang Li [Mon, 5 Jan 2026 07:38:18 +0000 (15:38 +0800)]
CANN: add operator fusion support for ADD + RMS_NORM (llama/17512)

This commit implements operator fusion for ADD + RMS_NORM operations
in the CANN backend to reduce memory access overhead and improve
performance. The fusion is controlled by the GGML_CANN_OPERATOR_FUSION
environment variable (default: false).

Changes:
- Implement ggml_cann_op_add_rms_norm_fused() using ACLNN AddRmsNorm
- Add ggml_cann_can_fuse() to check fusion eligibility
- Integrate fusion logic into computation graph evaluation
- Add test cases for ADD + RMS_NORM fusion
- Update documentation with new environment variable

The fusion combines ADD and RMS_NORM into a single kernel call,
which is more efficient than executing them separately.

8 weeks agosampling : add support for backend sampling (llama/17004)
Daniel Bevenius [Sun, 4 Jan 2026 20:22:16 +0000 (21:22 +0100)]
sampling : add support for backend sampling (llama/17004)

* sampling : add support for backend sampling

This commit adds support for performing sampling operations on the
backend (e.g. GPU) as part of the model computation graph.

The motivation for this feature is to enable sampling to be performed
directly on the backend as part of the computation graph being executed,
allowing for some or all of the sampling to be done on the backend.

For example, the backend sampler chain might select/sample a token
directly in which case only the sampled token needs to be transferred
from device memory to host memory.

It is also possible for the backend samplers to perform filtering of
the logits, or compute and filter the probability distribution, in
which case only the filtered logits or probabilites need to be
transferred back to system memory for further processing by CPU
samplers.

Currently the backend sampling works in a similar manner to how
pooling works, it is a function that is called by build_graph and the
sampler operations become part of the models computation graph.

* llama-cli : add backend sampler configuration

* server : add backend sampling options/configuration

* webui : add backend sampling options

* ggml : add initial cumsum implementation for CUDA

* sampling : enable all backend sampler tests

This commit enables all exisiting backend sampler tests in the
test-backend-sampler. Previously, some tests were disabled because
there were missing ggml operation implementations.

* graph : do not include llama-model.h

* sampling : always expose sampled_ids

This commit precomputes and caches the full-vocab token id list in
llama_context's constructor, so llama_get_backend_sampled_token_ids_ith
always returns a valid pointer.

The motivation for this is that this enables both common/sampling.cpp
and src/llama-sampling.cpp can simplify their logic.

Not all backends samplers that process logits need to set the
sampled_tokens_id as they may not change the order of the logits, for
example the temperature sampler only scales the logits but does not
change their order. Simliar the logit bias sampler only adds bias to
specific token ids but does not change the order of the logits. In
these cases there will not be a device to host copy of the sampled
token ids, and this is the use case where having this precomputed
list is useful.

* sampling : ensure at most one output token per seq

This commit adds a check in the batch allocator to ensure that when
backend sampling is enabled, at most one output token is specified per
sequence.

* CUDA: Optimize argsort for gpu-based token sampling

Argsort is used for top-k currently. WE optimize argsort by 2 things:

1. Use `DeviceRadixSort` for single-row/sequence to parallelize it
   across our SMs
2. Use `DeviceSegmentedSort` for multi-row/sequence as this is the
   correct entrypoint (the function chooses different execution paths,
   it contains `DeviceSegmentedRadixSort` as one of the paths and will
   choose the best one according to heuristics.
   https://nvidia.github.io/cccl/cub/api/structcub_1_1DeviceSegmentedSort.html#overview

Some perf numbers for a RTX PRO 6000:

On the kernel level, tested with
`GGML_CUDA_DISABLE_GRAPHS=1 ./test-backend-ops -o ARGSORT perf`
Before:
```
  ARGSORT(type=f32,ne=[65000,16,1,1],order=0):                  4130 runs -   359.24 us/run
  ARGSORT(type=f32,ne=[200000,1,1,1],order=0):                  8192 runs -   861.34 us/run
  ARGSORT(type=f32,ne=[200000,16,1,1],order=0):                 1343 runs -  1020.01 us/run
```

After:
```
  ARGSORT(type=f32,ne=[65000,16,1,1],order=0):                  4130 runs -   312.41 us/run
  ARGSORT(type=f32,ne=[200000,1,1,1],order=0):                 16384 runs -    63.48 us/run
  ARGSORT(type=f32,ne=[200000,16,1,1],order=0):                 1343 runs -   874.36 us/run
```

8 weeks agoCUDA: disable cuda graph when using n-cpu-moe (llama/18593)
Aman Gupta [Sun, 4 Jan 2026 17:37:48 +0000 (01:37 +0800)]
CUDA: disable cuda graph when using n-cpu-moe (llama/18593)

* CUDA: disable cuda graph when using n-cpu-moe

* call ggml_cuda_set_device

8 weeks agoggml-cuda: remove unused params in ggml_cuda_graph (llama/18579)
Aman Gupta [Sun, 4 Jan 2026 17:37:09 +0000 (01:37 +0800)]
ggml-cuda: remove unused params in ggml_cuda_graph (llama/18579)