]> git.djapps.eu Git - pkg/ggml/sources/ggml/log
pkg/ggml/sources/ggml
11 days agoMerge tag 'upstream/0.9.1' into debian/latest
Mathieu Baudier [Mon, 22 Sep 2025 12:16:30 +0000 (14:16 +0200)]
Merge tag 'upstream/0.9.1' into debian/latest

Upstream release

13 days agoggml : bump version to 0.9.1 upstream/0.9.1 v0.9.1
Georgi Gerganov [Sat, 20 Sep 2025 13:44:23 +0000 (16:44 +0300)]
ggml : bump version to 0.9.1

13 days agoscripts : fix sed usage to work on Mac (#1345)
Georgi Gerganov [Sat, 20 Sep 2025 13:44:08 +0000 (16:44 +0300)]
scripts : fix sed usage to work on Mac (#1345)

13 days agotests : adjust to new timestep_embedding operator
Georgi Gerganov [Sat, 20 Sep 2025 10:16:10 +0000 (13:16 +0300)]
tests : adjust to new timestep_embedding operator

13 days agosync : llama.cpp
Georgi Gerganov [Sat, 20 Sep 2025 10:09:41 +0000 (13:09 +0300)]
sync : llama.cpp

13 days agovulkan: use vec dot for matrix matrix multiplications (llama/16056)
Ruben Ortlam [Sat, 20 Sep 2025 08:42:56 +0000 (10:42 +0200)]
vulkan: use vec dot for matrix matrix multiplications (llama/16056)

* vulkan: Change the mul_mm shared memory and register caching system to use vec2 instead of scalars, to enable using dot2 instructions

* use fma instead of dot to fix Nvidia and Apple performance issues

13 days agoggml : refactor forward_dup for cpu backend (llama/16062)
Xuan-Son Nguyen [Fri, 19 Sep 2025 04:31:56 +0000 (11:31 +0700)]
ggml : refactor forward_dup for cpu backend (llama/16062)

* ggml : refactor forward_dup for cpu backend

* clean up a bit

* add quant/dequant perf test

13 days agoggml-amx : fix ggml_amx_init() on generic Linux (llama/16049)
Adrien Gallouët [Thu, 18 Sep 2025 21:07:26 +0000 (23:07 +0200)]
ggml-amx : fix ggml_amx_init() on generic Linux (llama/16049)

Generalize Linux check to `__linux__` to support non-glibc systems (like musl).
Also, return `false` on unknown/untested OS.

Without this commit, the code compiles (with warnings) but fails:

    register_backend: registered backend CPU (1 devices)
    register_device: registered device CPU (Intel(R) Xeon(R) Platinum 8488C)
    build: 6487 (51c4cac6) with x86_64-linux-musl-gcc (GCC) 15.1.0 for x86_64-linux-musl (debug)
    system info: n_threads = 8, n_threads_batch = 8, total_threads = 16
    ....
    print_info: n_ctx_orig_yarn  = 262144
    print_info: rope_finetuned   = unknown
    print_info: model type       = 4B
    Illegal instruction (core dumped)

Signed-off-by: Adrien Gallouët <redacted>
13 days agocmake : fix static linking for OpenMP on Unix-like systems (llama/16031)
Adrien Gallouët [Thu, 18 Sep 2025 21:07:18 +0000 (23:07 +0200)]
cmake : fix static linking for OpenMP on Unix-like systems (llama/16031)

When compiling with GGML_STATIC=ON, the build process would produce a
binary that was still dynamically linked to OpenMP. This defeats the
purpose of a static build:

    $ cmake -B build \
            -DBUILD_SHARED_LIBS=OFF \
            -DLLAMA_CURL=OFF \
            -DGGML_CCACHE=OFF \
            -DGGML_NATIVE=OFF \
            -DGGML_STATIC=ON

    $ ldd llama-server
            linux-vdso.so.1 (0x0000e1a434e3b000)
            libgomp.so.1 => /lib/aarch64-linux-gnu/libgomp.so.1 (0x0000e1a4345a0000)
            libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000e1a434300000)
            libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000e1a434240000)
            libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000e1a434200000)
            libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000e1a434030000)
            /lib/ld-linux-aarch64.so.1 (0x0000e1a434df0000)

This commit resolves the issue by modifying `CMAKE_FIND_LIBRARY_SUFFIXES`
to prioritize `.a` files, forcing CMake to link the static version of
the library.

Signed-off-by: Adrien Gallouët <redacted>
13 days agoopencl: optimize mxfp4 kernels (llama/16037)
Shawn Gu [Thu, 18 Sep 2025 19:03:34 +0000 (12:03 -0700)]
opencl: optimize mxfp4 kernels (llama/16037)

- flatten mxfp4 and packed fp4->fp16 bit-wise convert function (replace lut)
- MoE kernel optimizations

---------

Co-authored-by: Li He <redacted>
13 days agorename optimize_graph to graph_optimize (llama/16082)
Jeff Bolz [Thu, 18 Sep 2025 18:46:17 +0000 (13:46 -0500)]
rename optimize_graph to graph_optimize (llama/16082)

13 days agoCUDA: Optimize PAD_REFLECT_1D (llama/15957)
Bowen Han [Thu, 18 Sep 2025 18:26:03 +0000 (11:26 -0700)]
CUDA: Optimize PAD_REFLECT_1D (llama/15957)

* CUDA: Optimize PAD_REFLECT_1D
feat: add more test cases for PAD_REFLECT_1D

* use fast_div to improve performance

* Apply suggestion from JohannesGaessler

Co-authored-by: Johannes Gäßler <redacted>
* Apply suggestion from JohannesGaessler

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

* use a concise expression to further speedup the cuda kernel

---------

Co-authored-by: Johannes Gäßler <redacted>
13 days agoCUDA: fix compilation on CC 6.0 (llama/16091)
Johannes Gäßler [Thu, 18 Sep 2025 17:28:32 +0000 (19:28 +0200)]
CUDA: fix compilation on CC 6.0 (llama/16091)

13 days agometal : use function constants for mul_mv_ext kernels (llama/16074)
Georgi Gerganov [Thu, 18 Sep 2025 13:28:41 +0000 (16:28 +0300)]
metal : use function constants for mul_mv_ext kernels (llama/16074)

* metal : use function constants for mul_mv_ext kernels

ggml-ci

* metal : remove NW template argument

ggml-ci

* metal : adjust constants

ggml-ci

13 days agocuda : add missing F32<->I32 entries in ggml_cuda_cpy_fn (llama/16060)
Sigbjørn Skjæret [Thu, 18 Sep 2025 11:28:22 +0000 (13:28 +0200)]
cuda : add missing F32<->I32 entries in ggml_cuda_cpy_fn (llama/16060)

13 days agometal : improve F32, F16 and BF16 mat-vec multiplication (llama/16057)
Georgi Gerganov [Thu, 18 Sep 2025 09:33:45 +0000 (12:33 +0300)]
metal : improve F32, F16 and BF16 mat-vec multiplication (llama/16057)

* metal : improve F32, F16 and BF16 mat-vec multiplication

ggml-ci

* metal : make the NSG a function constant in mul_mv kernels

ggml-ci

13 days agometal : avoid call free for non-owned buffer (llama/16067)
Jhen-Jie Hong [Thu, 18 Sep 2025 07:06:48 +0000 (15:06 +0800)]
metal : avoid call free for non-owned buffer (llama/16067)

13 days agometal : handle nil cv during pipeline creation (llama/16065)
Georgi Gerganov [Thu, 18 Sep 2025 07:03:24 +0000 (10:03 +0300)]
metal : handle nil cv during pipeline creation (llama/16065)

ggml-ci

13 days agoCANN: Remove print (llama/16044)
Chenguang Li [Thu, 18 Sep 2025 01:26:33 +0000 (09:26 +0800)]
CANN: Remove print (llama/16044)

Signed-off-by: noemotiovon <redacted>
13 days agoGGML WebGPU: Support for ADD, MUL, RMS_NORM, GET_ROWS operators (llama/16018)
Reese Levine [Wed, 17 Sep 2025 20:09:40 +0000 (13:09 -0700)]
GGML WebGPU: Support for ADD, MUL, RMS_NORM, GET_ROWS operators (llama/16018)

* Add paramater buffer pool, batching of submissions, refactor command building/submission

* Add header for linux builds

* Free staged parameter buffers at once

* Format with clang-format

* Fix thread-safe implementation

* Use device implicit synchronization

* Update workflow to use custom release

* Remove testing branch workflow

* some f32 tests passing

* Disable set_rows until it's implemented

* f32 add all tests passing

* Begin work on set_rows

* Work on set rows

* Add error buffers for reporting unsupported SET_ROWS indices

* Remove extra comments

* Add templated addition, clean up code

* Get addition and multiplication working

* Implement rms_norm

* Add get_rows implementation

* Add new get_rows files

* Refactor use of wg size entry

* Fix compilation

* Try manually unrolled q4_0 quant

* Revert "Try manually unrolled q4_0 quant"

This reverts commit 77f8b96515f7e640ae4b0e44f066321fbc4a6166.

* Move to constant max wg size

* Check for tensor size in supports_op

* Vectorize f32 and change default workgroup size

* Move f32 get_rows from < 4 to % 4 != 0

* fix linter errors

* Add in-place tests

---------

Co-authored-by: Neha Abbas <redacted>
13 days agometal : refactor + optimize v2 (llama/15995)
Georgi Gerganov [Sat, 20 Sep 2025 10:09:06 +0000 (13:09 +0300)]
metal : refactor + optimize v2 (llama/15995)

13 days agosync : llama.cpp
Georgi Gerganov [Sat, 20 Sep 2025 10:07:59 +0000 (13:07 +0300)]
sync : llama.cpp

13 days agoCUDA: fix FA occupancy, optimize tile kernel (llama/15982)
Johannes Gäßler [Wed, 17 Sep 2025 13:32:42 +0000 (15:32 +0200)]
CUDA: fix FA occupancy, optimize tile kernel (llama/15982)

13 days agovulkan: automatically remove unsupported devices (llama/15976)
Eve [Wed, 17 Sep 2025 07:35:37 +0000 (07:35 +0000)]
vulkan: automatically remove unsupported devices (llama/15976)

* remove unsupported vulkan devices

* make this happen during selection instead

* pass by reference

13 days agoCANN: Optimize ggml_cann_set_device (llama/15935)
Chenguang Li [Wed, 17 Sep 2025 06:33:08 +0000 (14:33 +0800)]
CANN: Optimize ggml_cann_set_device (llama/15935)

* CANN: Fix ggml_cann_set_device to avoid redundant device switches

- Added a check to skip aclrtSetDevice if the current device is already set.
- Prevents unnecessary context switches while keeping thread/device consistency.

* CANN: add device default id

13 days agoggml : fix padding in timestep embedding kernels (llama/15932)
Daniel Bevenius [Tue, 16 Sep 2025 13:25:57 +0000 (15:25 +0200)]
ggml : fix padding in timestep embedding kernels (llama/15932)

* ggml : remove adding extra dim timestep embedding

This commit updates the ggml_timestep_embedding function to no longer
add an extra dimension when the specified dimension is odd.

The motivation for this change is that this introduces an unnecessary
dimension when the dimension is odd, which caused an issue in the
kernels which were not expecting this extra dimension and it resulted in
uninitialized memory for the second to last dimension.

* ggml-cuda : fix padding in timestep embedding kernel

This commit removes the zeroing out of the last dimension now that we
are not adding the extra padding dimension.

* ggml-metal : fix padding in timestep embedding kernel

This commit fixes the zero padding for odd dimensions in
the timestep embedding kernel

* ggml-opencl : fix padding in timestep embedding kernel

This commit fixes the zero padding for odd dimensions in
the timestep embedding kernel.

* ggml-sycl : fix padding in timestep embedding kernel

This commit fixes the zero padding for odd dimensions in
the timestep embedding kernel.

* ggml-vulkan : fix padding in timestep embedding kernel

This commit fixes the zero padding for odd dimensions in
the timestep embedding kernel.

* ggml-cpu : fix padding in timestep embedding function

This commit removes the zeroing out of the last dimension now that we
are not adding the extra padding dimension.

13 days agoCUDA: fix im2col_3d to respect non-contiguous inputs (views) (llama/15956)
Jake Karnes [Mon, 15 Sep 2025 22:28:31 +0000 (16:28 -0600)]
CUDA: fix im2col_3d to respect non-contiguous inputs (views) (llama/15956)

* fix im2col_3d to respect non-contiguous inputs (views)

The CUDA 3D im2col kernel computed source addresses assuming compact layout (products of dims), ignoring nb[] strides.

This patch switches im2col_3d source indexing to use true strides derived from src1->nb[] (in elements), mirroring the approach used in the 2D CUDA im2col path. Destination indexing is unchanged.

* use ggml_element_size() for src strides

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

Co-authored-by: Johannes Gäßler <redacted>
13 days agoSYCL: Add COUNT_EQUAL operator support (llama/15991)
yael-works [Mon, 15 Sep 2025 16:51:35 +0000 (19:51 +0300)]
SYCL: Add COUNT_EQUAL operator support (llama/15991)

* SYCL: Add COUNT_EQUAL operator support (rebased on master)

* SYCL: remove duplicate op_count_equal definition

* tests: remove test_count_equal_typed and use test_count_equal for all cases

* tests: keep only I32 case for COUNT_EQUAL as suggested

* tests: keep only I32 case for COUNT_EQUAL as requested

13 days agoCUDA: some micro-optimizations in mmf.cuh for mul_mat_id (llama/15926)
Aman Gupta [Mon, 15 Sep 2025 09:35:11 +0000 (17:35 +0800)]
CUDA: some micro-optimizations in mmf.cuh for mul_mat_id (llama/15926)

13 days agometal : remove memory pools (llama/15966)
Georgi Gerganov [Sun, 14 Sep 2025 19:02:32 +0000 (22:02 +0300)]
metal : remove memory pools (llama/15966)

* metal : remove mem pool usage

ggml-ci

* metal : remove mem pool implementation

ggml-ci

* metal : take into account the actual allocated memory of the tensor

ggml-ci

* cont : use ggml_backend_buft_get_alloc_size

ggml-ci

* cont : improve, comments

ggml-ci

* cont : add functions for the extra tensor sizes

* metal : add comments

ggml-ci

* metal : implement .get_alloc_size for the rest of the buffer types

ggml-ci

* metal : remove ggml_metal_heap

ggml-ci

13 days agoVulkan: Clean up mul_mm shader (llama/15987)
Ruben Ortlam [Sun, 14 Sep 2025 14:56:28 +0000 (16:56 +0200)]
Vulkan: Clean up mul_mm shader (llama/15987)

* vulkan: move mul_mm dequantization steps into a separate file and functions

* improve mul_mm vector load code

* fix debug mode issues and warnings

13 days agometal : fix kernel requirements (llama/15983)
Georgi Gerganov [Sun, 14 Sep 2025 12:33:22 +0000 (15:33 +0300)]
metal : fix kernel requirements (llama/15983)

* metal : fix kernel requirements

ggml-ci

* cont : fix supports_op

* cont : fix supports_op for ARGMAX

13 days agoggml-zdnn: rm user mapped buffers (llama/15965)
Aaron Teo [Sun, 14 Sep 2025 05:37:03 +0000 (13:37 +0800)]
ggml-zdnn: rm user mapped buffers (llama/15965)

* ggml-zdnn: rm user mapped buffers

Signed-off-by: Aaron Teo <redacted>
* ggml-zdnn: rm dead code

Signed-off-by: Aaron Teo <redacted>
* ggml-zdnn: attempt to fix missing extra data buffer free

Signed-off-by: Aaron Teo <redacted>
---------

Signed-off-by: Aaron Teo <redacted>
13 days agovulkan: fix failing dequant shaders (llama/15862)
Jeff Bolz [Sat, 13 Sep 2025 15:29:43 +0000 (16:29 +0100)]
vulkan: fix failing dequant shaders (llama/15862)

* vulkan: fix failing dequant shaders

* add missing const

13 days agovulkan: initialize vulkan-hpp to allow using extension function pointers (llama/15705)
Jeff Bolz [Sat, 13 Sep 2025 15:23:30 +0000 (16:23 +0100)]
vulkan: initialize vulkan-hpp to allow using extension function pointers (llama/15705)

Use this to query register count for shader compiles on NVIDIA. Currently
this is only for performance debug, but it could eventually be used in some
heuristics like split_k.

13 days agometal : refactor kernel loading (llama/15964)
Georgi Gerganov [Sat, 13 Sep 2025 13:24:22 +0000 (16:24 +0300)]
metal : refactor kernel loading (llama/15964)

* metal : refactor bin kernels loading

ggml-ci

* metal : refactor rms kernel loading

ggml-ci

* ci : try to add memory leaks check

ggml-ci

* ci : try to enable memory leak detection for Mac

* cont : seems to be working

13 days agometal : allow ops to run concurrently (llama/15929)
Georgi Gerganov [Sat, 13 Sep 2025 10:54:28 +0000 (13:54 +0300)]
metal : allow ops to run concurrently (llama/15929)

* metal : run graphs ops concurrently

ggml-ci

* cont : add flags for debugging and disabling concurrency

ggml-ci

* cont : refactor and handle fusing

ggml-ci

* cont : simplify - no need to use GPU address

ggml-ci

* cont : prepare mem ranges for reuse + add ggml-metal-common.cpp

ggml-ci

* cont : avoid redundant keywords in cpp [no ci]

* metal : reorder graph for better concurrency

ggml-ci

* metal : fix race on mem pool buffers

ggml-ci

* cont : add env GGML_METAL_GRAPH_OPTIMIZE_DISABLE

ggml-ci

* cont : refactor, optimize, add comments

ggml-ci

* cont : refactor ggml-metal.m

ggml-ci

* minor : update logs [no ci]

13 days agometal : fix memory leaks (llama/15962)
Georgi Gerganov [Sat, 13 Sep 2025 09:45:04 +0000 (12:45 +0300)]
metal : fix memory leaks (llama/15962)

ggml-ci

13 days agoggml-zdnn: fix #15414, activate FP16 and BF16 acceleration and incorrect zTensor...
Aaron Teo [Fri, 12 Sep 2025 18:39:52 +0000 (02:39 +0800)]
ggml-zdnn: fix #15414, activate FP16 and BF16 acceleration and incorrect zTensor free (llama/15839)

13 days agoVulkan iGPU device selection overhaul and PCI ID API support (llama/15947)
Ruben Ortlam [Fri, 12 Sep 2025 11:24:21 +0000 (13:24 +0200)]
Vulkan iGPU device selection overhaul and PCI ID API support (llama/15947)

* vulkan: implement ggml igpu device type, implement pci id support

* fix compiler warning

* prevent printf overflow warning

13 days agovulkan: Make device memory check more portable (llama/15939)
Mathieu Baudier [Fri, 12 Sep 2025 07:06:20 +0000 (09:06 +0200)]
vulkan: Make device memory check more portable (llama/15939)

13 days agoRevert "sycl: add usage of enqueue_functions extension (llama/14244)" (llama/15910)
Neo Zhang Jianyu [Fri, 12 Sep 2025 01:15:12 +0000 (09:15 +0800)]
Revert "sycl: add usage of enqueue_functions extension (llama/14244)" (llama/15910)

* Revert "sycl: add usage of enqueue_functions extension (#14244)"

This reverts commit 8308f98c7fb778e54bf75538f5234d8bd20915e9.

* fix missed revert code, format the code

13 days agoggml-backend : add GGML_BACKEND_DEVICE_TYPE_IGPU device type (llama/15797)
Diego Devesa [Thu, 11 Sep 2025 20:47:38 +0000 (13:47 -0700)]
ggml-backend : add GGML_BACKEND_DEVICE_TYPE_IGPU device type (llama/15797)

* ggml-backend : add GGML_BACKEND_DEVICE_TYPE_IGPU device type

ggml-backend : add device id to device props

llama : only use iGPU devices if there are no GPU devices

llama : do not use multiple devices from different backends with the same device id

13 days agoCUDA: larger SRAM reads for tile FA, AMD FP16 dot (llama/15927)
Johannes Gäßler [Thu, 11 Sep 2025 19:19:58 +0000 (21:19 +0200)]
CUDA: larger SRAM reads for tile FA, AMD FP16 dot (llama/15927)

* CUDA: larger SRAM reads for tile FA, AMD FP16 dot

* fix logic for availability of v_dot2_f32_f16

13 days agoggml-cpu : add check for ARM MATMUL_INT8/i8mm support (llama/15922)
Daniel Bevenius [Thu, 11 Sep 2025 13:39:12 +0000 (15:39 +0200)]
ggml-cpu : add check for ARM MATMUL_INT8/i8mm support (llama/15922)

This commit adds a check for GGML_MACHINE_SUPPORTS_i8mm when enabling
MATMUL_INT8 features, ensuring that i8mm intrinsics are only used when
the target hardware actually supports them.

The motivation for this is to fix ggml CI build failures where the
feature detection correctly identifies that i8mm is not supported,
adding the +noi8mm flag, but MATMUL_INT8 preprocessor definitions are
still enabled, causing the compiler to attempt to use vmmlaq_s32
intrinsics without i8mm support.

Refs: https://github.com/ggml-org/ggml/actions/runs/17525174120/job/49909199499

13 days agokleidiai: fix GGML_ASSERT(*cur_backend_id != -1) failed (llama/15614)
Charles Xu [Thu, 11 Sep 2025 10:45:40 +0000 (12:45 +0200)]
kleidiai: fix GGML_ASSERT(*cur_backend_id != -1) failed (llama/15614)

* kleidiai: fix GGML_ASSERT(*cur_backend_id != -1) failed

* removes the Whisper-specific check for GET_ROWS support

13 days agoCANN: Disable acl_graph for prefill stage (llama/15933)
hipudding [Thu, 11 Sep 2025 07:59:37 +0000 (15:59 +0800)]
CANN: Disable acl_graph for prefill stage (llama/15933)

Since the prefill length is not fixed, graphs constructed for the
prefill stage cannot be reused. For this reason, ACL graph
execution is disabled by default during prefill.

13 days agoCUDA: Add `fastdiv` to `k_bin_bcast*`, giving 1-3% E2E performance (llama/15872)
Oliver Simons [Wed, 10 Sep 2025 20:04:03 +0000 (22:04 +0200)]
CUDA: Add `fastdiv` to `k_bin_bcast*`, giving 1-3% E2E performance (llama/15872)

* Add fastdiv and fastmodulo to k_bin_bcast kernel

* Address review comments

* `prod_` instead of `prod` suffix

* Add test case for `k_bin_bcast_unravel` in CUDA backend

13 days agoggml-cpu : fix padding in ggml_timestep_embedding (llama/15917)
Daniel Bevenius [Wed, 10 Sep 2025 15:31:40 +0000 (17:31 +0200)]
ggml-cpu : fix padding in ggml_timestep_embedding (llama/15917)

This commit fixes the zero padding for odd dimensions in
ggml_compute_forward_timestep_embedding_f32.
The motivation for this is that currently if an odd dimension is used,
the padding check incorrectly uses the dimension value for indexing.
For example, with dim=15:

Elements 0-6 are set to cosine values
Elements 7-13 are set to sine values
Element 14 is left uninitialized (contains garbage)
Element 15 is correctly set to zero

This fix changes embed_data[dim] to embed_data[2 * half] so that
element 14 (the first unused element) is properly set to zero as well
as the last element.

Resolves: https://github.com/ggml-org/ggml/issues/1324

13 days agosync : llama.cpp
Georgi Gerganov [Sat, 20 Sep 2025 10:07:06 +0000 (13:07 +0300)]
sync : llama.cpp

13 days agometal : make the backend async (llama/15906)
Georgi Gerganov [Sat, 20 Sep 2025 10:06:32 +0000 (13:06 +0300)]
metal : make the backend async (llama/15906)

13 days agosync : llama.cpp
Georgi Gerganov [Sat, 20 Sep 2025 10:06:06 +0000 (13:06 +0300)]
sync : llama.cpp

13 days agotests : filter out no-ops from coverage report (llama/15900)
Daniel Bevenius [Wed, 10 Sep 2025 12:17:09 +0000 (14:17 +0200)]
tests : filter out no-ops from coverage report (llama/15900)

* tests : filter out no-ops from coverage report

This commit is a follow-up commit for #15745 to address the feedback on
how no-op operations should be filtered out from the coverage report.

The feedback regarding the UNARY and GLU sub-operations not being
handled I not exactly sure what should be done. They are included in the
coverage, for example ABS, ELU, EXP, GELU, GEGLU, GEGLU_ERF etc are in
the list of covered operations:
```console
$ ./build/bin/test-backend-ops --show-coverage
Operations covered by tests (89):
  ✓ ABS
  ✓ ACC
  ✓ ADD
  ✓ ADD1
  ✓ ADD_ID
  ✓ ARANGE
  ✓ ARGMAX
  ✓ ARGSORT
  ✓ CLAMP
  ✓ CONCAT
  ✓ CONV_2D
  ✓ CONV_2D_DW
  ✓ CONV_3D
  ✓ CONV_TRANSPOSE_1D
  ✓ CONV_TRANSPOSE_2D
  ✓ COS
  ✓ COUNT_EQUAL
  ✓ CPY
  ✓ CROSS_ENTROPY_LOSS
  ✓ CROSS_ENTROPY_LOSS_BACK
  ✓ DIAG_MASK_INF
  ✓ DIV
  ✓ DUP
  ✓ ELU
  ✓ EXP
  ✓ FLASH_ATTN_EXT
  ✓ GATED_LINEAR_ATTN
  ✓ GEGLU
  ✓ GEGLU_ERF
  ✓ GEGLU_QUICK
  ✓ GELU
  ✓ GELU_ERF
  ✓ GELU_QUICK
  ✓ GET_ROWS
  ✓ GET_ROWS_BACK
  ✓ GROUP_NORM
  ✓ HARDSIGMOID
  ✓ HARDSWISH
  ✓ IM2COL
  ✓ IM2COL_3D
  ✓ L2_NORM
  ✓ LEAKY_RELU
  ✓ LOG
  ✓ MEAN
  ✓ MUL
  ✓ MUL_MAT
  ✓ MUL_MAT_ID
  ✓ NEG
  ✓ NORM
  ✓ OPT_STEP_ADAMW
  ✓ OPT_STEP_SGD
  ✓ OUT_PROD
  ✓ PAD
  ✓ PAD_REFLECT_1D
  ✓ POOL_2D
  ✓ REGLU
  ✓ RELU
  ✓ REPEAT
  ✓ REPEAT_BACK
  ✓ RMS_NORM
  ✓ RMS_NORM_BACK
  ✓ ROLL
  ✓ ROPE
  ✓ ROPE_BACK
  ✓ RWKV_WKV6
  ✓ RWKV_WKV7
  ✓ SCALE
  ✓ SET
  ✓ SET_ROWS
  ✓ SGN
  ✓ SIGMOID
  ✓ SILU
  ✓ SILU_BACK
  ✓ SIN
  ✓ SOFT_MAX
  ✓ SOFT_MAX_BACK
  ✓ SQR
  ✓ SQRT
  ✓ SSM_CONV
  ✓ SSM_SCAN
  ✓ STEP
  ✓ SUB
  ✓ SUM
  ✓ SUM_ROWS
  ✓ SWIGLU
  ✓ SWIGLU_OAI
  ✓ TANH
  ✓ TIMESTEP_EMBEDDING
  ✓ UPSCALE

Operations without tests (14):
  ✗ ADD_REL_POS
  ✗ CUSTOM
  ✗ DIAG
  ✗ DIAG_MASK_ZERO
  ✗ FLASH_ATTN_BACK
  ✗ GET_REL_POS
  ✗ IM2COL_BACK
  ✗ MAP_CUSTOM1
  ✗ MAP_CUSTOM2
  ✗ MAP_CUSTOM3
  ✗ POOL_1D
  ✗ POOL_2D_BACK
  ✗ WIN_PART
  ✗ WIN_UNPART

Coverage Summary:
  Total operations: 103
  Tested operations: 89
  Untested operations: 14
  Coverage: 86.4%
```

Refs: https://github.com/ggml-org/llama.cpp/pull/15745

* use of ggml_op enum values instead of strcmp

13 days agoCANN: Add ROPE sin/cos cache for reuse (llama/15912)
Chenguang Li [Wed, 10 Sep 2025 10:42:00 +0000 (18:42 +0800)]
CANN: Add ROPE sin/cos cache for reuse (llama/15912)

* CANN: Add ROPE sin/cos cache for reuse

Introduce sin/cos caching mechanism in ROPE to avoid redundant
computation across layers. The cache is built on the first layer
per device and reused by subsequent layers if parameters match.

- Added sin_cache / cos_cache pointers and position_length tracking
- Introduced cache validity flags and properties:
  (ext_factor, theta_scale, freq_scale, attn_factor, is_neox)
- Accelerates ROPE by eliminating repeated sin/cos generation

This change reduces overhead in multi-layer scenarios while
preserving correctness by verifying parameter consistency.

Co-authored-by: hipudding <redacted>
* fix typo

Signed-off-by: noemotiovon <redacted>
---------

Signed-off-by: noemotiovon <redacted>
Co-authored-by: hipudding <redacted>
13 days agoCANN: implement LRU cache for ACL graphs (llama/15814)
Chenguang Li [Wed, 10 Sep 2025 07:29:12 +0000 (15:29 +0800)]
CANN: implement LRU cache for ACL graphs (llama/15814)

* CANN: implement LRU cache for ACL graphs in CANN backend

- Introduce ggml_cann_graph_lru_cache to store multiple ggml_cann_graph objects.
- Graphs are loaded on demand and evicted using LRU policy when capacity is exceeded.
- Updated push, move_to_front, and clear methods to manage cached graphs efficiently.
- Ensures reuse of graphs, reducing graph reconstruction overhead in CANN backend.

* fix typo

* The LRU cache capacity can be configured via an env variable

Signed-off-by: noemotiovon <redacted>
* refactory acl graph

* refactory && fix review comments

Signed-off-by: noemotiovon <redacted>
---------

Signed-off-by: noemotiovon <redacted>
13 days agovulkan: throw the oom error instead of no memory type found (llama/15905)
Ruben Ortlam [Tue, 9 Sep 2025 20:26:03 +0000 (22:26 +0200)]
vulkan: throw the oom error instead of no memory type found (llama/15905)

13 days agovulkan: Fix OOB accesses in soft_max_back (llama/15861)
Jeff Bolz [Tue, 9 Sep 2025 12:41:15 +0000 (07:41 -0500)]
vulkan: Fix OOB accesses in soft_max_back (llama/15861)

13 days agoHIP: use v_dot2_f32_f16 instruction for FA (llama/15884)
Johannes Gäßler [Tue, 9 Sep 2025 12:04:43 +0000 (14:04 +0200)]
HIP: use v_dot2_f32_f16 instruction for FA (llama/15884)

13 days agoWorkaround for subgroup arithmetic failing on MoltenVK with AMD GPUs (issue 15846...
lksj92hs [Tue, 9 Sep 2025 12:01:15 +0000 (15:01 +0300)]
Workaround for subgroup arithmetic failing on MoltenVK with AMD GPUs (issue 15846) (llama/15886)

13 days agoCUDA: Add mul_mat_id support for the mmf kernel (llama/15767)
Aman Gupta [Tue, 9 Sep 2025 06:38:02 +0000 (14:38 +0800)]
CUDA: Add mul_mat_id support for the mmf kernel (llama/15767)

* CUDA: Add mul_mat_id support the mmf

Add support for mul_mat_id for bs < 16

* Review: use warp_size, fix should_use_mmf condition

* Launch one block per expert, stride along n_expert_used

* templatize mul_mat_id

* Pad shmem to 16 bytes, add helper function mul_mat_f_switch_ids

* Reduce compile times by dividing mmf into f16, bf16 and f32 variants

* Divide mmf by ncols_dst

* Add missing files

* Fix MUSA/HIP builds

13 days agoCUDA: fix GET_ROWS for large tensors (llama/15882)
Johannes Gäßler [Tue, 9 Sep 2025 06:11:01 +0000 (08:11 +0200)]
CUDA: fix GET_ROWS for large tensors (llama/15882)

13 days agovulkan: sort graph to allow more parallel execution (llama/15850)
Jeff Bolz [Mon, 8 Sep 2025 18:10:07 +0000 (13:10 -0500)]
vulkan: sort graph to allow more parallel execution (llama/15850)

* vulkan: sort graph to allow more parallel execution

Add a backend proc to allow the backend to modify the graph. The
vulkan implementation looks at which nodes depend on each other
and greedily reorders them to group together nodes that don't
depend on each other. It only reorders the nodes, doesn't change
the contents of any of them.

With #15489, this reduces the number of synchronizations needed.

* call optimize_graph per-split

13 days agoCUDA: generate_cu_files.py - add missing mxfp4 (llama/15880)
Aman Gupta [Mon, 8 Sep 2025 17:23:46 +0000 (01:23 +0800)]
CUDA: generate_cu_files.py - add missing mxfp4 (llama/15880)

13 days agocuda : fix supports_op condition for get_rows when number of blocks is too large...
Georgi Gerganov [Mon, 8 Sep 2025 10:56:51 +0000 (13:56 +0300)]
cuda : fix supports_op condition for get_rows when number of blocks is too large (llama/15868)

* cuda : fix supports_op condition for get_rows when src1->ne2 > 1

ggml-ci

* ggml : add comment about ggml_get_rows

ggml-ci

* cuda : add FIXME [no ci]

* cuda : update support condition

ggml-ci

13 days agosync : llama.cpp
Georgi Gerganov [Sat, 20 Sep 2025 10:05:13 +0000 (13:05 +0300)]
sync : llama.cpp

13 days agometal : refactor + optimize (llama/15857)
Georgi Gerganov [Sat, 20 Sep 2025 10:04:02 +0000 (13:04 +0300)]
metal : refactor + optimize (llama/15857)

13 days agosync : llama.cpp
Georgi Gerganov [Sat, 20 Sep 2025 10:03:07 +0000 (13:03 +0300)]
sync : llama.cpp

13 days agoggml: allow casting between f32 and i32 (llama/15783)
Xuan-Son Nguyen [Mon, 8 Sep 2025 10:33:01 +0000 (17:33 +0700)]
ggml: allow casting between f32 and i32 (llama/15783)

* ggml: allow casting between f32 and i32

* fix cuda

* add vulkan

* fix CPU non-cont

* add non-cont test case

* add note

* extend test number range

* correct note

* add cont version for vulkan

13 days agoCUDA: non-contiguous src0 not supported for PAD (llama/15869)
Sigbjørn Skjæret [Mon, 8 Sep 2025 09:55:44 +0000 (11:55 +0200)]
CUDA: non-contiguous src0 not supported for PAD (llama/15869)

13 days agotests: large sizes for get_rows (llama/15687)
Jeff Bolz [Mon, 8 Sep 2025 04:23:41 +0000 (23:23 -0500)]
tests: large sizes for get_rows (llama/15687)

13 days agoCANN: Stream sync between devices for acl_graph (llama/15809)
Chenguang Li [Mon, 8 Sep 2025 02:03:29 +0000 (10:03 +0800)]
CANN: Stream sync between devices for acl_graph (llama/15809)

* CANN: Switch to stream synchronization

Switch to stream synchronization because events are not effective.

Co-authored-by: hipudding <redacted>
* CANN: add Comments

---------

Co-authored-by: hipudding <redacted>
13 days agovulkan: support im2col_3d (llama/15795)
Jeff Bolz [Sun, 7 Sep 2025 18:50:26 +0000 (13:50 -0500)]
vulkan: support im2col_3d (llama/15795)

13 days agoggml-cpu: clean up s390x SIMD (llama/15855)
Aaron Teo [Sun, 7 Sep 2025 18:18:28 +0000 (02:18 +0800)]
ggml-cpu: clean up s390x SIMD (llama/15855)

* ggml-cpu: clean up s390x simd

Signed-off-by: Aaron Teo <redacted>
(cherry picked from commit 0da4b6aa07d96b758812d17b2c82267632fa4ba5)
Signed-off-by: Aaron Teo <redacted>
* ggml-cpu: fix hsum data types

Signed-off-by: Aaron Teo <redacted>
---------

Signed-off-by: Aaron Teo <redacted>
13 days agovulkan: Support pad_ext (llama/15794)
Jeff Bolz [Sun, 7 Sep 2025 17:00:49 +0000 (12:00 -0500)]
vulkan: Support pad_ext (llama/15794)

13 days agovulkan: Use larger loads in scalar/coopmat1 matmul (llama/15729)
Jeff Bolz [Sun, 7 Sep 2025 16:53:07 +0000 (11:53 -0500)]
vulkan: Use larger loads in scalar/coopmat1 matmul (llama/15729)

I think glslang will translate an access like x[i][1].z to
OpAccessChain ... x, i, 1, 2
OpLoad float16_t ...

rather than loading all of x[i] in a single OpLoad. Change the
code to explicitly load the vector/matrix.

13 days agoggml WebGPU: remove userdata from request adapter callback (llama/15527)
Daniel Bevenius [Sun, 7 Sep 2025 08:19:45 +0000 (10:19 +0200)]
ggml WebGPU: remove userdata from request adapter callback (llama/15527)

* ggml WebGPU: remove userdata from request adapter callback

This commit removes the `userdata` parameter from the WebGPU request
adapter callback in `ggml-webgpu.cpp`. Instead, the lambda function
captures the `webgpu_context` directly.

The motivation for this change is to simplify the code and improve
readability.

* inline the callback lambda into the RequestAdapter call

This commit removes the callback lambda variable and inlines it directly
into the RequestAdapter call.

13 days agoCUDA: faster tile FA (Pascal/AMD), headsize 256 (llama/15769)
Johannes Gäßler [Sat, 6 Sep 2025 22:26:28 +0000 (00:26 +0200)]
CUDA: faster tile FA (Pascal/AMD), headsize 256 (llama/15769)

13 days agokleidiai: generalize compute_forward_kv_cache to compute_forward_fp16 (llama/15817)
Charles Xu [Sat, 6 Sep 2025 14:08:43 +0000 (16:08 +0200)]
kleidiai: generalize compute_forward_kv_cache to compute_forward_fp16 (llama/15817)

13 days agoggml-cpu: document use of "free" memory [no ci] (llama/15834)
Johannes Gäßler [Sat, 6 Sep 2025 11:28:44 +0000 (13:28 +0200)]
ggml-cpu: document use of "free" memory [no ci] (llama/15834)

13 days agoggml-cpu: drop support for nnpa intrinsics (llama/15821)
Aaron Teo [Sat, 6 Sep 2025 03:27:28 +0000 (11:27 +0800)]
ggml-cpu: drop support for nnpa intrinsics (llama/15821)

13 days agoCUDA: fastdiv, launch bounds for mmvq + q8_1 quant (llama/15802)
Johannes Gäßler [Fri, 5 Sep 2025 14:07:02 +0000 (16:07 +0200)]
CUDA: fastdiv, launch bounds for mmvq + q8_1 quant (llama/15802)

* CUDA: fastdiv, launch bounds for mmvq + q8_1 quant

13 days agotests : add --list-ops and --show-coverage options (llama/15745)
Daniel Bevenius [Fri, 5 Sep 2025 12:49:21 +0000 (14:49 +0200)]
tests : add --list-ops and --show-coverage options (llama/15745)

This commit adds two new command-line options to the
test-backend-ops.cpp that allow users to list all available GGML
operations and to show test coverage of these operations.

The motivation for this is that it can be useful to quickly see which
operations are currently covered by tests and which are not. Also it
migth be useful when using the `support` mode.

2 weeks agoUpdate gguf specification to synchronize the `ggml_types` declaration shown in the...
StyMaar [Tue, 16 Sep 2025 11:42:24 +0000 (13:42 +0200)]
Update gguf specification  to synchronize the `ggml_types` declaration shown in the doc with the actual one. (#1342)

BF16, TQ1_0,TQ2_0 and MXFP4 were missing in the enum declaration in the spec.

2 weeks agoggml : introduce semantic versioning (#1336)
Daniel Bevenius [Tue, 16 Sep 2025 04:16:52 +0000 (06:16 +0200)]
ggml : introduce semantic versioning (#1336)

* ggml : introduce semantic versioning

This commit introduces semantic versioning for the GGML library.

The motivation for this is that the current versioning, using build
numbers, makes it difficult to track changes and releases for projects
that use ggml.

The release steps are the following:
1. Sync the changes from llama.cpp using sync-llama-am.sh and after the
   PR has been approved and merged move to step 2.
2. Run scripts/release.sh and specify the type of release, major, minor,
   or patch. This script will handle incrementing the version
   (major|minor|patch), create a new commit with the version change,
   create a tag for the version, and prepare for the next development
   iteration.
3. Inspect the commits/tag and push to master. This will trigger the
   github release workflow which is triggered for new tags which will
   then publish a new release on github.

Example usage:
```console
$ ./scripts/release.sh major --dry-run
[dry-run] - No changes will be made

Step 1: Reading current version...
Current version: 0.9.0-dev
New release version: 1.0.0

Step 2: Updating version in CMakeLists.txt...
  [dry-run] Would update GGML_VERSION_MAJOR to 1
  [dry-run] Would update GGML_VERSION_MINOR to 0
  [dry-run] Would update GGML_VERSION_PATCH to 0
  [dry-run] Would remove -dev suffix

Step 3: Committing version bump...
  [dry-run] Would commit: 'ggml : bump version to 1.0.0'

Step 4: Creating git tag...
  [dry-run] Would create tag: v1.0.0 with message 'Release version 1.0.0'

Step 5: Preparing for next development cycle...
  [dry-run] Would update GGML_VERSION_MINOR to 1
  [dry-run] Would add -dev suffix back

Step 6: Committing development version...
  [dry-run] Would commit: 'ggml : prepare for development of 1.1.0-dev'

[dry-run] Summary (no changes were made):
  • Would have released version: 1.0.0
  • Would have created tag: v1.0.0
  • Would have set next development version: 1.1.0-dev
```

Refs: https://github.com/ggml-org/ggml/issues/1333

* ggml: create branch for release candidate and check master

* ggml : sign the git tag

3 weeks agoCUDA : conditionally add cuda architectures (#1341)
Gregor Jasny [Wed, 10 Sep 2025 15:21:11 +0000 (17:21 +0200)]
CUDA : conditionally add cuda architectures (#1341)

3 weeks agogitignore : ignore idea files (#1339)
distlibs [Tue, 9 Sep 2025 11:17:07 +0000 (14:17 +0300)]
gitignore : ignore idea files (#1339)

This commit adds ignores for CLion IDE files.

4 weeks agosync : llama.cpp
Georgi Gerganov [Fri, 5 Sep 2025 09:54:49 +0000 (12:54 +0300)]
sync : llama.cpp

ggml-ci

4 weeks agometal : Add template specialization for mul_mm_id w/ ne20 == 10 (llama/15799)
Gabe Goodhart [Thu, 4 Sep 2025 15:53:22 +0000 (09:53 -0600)]
metal : Add template specialization for mul_mm_id w/ ne20 == 10 (llama/15799)

Branch: GGMLMetalNE20

Signed-off-by: Gabe Goodhart <redacted>
4 weeks agoCANN: Refactor ND to NZ workspace to be per-device (llama/15763)
Chenguang Li [Thu, 4 Sep 2025 12:20:14 +0000 (20:20 +0800)]
CANN: Refactor ND to NZ workspace to be per-device (llama/15763)

* CANN:Refactor ND to NZ workspace to be per-device in Ascend backend

- Replaced the previous single global ND→NZ workspace with a per-device
  cache using unordered_map keyed by device ID.
- Functions `release_nz_workspace`, `relloc_nz_workspace`, and
  `get_nz_workspace` now manage workspace independently for each device,
  preventing memory conflicts in multi-device / pipeline parallel scenarios.
- This change fixes potential precision issues caused by workspace
  overwrites when multiple devices perform ND→NZ conversions concurrently.

Co-authored-by: hipudding <redacted>
* refactor

Signed-off-by: noemotiovon <redacted>
* rename

Signed-off-by: noemotiovon <redacted>
* fix review comments

Signed-off-by: noemotiovon <redacted>
---------

Signed-off-by: noemotiovon <redacted>
Co-authored-by: hipudding <redacted>
4 weeks agoggml: add ops for WAN video model (cuda && cpu) (llama/15669)
leejet [Thu, 4 Sep 2025 08:38:49 +0000 (16:38 +0800)]
ggml: add ops for WAN video model (cuda && cpu) (llama/15669)

* add conv3d support

* add ggml_pad_ext for cpu & cuda backend

* cuda/cpu: add im2col_3d support

* cuda: make im2col a little faster

* fix cuda pad/scale/im2col3d

* make im2col_3d faster

* gguf: support loading tensors which n_dims > GGML_MAX_DIMS

* fix cuda get_rows

* avoid ggml_conv_3d conflict

* correct GGML_OP_COUNT assertion

* avoid build failure

* avoid build failure on MacOS

* cuda: remove unnecessary MIN define

* fix cpu im2col_3d

* adjust the code style

* cuda: use simpler loop in get_rows

* add test_im2col_3d to test-backend-ops

* test-backend-ops.cpp: remove trailing whitespace

* cpu: im2col_3d support non continuous src

Co-authored-by: Jeff Bolz <redacted>
* fix test_im2col_3d

* remove unused variables

* cuda: get_rows: dfloat2 -> float2

* add test_pad_ext to test-backend-ops.cpp

* add gguf_init_from_file_ext impl

* Revert "gguf: support loading tensors which n_dims > GGML_MAX_DIMS"

This reverts commit d8377a0a37f314bd3713fe043b4333ad661610c1.

* Revert "add gguf_init_from_file_ext impl"

This reverts commit d9f1d13208c68ef83b3538201ac7f31614fb1994.

* update ggml_backend_vk_device_supports_op

* fix ggml_backend_vk_device_supports_op

* update other backend supports op for ggml_pad_ext

* metal/opencl/sycl/vulkan: fix GGML_OP_PAD check in supports_op

---------

Co-authored-by: Jeff Bolz <redacted>
4 weeks agoCANN: Fix precision issue on 310I DUO multi-devices (llama/15784)
hipudding [Thu, 4 Sep 2025 07:12:30 +0000 (15:12 +0800)]
CANN: Fix precision issue on 310I DUO multi-devices (llama/15784)

4 weeks agoopencl: add hs=40 to FA (llama/15758)
rmatif [Thu, 4 Sep 2025 06:30:28 +0000 (08:30 +0200)]
opencl: add hs=40 to FA (llama/15758)

4 weeks agoCANN: fix acl_rstd allocation size in ggml_cann_rms_norm (llama/15760)
Chenguang Li [Thu, 4 Sep 2025 03:03:02 +0000 (11:03 +0800)]
CANN: fix acl_rstd allocation size in ggml_cann_rms_norm (llama/15760)

Fixes #15330

Adjust the allocation size of acl_rstd. The parameter `dims` is set to 3 according to the CANN documentation.

Co-authored-by: Yuchuan <redacted>
4 weeks agovulkan: fix mmv subgroup16 selection (llama/15775)
Ruben Ortlam [Wed, 3 Sep 2025 20:55:10 +0000 (22:55 +0200)]
vulkan: fix mmv subgroup16 selection (llama/15775)

4 weeks agovulkan: don't use std::string in load_shaders, to improve compile time (llama/15724)
Jeff Bolz [Wed, 3 Sep 2025 18:33:15 +0000 (13:33 -0500)]
vulkan: don't use std::string in load_shaders, to improve compile time (llama/15724)

* vulkan: don't use std::string in load_shaders, to improve compile time

* keep the string version for those calls that use it

4 weeks agovulkan : update ggml_vk_instance_validation_ext_available (llama/15666)
Daniel Bevenius [Wed, 3 Sep 2025 18:24:50 +0000 (20:24 +0200)]
vulkan : update ggml_vk_instance_validation_ext_available (llama/15666)

* vulkan : update ggml_vk_instance_validation_ext_available

This commit updates ggml_vk_instance_validation_ext_available() to
check for VK_EXT_validation_features instead of
VK_KHR_portability_enumeration.

Based on how the returned boolean is used later in the code (to enable
both the validation layer and the VK_EXT_validation_features extension),
it appears the function may have been intended to check for the
validation layer features extension.

* remove try/catch

This was a left over from a previous iteration where I was explicitly
quering for a specific validation layer first, which would throw.

* update warning message about validation layers

4 weeks agoggml vulkan: add hardsigmoid and hardswish operations (llama/15762)
Shin-myoung-serp [Wed, 3 Sep 2025 18:22:55 +0000 (03:22 +0900)]
ggml vulkan: add hardsigmoid and hardswish operations (llama/15762)

4 weeks agoCUDA: Optimize `rms_norm_f32` kernel and its fused variants, giving 1-6% perf E2E...
Oliver Simons [Wed, 3 Sep 2025 17:59:16 +0000 (19:59 +0200)]
CUDA: Optimize `rms_norm_f32` kernel and its fused variants, giving 1-6% perf E2E (llama/15715)

* Add fastdiv, use it in modulo and use modulo in rms_norm_f32

Fastdiv is much faster way to do integer division, which was identified
as bottleneck in rms_norm_f32

* Support more `block_size` values in `rms_norm_f32`

This makes us more flexible in selecting the optimal threads w.r.t
paralellizing across a col vs. launch-overheads of threads and mio
throttles

* Update src/ggml-cuda/common.cuh

Co-authored-by: Johannes Gäßler <redacted>
* Replace modulo with fastmodulo in `rms_norm_f32`

* Use `BinPackArguments=true` for formating function calls

Will file a separate PR to adjust .clang-format file

* Update src/ggml-cuda/common.cuh

Co-authored-by: Johannes Gäßler <redacted>
* Use uint3 for both `fastdiv` and `fastmodulo`

The compiler seems to reliably optimize away the unused .z component in
the fastdiv use-case, see https://godbolt.org/z/rx8KPrKr3

* More constrained type declarations

Co-authored-by: Johannes Gäßler <redacted>
* Rename fastdiv and fastmodulo variables to shared variable name

As suggest by JohannesGaessler, this increases clarity of the intended
use

* Pack fastdiv/fastmodulo constants into uint2/uint3 objects

By packing constants to be used together into a struct, we are less
likely to make errors.

* Rename function parameter of fastmodulo

`modulo_consts` is more fitting/descriptive

---------

Co-authored-by: Johannes Gäßler <redacted>
4 weeks agoCANN: Add RoPE contiguous check for 310I DUP device (llama/15735)
hipudding [Wed, 3 Sep 2025 08:46:01 +0000 (16:46 +0800)]
CANN: Add RoPE contiguous check for 310I DUP device (llama/15735)

4 weeks agoggml-cpu : optimize RVV kernels (llama/15720)
xctan [Wed, 3 Sep 2025 08:16:21 +0000 (16:16 +0800)]
ggml-cpu : optimize RVV kernels (llama/15720)

* ggml-cpu : optimize rvv ggml_vec_dot_f32

* ggml-cpu : optimize 128-bit rvv ggml_vec_dot_q4_K_q8_K

* ggml-cpu : fix riscv arch flags

* ggml-cpu : add more rvv ops

* ggml-cpu : optimize rvv ggml_vec_dot_q4_K_q8_K

* ggml-cpu : optimize rvv ggml_vec_dot_q6_K_q8_K

* ggml-cpu : minor rvv adjustments

* ggml-cpu : fix riscv include