]> git.djapps.eu Git - pkg/ggml/sources/ggml/log
pkg/ggml/sources/ggml
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

4 weeks agoCANN: Mask unsupported TRANSPOSE_1D operator (llama/15733)
hipudding [Wed, 3 Sep 2025 06:08:22 +0000 (14:08 +0800)]
CANN: Mask unsupported TRANSPOSE_1D operator (llama/15733)

CANN currently does not support kernels larger than 255.
This change disables such cases.

4 weeks agoCANN: Fix type float_t to float (llama/15736)
Chenguang Li [Wed, 3 Sep 2025 02:43:53 +0000 (10:43 +0800)]
CANN: Fix type float_t to float (llama/15736)

Signed-off-by: noemotiovon <redacted>
4 weeks agovulkan: fix shaders gen when no integer dot is available (llama/15740)
Ruben Ortlam [Tue, 2 Sep 2025 14:02:26 +0000 (16:02 +0200)]
vulkan: fix shaders gen when no integer dot is available (llama/15740)

4 weeks agoCANN: Resolve soft_max precision issue (llama/15730)
hipudding [Tue, 2 Sep 2025 09:12:37 +0000 (17:12 +0800)]
CANN: Resolve soft_max precision issue (llama/15730)

Previously, the slope tensor was set to fp16 to improve efficiency.
While this worked correctly in FA, it caused precision issues in soft_max.
This change applies different data types for different operators
to balance both accuracy and performance.

4 weeks agovulkan: Fix macro parameter order for f32 matmul shaders (llama/15716)
Jeff Bolz [Tue, 2 Sep 2025 06:37:01 +0000 (01:37 -0500)]
vulkan: Fix macro parameter order for f32 matmul shaders (llama/15716)

4 weeks agoopencl: add attn sinks support for FA kernels (llama/15706)
rmatif [Tue, 2 Sep 2025 06:26:53 +0000 (08:26 +0200)]
opencl: add attn sinks support for FA kernels (llama/15706)

4 weeks agoCANN: Support eager execution mode under ACL graph compilation (llama/15712)
Chenguang Li [Tue, 2 Sep 2025 06:07:48 +0000 (14:07 +0800)]
CANN: Support eager execution mode under ACL graph compilation (llama/15712)

* [CANN] Support eager execution mode under ACL graph compilation

Add support for running operators in eager mode while ACL graph
compilation is enabled. This allows bypassing graph execution
and directly submitting ops, which is useful for debugging and
reducing graph build overhead in certain scenarios.

Signed-off-by: noemotiovon <redacted>
* fix typo

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

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

Signed-off-by: noemotiovon <redacted>
4 weeks agoCANN: Support ext_factor in rope (llama/15710)
hipudding [Tue, 2 Sep 2025 06:05:23 +0000 (14:05 +0800)]
CANN: Support ext_factor in rope (llama/15710)

4 weeks agoggml-backend: raise GGML_MAX_SPLIT_INPUTS (llama/15722)
Johannes Gäßler [Mon, 1 Sep 2025 23:14:55 +0000 (01:14 +0200)]
ggml-backend: raise GGML_MAX_SPLIT_INPUTS (llama/15722)

4 weeks agovulkan: use memory budget extension to read memory usage (llama/15545)
Gilad S. [Mon, 1 Sep 2025 19:17:42 +0000 (22:17 +0300)]
vulkan: use memory budget extension to read memory usage (llama/15545)

* vulkan: use memory budget extension to read memory usage

* fix: formatting and names

* formatting

* fix: detect and cache memory budget extension availability on init

* fix: read `budgetprops.heapBudget` instead of `heap.size` when memory budget extension is available

* style: lints

4 weeks agovulkan: add missing clamps in new mul_mat_id paths (llama/15702)
Jeff Bolz [Mon, 1 Sep 2025 19:01:10 +0000 (14:01 -0500)]
vulkan: add missing clamps in new mul_mat_id paths (llama/15702)

This is a missing interaction between #15546 and #15652

4 weeks agovulkan: disable large mmv subgroups on older Nvidia GPUs (llama/15717)
Ruben Ortlam [Mon, 1 Sep 2025 18:58:35 +0000 (20:58 +0200)]
vulkan: disable large mmv subgroups on older Nvidia GPUs (llama/15717)

4 weeks agoggml: SVE support for exponential functions (llama/15145)
s-goto-11 [Mon, 1 Sep 2025 18:13:49 +0000 (03:13 +0900)]
ggml: SVE support for exponential functions (llama/15145)

* SVE support for exponential functions

Add const notation to variable pg

* Update src/ggml-cpu/vec.cpp

Co-authored-by: Georgi Gerganov <redacted>
* Add const

---------

Co-authored-by: Georgi Gerganov <redacted>
4 weeks agoggml: aarch64: Implement SVE F16 kernels for vector functions (llama/15115)
Prashant Vithule [Mon, 1 Sep 2025 18:13:16 +0000 (23:43 +0530)]
ggml: aarch64: Implement SVE F16 kernels for vector functions (llama/15115)

* Added sve implementation for vec_dot_fp16 Kernel

* removed white spaces

* Added comment

* removed white spaces

* changed GGML_F16x_VEC_FMA for code consistency

* Update vec.h

---------

Co-authored-by: vithulep <redacted>
4 weeks agoVulkan: Add Integer Dot Product mul_mat_vec shader for legacy quants (llama/14903)
Ruben Ortlam [Mon, 1 Sep 2025 14:19:07 +0000 (16:19 +0200)]
Vulkan: Add Integer Dot Product mul_mat_vec shader for legacy quants (llama/14903)

* vulkan: Add Integer Dot Product mul_mat_vec shader for legacy quants

* vulkan: use subgroup operations for quantize_q8_1 shader

* vulkan: add q8_1_x4 type with 128-bit alignment, use in mul_mat_vecq shader

* vulkan: use q8_1_x4 blocks in mul_mmq shader

* vulkan: do 8 calculations per invocation instead of 32 in mul_mat_vecq, similar to mul_mat_vec

* vulkan: tune mul_mat_vecq performance for Intel

* vulkan: fix quantizing issue when tensor is not divisible by 128

* vulkan: adapt integer dot mmv to mmv small m optimization (llama/15355)

* vulkan: allow all subgroup modes for mmv and mmvq

* vulkan: use prealloc intermediate reuse for mmvq path

* vulkan: tune mmvq for Intel, AMD GCN and Nvidia RTX 3090

* vulkan: adapt mmv quantize_y path to conditional sync logic

* vulkan: disable q8_0 mmvq on Nvidia

* vulkan: enable q8_0 on Nvidia pre-turing

* fix prealloc sync condition

* fix llvmpipe subgroup 8 issue

4 weeks agoggml : WebGPU add TRANSPOSE and RESHAPE to supported ops (llama/15695)
Daniel Bevenius [Mon, 1 Sep 2025 12:28:49 +0000 (14:28 +0200)]
ggml : WebGPU add TRANSPOSE and RESHAPE to supported ops (llama/15695)

* ggml : WebGPU add TRANSPOSE and RESHAPE to supported ops

This commit adds support for the TRANSPOSE and RESHAPE operations in the
ggml webgpu backend.

Co-authored-by: Diego Devesa <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
4 weeks agoCUDA: fix build error from ambiguous __half conversions in conv2d (llama/15690)
Akarshan Biswas [Mon, 1 Sep 2025 01:25:06 +0000 (06:55 +0530)]
CUDA: fix build error from ambiguous __half conversions in conv2d (llama/15690)

* CUDA: fix build error from ambiguous __half conversions in conv2d

Building conv2d with half precision failed because `__half` defines
multiple implicit conversion operators (to float, int, short, etc.),
causing ambiguous overload resolution when multiplying with float.

Introduce a templated `to_float` helper that explicitly converts
`__half` via `__half2float`, while passing through float unchanged.
Use this helper in conv2d accumulation to ensure unambiguous and
correct promotion to float.

Fixes some build errors with half-precision kernels on CUDA.

ggml-ci

* CUDA: Replace custom to_float helper with unified ggml_cuda_cast and add half‑>float conversion

* CUDA: Add missing convert.cuh header

* CUDA: remove unnecessary extension in ggml_cuda_cast

* CUDA: Address review comment, remove second type template argument

4 weeks agoCANN: Optimize MUL_MAT_ID (llama/15658)
hipudding [Mon, 1 Sep 2025 00:57:23 +0000 (08:57 +0800)]
CANN: Optimize MUL_MAT_ID (llama/15658)

4 weeks agoCANN: fix RoPE cache issue on multi-device (llama/15629)
hipudding [Mon, 1 Sep 2025 00:57:00 +0000 (08:57 +0800)]
CANN: fix RoPE cache issue on multi-device (llama/15629)

* CANN: fix RoPE cache issue on multi-device

RoPE cache only needs to be computed once per token.
However, in multi-device scenarios, not every device starts
computation from layer 0, which may lead to unallocated memory
issues and precision errors.

This commit records the first layer of each device to avoid
the above issues.

* CANN: Optimize first-layer detection method

* CANN: Remove trailing whitespace

* CANN: Only cache the data that can be determined as unchanged through the parameters.

* CANN: Update function comment

4 weeks agometal : fix checks for available FA kernels (llama/15700)
Georgi Gerganov [Sun, 31 Aug 2025 16:43:30 +0000 (19:43 +0300)]
metal : fix checks for available FA kernels (llama/15700)

* metal : fix checks for available FA kernels

ggml-ci

* cont : fix comment [no ci]

4 weeks agollama : separate compute buffer reserve from fattn check (llama/15696)
Diego Devesa [Sun, 31 Aug 2025 13:49:03 +0000 (06:49 -0700)]
llama : separate compute buffer reserve from fattn check (llama/15696)

Exposes ggml_backend_sched_split_graph() to allow splitting the graph without allocating compute buffers and uses it to split the graph for the automatic Flash Attention check.

4 weeks agovulkan: handle large sizes for get_rows (llama/15686)
Jeff Bolz [Sun, 31 Aug 2025 08:13:27 +0000 (03:13 -0500)]
vulkan: handle large sizes for get_rows (llama/15686)

4 weeks agovulkan: mul_mat_id coopmat2 optimizations (llama/15546)
Jeff Bolz [Sun, 31 Aug 2025 07:06:43 +0000 (02:06 -0500)]
vulkan: mul_mat_id coopmat2 optimizations (llama/15546)

* vulkan: mul_mat_id coopmat2 optimizations

Add a path for when the tile fits in BN/2, similar to what we have for mul_mat.

Only call fetch_scales/store_scales once per QUANT_K block, and once at the
beginning in case start_k is not aligned.

* Also add a path for BN/4 - worth a couple more percent

4 weeks agovulkan : remove unused portability_enumeration_ext variable (llama/15679)
Daniel Bevenius [Sun, 31 Aug 2025 06:46:42 +0000 (08:46 +0200)]
vulkan : remove unused portability_enumeration_ext variable (llama/15679)

This commit removes the portability_enumeration_ext variable from the
ggml_vk_instance_portability_enumeration_ext_available function as it
is initialized to false but never modified, making it redundant.

4 weeks agovulkan: Allow fallback to sysmem memory when vidmem is full (llama/15649)
Jeff Bolz [Sun, 31 Aug 2025 06:30:54 +0000 (01:30 -0500)]
vulkan: Allow fallback to sysmem memory when vidmem is full (llama/15649)

* vulkan: Allow fallback to sysmem memory when vidmem is full

* vulkan: Add env var GGML_VK_ALLOW_SYSMEM_FALLBACK

4 weeks agovulkan: clamp matmul and FA results to the max finite value (llama/15652)
Jeff Bolz [Sun, 31 Aug 2025 06:27:57 +0000 (01:27 -0500)]
vulkan: clamp matmul and FA results to the max finite value (llama/15652)

* vulkan: clamp matmul and FA results to the max finite value

* only clamp for fp16

4 weeks agoggml: update kleidiai to v1.13.0 (llama/15663)
Charles Xu [Sat, 30 Aug 2025 16:03:42 +0000 (18:03 +0200)]
ggml: update kleidiai to v1.13.0 (llama/15663)

4 weeks agollama: use FA + max. GPU layers by default (llama/15434)
Johannes Gäßler [Sat, 30 Aug 2025 14:32:10 +0000 (16:32 +0200)]
llama: use FA + max. GPU layers by default (llama/15434)

* llama: use max. GPU layers by default, auto -fa

* ggml-backend: abort instead of segfault

4 weeks agoCUDA: use FP32 arithmetic for conv2d (llama/15683)
Johannes Gäßler [Sat, 30 Aug 2025 14:20:32 +0000 (16:20 +0200)]
CUDA: use FP32 arithmetic for conv2d (llama/15683)

4 weeks agovulkan: Skip syncing for prealloc_y when it is reused (llama/15544)
Jeff Bolz [Sat, 30 Aug 2025 09:11:22 +0000 (04:11 -0500)]
vulkan: Skip syncing for prealloc_y when it is reused (llama/15544)

4 weeks agoCANN: FIx compiler warnings (llama/15661)
Chenguang Li [Sat, 30 Aug 2025 02:18:35 +0000 (10:18 +0800)]
CANN: FIx compiler warnings (llama/15661)

Signed-off-by: noemotiovon <redacted>
4 weeks agoCUDA: fix bug in rms_norm fusion (llama/15660)
Aman Gupta [Fri, 29 Aug 2025 13:30:06 +0000 (21:30 +0800)]
CUDA: fix bug in rms_norm fusion (llama/15660)

* CUDA: fix bug in rms_norm fusion

* Fix bug for OP_REPEAT

* Fix index for add

4 weeks agoCUDA: fuse adds, fuse add with rms norm (llama/15631)
Aman Gupta [Fri, 29 Aug 2025 03:35:58 +0000 (11:35 +0800)]
CUDA: fuse adds, fuse add with rms norm (llama/15631)

* CUDA: fused add with rms_norm_mul

* Non-broadcast fuse works

* Add fused adds

* format

* Remove n_fuse from template params

* Address review comments

* Move template inside binbcast

4 weeks agoCUDA: add conv2d (llama/15635)
mnehete32 [Thu, 28 Aug 2025 18:33:03 +0000 (00:03 +0530)]
CUDA: add conv2d (llama/15635)

* CUDA: add conv2d

* CUDA: conv2d - correct formatting and added const

4 weeks agoggml-cpu: fix invalid hsum build in debug s390x (llama/15634)
Aaron Teo [Thu, 28 Aug 2025 14:39:27 +0000 (22:39 +0800)]
ggml-cpu: fix invalid hsum build in debug s390x (llama/15634)

Signed-off-by: Aaron Teo <redacted>
4 weeks agoggml : fix SSM_SCAN for n_groups > 1 (llama/15625)
compilade [Thu, 28 Aug 2025 14:11:36 +0000 (10:11 -0400)]
ggml : fix SSM_SCAN for n_groups > 1 (llama/15625)

4 weeks agokv-cache : remove LLAMA_SET_ROWS checks (llama/15505)
Georgi Gerganov [Thu, 28 Aug 2025 09:27:02 +0000 (12:27 +0300)]
kv-cache : remove LLAMA_SET_ROWS checks (llama/15505)

ggml-ci

4 weeks agocuda: Add cublasLt_static linking when GGML_STATIC is enabled (llama/15622)
matiaslin [Thu, 28 Aug 2025 00:32:36 +0000 (17:32 -0700)]
cuda: Add cublasLt_static linking when GGML_STATIC is enabled (llama/15622)

Prior to this change, we faced undefined cublasLt references when
attempting to compile 'llama-cli' with GGML_STATIC=ON on Linux.

We add linking with CUDA::cublasLt_static when CUDA version is greater
than 10.1.

4 weeks agoHIP: Enable support for ggml_backend_cuda_register_host_buffer (llama/15615)
uvos [Wed, 27 Aug 2025 11:58:54 +0000 (13:58 +0200)]
HIP: Enable support for ggml_backend_cuda_register_host_buffer (llama/15615)

4 weeks agoCANN: refactor mask handling and improve performance in FA (llama/15561)
Chenguang Li [Wed, 27 Aug 2025 09:21:41 +0000 (17:21 +0800)]
CANN: refactor mask handling and improve performance in FA (llama/15561)

* CANN(flash-attn): refactor mask handling and improve performance

1. Refactored the mask computation in Flash Attention, unified the logic without separating prefill and decode.
2. Optimized performance in non-alibi scenarios by reducing one repeat operation.
3. Updated operator management to explicitly mark unsupported cases on 310P devices and when dim is not divisible by 16.

Signed-off-by: noemotiovon <redacted>
* [CANN]: fix review

Signed-off-by: noemotiovon <redacted>
* [CANN]: Optimization FA BNSD to BSND

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

Signed-off-by: noemotiovon <redacted>
4 weeks agoggml-cpu : add basic RVV support for vector f32 ops (llama/15057)
xctan [Wed, 27 Aug 2025 08:44:22 +0000 (16:44 +0800)]
ggml-cpu : add basic RVV support for vector f32 ops (llama/15057)

* ggml-cpu : add basic RVV support for vector f32 ops

* ggml-cpu : add RVV support for f32 softmax

4 weeks agoOpenCL: add fused group_norm/norm, mul, add (llama/15314)
rmatif [Wed, 27 Aug 2025 06:36:05 +0000 (08:36 +0200)]
OpenCL: add fused group_norm/norm, mul, add (llama/15314)

* add fused group_norm/norm, mul, add

* fix spacing

* revert rms_norm logic

* fix trailing whitespace

4 weeks agotests : fix test-opt with GGML_BACKEND_DL (llama/15599)
Diego Devesa [Tue, 26 Aug 2025 20:14:38 +0000 (13:14 -0700)]
tests : fix test-opt with GGML_BACKEND_DL (llama/15599)

4 weeks agoSYCL: fix rms_norm_mul_add for tensor dim not a multiple of sg_size (llama/15592)
Akarshan Biswas [Tue, 26 Aug 2025 18:57:49 +0000 (00:27 +0530)]
SYCL: fix rms_norm_mul_add for tensor dim not a multiple of sg_size (llama/15592)

The original implementation unconditionally returned true for this operation, leading to a failure when the tensor's first dimension (ne[0]) was not a multiple of WARP_SIZE. This caused an GGML_ASSERT(ncols % WARP_SIZE == 0) failure in ggml-sycl/norm.cpp.

This change updates the ggml_backend_sycl_device_supports_op check to correctly return true for GGML_OP_RMS_NORM only when the first dimension of the tensor is a multiple of WARP_SIZE, ensuring the operation can be performed without error.

4 weeks agotests: add performance test for mul mat id (llama/15543)
Eve [Tue, 26 Aug 2025 15:42:49 +0000 (15:42 +0000)]
tests: add performance test for mul mat id (llama/15543)