]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/log
pkg/ggml/sources/whisper.cpp
2 months agoggml : fix tensor-parallel + -ncmoe crash on MoE models (llama/25028)
liminfei-amd [Sun, 5 Jul 2026 17:56:11 +0000 (01:56 +0800)]
ggml : fix tensor-parallel + -ncmoe crash on MoE models (llama/25028)

Tensor parallelism (-sm tensor) combined with -ncmoe (CPU-offloaded MoE
experts) aborts during warm-up on MoE models with
GGML_ASSERT(ggml_is_contiguous(tensor)) in ggml-backend-meta.cpp.

The failing tensor is the MoE router output (ffn_moe_topk): it is mirrored
(GGML_BACKEND_SPLIT_AXIS_MIRRORED, replicated across backends since routing
must be identical) and happens to be a non-contiguous view.
ggml_backend_meta_buffer_{get,set}_tensor asserted contiguity before
consulting the split state, so a mirrored non-contiguous tensor tripped the
assert even though the GGML_BACKEND_SPLIT_AXIS_MIRRORED case right below
already handles it.

Move the split-state lookup above the assert and allow the mirrored case in
both get_tensor and set_tensor.

Diagnosis credit to the reporter (@nathanmp).

Fixes #24886

Signed-off-by: liminfei-amd <redacted>
2 months agoggml: Update VMM Pool allocation ggml-cuda.cu - Turing P2P access fix (fixes #24489...
Vexxie [Sun, 5 Jul 2026 17:10:09 +0000 (18:10 +0100)]
ggml: Update VMM Pool allocation ggml-cuda.cu - Turing P2P access fix (fixes #24489) (llama/24491)

* Update ggml-cuda.cu - Turing P2P access fix.

* Add original code as fallback behaviour when NCCL or P2P is not set/true.

* Update ggml/src/ggml-cuda/ggml-cuda.cu to add comment as per suggestion

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

Co-authored-by: Johannes Gäßler <redacted>
2 months agocuda : concat implementation for quantized types (llama/25303)
fairydreaming [Sun, 5 Jul 2026 15:26:24 +0000 (17:26 +0200)]
cuda : concat implementation for quantized types (llama/25303)

* cuda : concat implementation for quantized types

* chore : apply am17an clever suggestion to shorten the code

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agoggml : fix broken CPU concat implementation for quantized types (llama/25247)
fairydreaming [Sat, 4 Jul 2026 11:37:37 +0000 (13:37 +0200)]
ggml : fix broken CPU concat implementation for quantized types (llama/25247)

* ggml : fix broken CPU concat implementation for quantized types

* tests : concat tests for quantized types

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agocuda: enable topk-moe fusion for 288 experts (llama/25267)
Piotr Wilkin (ilintar) [Fri, 3 Jul 2026 13:36:55 +0000 (15:36 +0200)]
cuda: enable topk-moe fusion for 288 experts (llama/25267)

* cuda: enable topk-moe fusion for 288 experts

The topk-moe fusion only accepted power-of-2 expert counts (or the
special-cased 576), so models with 288 experts (e.g. Step-3.7-Flash)
fell back to the unfused per-layer routing chain: softmax/sigmoid,
argsort, get_rows, sum_rows, div, clamp, scale. At batch size 1 that
is ~330 extra tiny graph nodes per token.

288 is a multiple of the warp size, so the existing kernel already
handles it; this adds the missing template instantiation and accepts
288 in the eligibility check.

Measured on gfx1151 with Step-3.7-Flash IQ4_XS (llama-bench,
-b 4096 -ub 4096 -fa 1 -dio 1 -ctk q8_0 -ctv q8_0; machine idle,
before/after paired so pp4096 stays matched as a load control):

  test            | before         | after
  ----------------+----------------+----------------
  pp4096          | 460.99 ± 0.45  | 462.47 ± 0.34   (unchanged)
  tg128           |  19.10 ± 0.04  |  19.56 ± 0.03   (+2.4%)
  tg128 @ d30000  |  12.68 ± 0.04  |  12.69 ± 0.03   (unchanged)

Prompt processing is unaffected (the fusion only touches decode
routing). The decode gain is ~+2.4% at shallow context and fades with
depth: by 30k tokens each step is attention-bound over the KV cache,
so removing the fixed routing overhead is no longer visible.

Assisted-By: Claude Fable 5 <redacted>
* Update tests/test-backend-ops.cpp

Co-authored-by: Oliver Simons <redacted>
* Add comment for case 288 in topk-moe.cu

---------

Co-authored-by: Oliver Simons <redacted>
2 months agoRemove redundant CUDA copies after gated_delta_net. (llama/23940)
Gaurav Garg [Fri, 3 Jul 2026 09:06:29 +0000 (14:36 +0530)]
Remove redundant CUDA copies after gated_delta_net. (llama/23940)

* Remove redundant CUDA copies after gated_delta_net.

Currently, GDN writes recurrent state snapshots into its output tail, then the graph immediately copies those snapshots into ssm_states_all. With MTP draft length 3, target decode uses K=4, so that becomes 4 extra ggml_cuda_cpy calls.

The change detects that gated_delta_net -> view -> cpy pattern and makes the CUDA GDN kernel write the state snapshot(s) directly into the recurrent cache, skipping the intermediate tail writes and copy kernels when safe.

* Address review comments

2 months agoopencl: allow loading precompiled binary kernels from library (llama/23042)
lhez [Wed, 1 Jul 2026 17:29:22 +0000 (10:29 -0700)]
opencl: allow loading precompiled binary kernels from library (llama/23042)

* opencl: allow loading binary kernel

* opencl: add libdl.h

* ggml-backend-dl is in ggml, which depends backend libs, thus
  ggml-opencl cannot depend on ggml-backend-dl
* add libdl.h to break cyclic dep

* opencl: allow loading bin kernel lib

* opencl: load `gemm_moe_mxfp4_f32_ns` from kernel lib if available

* opencl: load q8_0 gemm from kernel lib

* opencl: load q4_0 moe gemm from kernel lib

* opencl: load q4_1 moe gemm from kernel lib

* opencl: load q4_k moe gemm from kernel lib

* opencl: always declare `get_adreno_bin_kernel_func_t`

* opencl: rephrase message

* opencl: fix for rebase

* opencl: update doc

2 months agohexagon: flash attention rework (optimizations, accuracy improvements, etc) (llama...
Max Krasnyansky [Wed, 1 Jul 2026 13:59:19 +0000 (06:59 -0700)]
hexagon: flash attention rework (optimizations, accuracy improvements, etc) (llama/25085)

* hex-mm: fold mm quant tasks into the main matmul threads

* hex-mm: minor formatting fixes

* hex-mm: cleanup is_quant checks in dma dispatch

* hex-mm: fix dst-spad alignment

* hex-mm: move fp kernels in the hvx-mm-kernels header

* hex-mm: fuse with ADD

* hex-fa: factor out ukernels into separate headers and unify the rest

* hex-fa: move kernel-params compute into the host

* hex-fa: refactor vtcm alloc for consistency

* hex-fa: add support for FA_SELECT

* hex-fa: update tracing insrumentation to cover all functions

* hex-fa: update hvx fallback thresholds to recover t/g regressions

* hex-fa: update tracing instrumentation

* hex-fa: improved tracing with additional events

* hex-fa: optimize mask processing (fastdiv, etc)

* hex-fa: improve mask dma caching

* hmx-fa: change loop order to maximize mask cache hits

* hex-fa: remove over instrumentation

* hex-fa: breakdown QKV prep trace events

* hmx-fa: further mask proc optimizations

* hex-fa: mask broadcast is the common case, optimize for that

* hex-fa: use aligned loads where possible

* hex-fa: update loops to use uint32_t indices

* hmx-fa: fold vtcm init into q prep task

* hex-fa: update rest of the hmx funcs to use uint32_t

* hmx-fa: fold build_d into the main softmax loop

* hmx-fa: start kv dmas earlier

* hmx-fa: start mask dma a bit earlier

* hex-fa: precompute rows per task to avoid divs

* hmx-fa: specialize fa_o_store for f16 and f32

* hmx-fa: prelim support for Sinks

* hmx-fa: keep softmax accumulators in fp32

* hex-fa: add tanh_f16 and exp2_f16 and use that in FA

* hex-fa: use fp16 math in the hvx kernel

* hex-fa: avoid expensive float -> __fp16 cast for slopes and softcap

* hex-fa: replace most vec_exp_f32 with vec_exp2_f16

* hmx-fa: vectorize sinks update

* hex-fa: minor formatting

* hmx-fa: fold softcap loop into the tile load

* hmx-fa: use vectoralias to populate sinks

* hex-fa: remove redudant check

* hex-fa: fix vtcm size compute to use fp32 for accumulators

* hex-mm: fix trailing spaces

* hmx-fa: dont use -inf to init mask to avoid conversion overflows

* hex-fa: no need to explicitly guard -inf in the f16->f32 converter now

* hmx-fa: cleanup fa sinks handling

* hex-mm: fixed src2 stride handling when mm is fused with add

* hex-fa: make lto happy

2 months agoCUDA: consistent use of __restrict__ + PDL for FA (llama/25185)
Johannes Gäßler [Wed, 1 Jul 2026 08:55:14 +0000 (10:55 +0200)]
CUDA: consistent use of __restrict__ + PDL for FA (llama/25185)

2 months agoggml-cpu: add AVX2 optimization for nvfp4 dot product and use UE4M3 LUT (llama/23961)
ragz4125 [Wed, 1 Jul 2026 07:31:20 +0000 (13:01 +0530)]
ggml-cpu: add AVX2 optimization for nvfp4 dot product and use UE4M3 LUT (llama/23961)

2 months agoopencl: initial q1_0 support (llama/25160)
lhez [Wed, 1 Jul 2026 04:43:20 +0000 (21:43 -0700)]
opencl: initial q1_0 support (llama/25160)

* opencl: general q1_0 support

* opencl: add Adreno GEMM/GEMV for q1_0

2 months agocuda : prevent integer truncation and overflow errors when using KQ mask strides...
fairydreaming [Tue, 30 Jun 2026 18:47:05 +0000 (20:47 +0200)]
cuda : prevent integer truncation and overflow errors when using KQ mask strides in flash_attn_mask_to_KV_max kernel (llama/24945)

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agoCUDA: fix get_rows_back for tables with more than 65535 rows (grid-y clamp + stride...
Matt Jallo [Tue, 30 Jun 2026 12:16:24 +0000 (05:16 -0700)]
CUDA: fix get_rows_back for tables with more than 65535 rows (grid-y clamp + stride) (llama/25103)

2 months agoCUDA: fix Gemma E4B MTP FlashAttention (llama/25148)
Johannes Gäßler [Tue, 30 Jun 2026 12:06:54 +0000 (14:06 +0200)]
CUDA: fix Gemma E4B MTP FlashAttention (llama/25148)

* CUDA: fix Gemma E4B MTP FlashAttention

* remove unused template declaration

2 months agovulkan: roll bk loop in matmul for asahi linux (llama/24663)
Kevin Liu [Tue, 30 Jun 2026 10:27:38 +0000 (06:27 -0400)]
vulkan: roll bk loop in matmul for asahi linux (llama/24663)

* vulkan: roll bk loop in matmul for asahi linux

* vulkan: fix inline comment

* vulkan: revert BK-loop unroll change

* vulkan: edit spirv directly for asahi roll bk loop

* vulkan: remove trailing whitespace at the end of comments

2 months agoHIP: use hipBLAS for dense prefill on gfx900, keep MMQ for MoE (llama/24588)
zduford [Tue, 30 Jun 2026 09:51:38 +0000 (05:51 -0400)]
HIP: use hipBLAS for dense prefill on gfx900, keep MMQ for MoE (llama/24588)

* HIP: keep MMQ for gfx900 MoE and Q8_0, use hipBLAS for dense K-quants

Assisted-by: GitHub Copilot CLI
* HIP: tighten conditional block to be explicitly for gfx900

* HIP: Further simplified gfx900 conditional block

* removed unnecessary comment

2 months agoggml-webgpu: add support for NVFP4 (llama/25143)
Masashi Yoshimura [Tue, 30 Jun 2026 08:20:04 +0000 (17:20 +0900)]
ggml-webgpu: add support for NVFP4 (llama/25143)

2 months agoRevert "sched : reintroduce less synchronizations during split compute (#20793)"...
Oliver Simons [Tue, 30 Jun 2026 00:41:45 +0000 (02:41 +0200)]
Revert "sched : reintroduce less synchronizations during split compute (#20793)" (llama/25138)

2 months agovulkan: use flops instead of weight tensor size for submission heuristic (llama/25005)
Ruben Ortlam [Mon, 29 Jun 2026 13:24:44 +0000 (15:24 +0200)]
vulkan: use flops instead of weight tensor size for submission heuristic (llama/25005)

* vulkan: extract flops calculation into function

* use flops instead of matmul src0 tensor size for submission threshold

* use unsigned ints

2 months agoopencl: flash attention improvement (llama/25069)
Hongqiang Wang [Sat, 27 Jun 2026 22:36:06 +0000 (15:36 -0700)]
opencl: flash attention improvement (llama/25069)

* opencl: rework FA kernel for f16 and f32

* opencl: flash-attention prefill prepass kernels

- flash_attn_kv_pad_f16    pads the tail KV tile to a BLOCK_N multiple
- flash_attn_mask_pad_f16  pads the matching mask tile
- flash_attn_blk_f16       classifies each KV tile per query block as
                           fully masked / mixed / fully unmasked, so
                           the main kernel can skip fully-masked tiles
                           and the mask lookup for fully-unmasked ones

* opencl: FA kernels for q4_0 and q8_0

* opencl: `set_rows` for f32 to q8_0/q4_0

* opencl: dequant kernels for q4_0 and q8_0

* opencl: add FA tile tuning table with override

* opencl: wire host side for FA

* opencl: q4_0 MoE tensors are also SOA'ed

* opencl: cosmetic fix

* opencl: refactor, also clarify some code paths in comments

* opencl: fix inifity for `-cl-finite-math-only`

---------

Co-authored-by: Li He <redacted>
2 months agoAdded a cudaMemcpy2DAsync fast path to ggml_cuda_cpy (llama/25057)
Gaurav Garg [Sat, 27 Jun 2026 12:16:21 +0000 (17:46 +0530)]
Added a cudaMemcpy2DAsync fast path to ggml_cuda_cpy (llama/25057)

* [CUDA] Added a cudaMemcpy2DAsync fast path to ggml_cuda_cpy

Add a CUDA ggml_cpy fast path for same-type, same-shape strided copies that are just 2D pitched block copies.
When tensors are not fully contiguous but each row is contiguous, it now uses cudaMemcpy2DAsync instead of the slow element-wise scalar copy kernel.

This fixes the GDN recurrent snapshot update with -np 4, where rollback slots are separated by cache stride gaps.

* Add new tests that execute the new optimized strided copy path

* Return unsupported for strided copy in OpenVINO, as new tests are failing

2 months agosycl : fix failed ut cases of norm (llama/25044)
Neo Zhang [Sat, 27 Jun 2026 09:13:43 +0000 (17:13 +0800)]
sycl : fix failed ut cases of norm (llama/25044)

2 months agovulkan: fix step operator for 0 input (llama/25036)
Ruben Ortlam [Sat, 27 Jun 2026 08:57:31 +0000 (10:57 +0200)]
vulkan: fix step operator for 0 input (llama/25036)

2 months agosched : reintroduce less synchronizations during split compute (llama/20793)
Andreas Kieslinger [Fri, 26 Jun 2026 14:18:30 +0000 (16:18 +0200)]
sched : reintroduce less synchronizations during split compute (llama/20793)

* CUDA:  Improve performance via less synchronizations between token (llama/17795)

* Adds CPU-to-CUDA copy capability to
ggml_backend_cuda_cpy_tensor_async()

* Adds function to relax sync requirements between input copies on
supported backends (CUDA for now)

* Exchanges synchronous copy with async copy function.

* Adds macro guards to allow compilation in non-CUDA builds

* Reworked backend detection in ggml-backend.cpp to avoid linking
conflicts

* Relax requirement of checks in async CUDA copies from backend and buffer type to just buffer type, to avoid linking issues

* Minor cleanup

* Makes opt-in to relax use of explicit syncs more general. Backends like
vulkan which require a synchronization between HtoD copies and graph
execution could also adopt this change now.

* Reintroduces stricter check for CPU->CUDA backend async copy via
GGML_DEVICE_TYPE_CPU.

* Corrects initialization of ggml_backend_sync_mode in
ggml_backend_sched_split initialization

* Simplifies synchronizations to adhere to `saaasg` pattern.

* Apply suggestion from @ggerganov (src->buffer to buf_src)

Co-authored-by: Georgi Gerganov <redacted>
* Apply suggestion from @ggerganov (src->buffer to buf_src) v2

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

Co-authored-by: Georgi Gerganov <redacted>
* Apply suggestions from @johannesgaessler code review

Co-authored-by: Johannes Gäßler <redacted>
* Adds single-GPU synchronizations to multi-GPU settings to fix hip backend pipeline parallel bugs.

* Scheduler Hardening: Exclude hip/MUSA from copy_from_host CPU split ->
GPU split optimization

* Scheduler Hardening: Re-adding original additional synchronizations for
non-async backends

* Adds disclaimer to hip/musa exclusion of copy_from_host. Highlights that it is out of
precaution, but that no perf-impact is visible, and that it can be
revisited separately anytime.

---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Johannes Gäßler <redacted>
2 months agoopenvino: Update to OV 2026.2.1, self-contained release packages, operator improvemen...
Ravi Panchumarthy [Fri, 26 Jun 2026 12:07:19 +0000 (05:07 -0700)]
openvino: Update to OV 2026.2.1, self-contained release packages, operator improvements (llama/24974)

* Update to OV 2026.2.1, Make OV release packages self-contained

* Update to OV 2026.2.1, Make OV release packages self-contained

* OpenVINO Backend: Remove compute_op_type hardcoded sets (llama/222)

* OpenVINO Backend: Remove compute_op_type hardcoded sets

* revert get_op_type removal

* OpenVINO backend: enable softmax with sink input

* OpenVINO backend: opt mul_mat_id convert process for large size

* OpenVINO backend: Modify add_id to support 2D/4D

* OpenVINO Backend: Add glu_swiglu_oai

* PR review: fix paths

* PR review: fix path consistency

---------

Co-authored-by: Mostafa <redacted>
Co-authored-by: Xuejun <redacted>
2 months agovulkan: opt mul_mat_vecq for mi50 (llama/22933)
nullname [Fri, 26 Jun 2026 11:49:24 +0000 (19:49 +0800)]
vulkan: opt mul_mat_vecq for mi50 (llama/22933)

2 months agovulkan: add INTEL_XE1 arch enum and enable coopmat1 on Intel Xe-LPG Plus (llama/24404)
Jiang, Fish [Fri, 26 Jun 2026 11:26:22 +0000 (11:26 +0000)]
vulkan: add INTEL_XE1 arch enum and enable coopmat1 on Intel Xe-LPG Plus (llama/24404)

* vulkan: add INTEL_PRE_XE2 arch enum and enable coopmat1 on Intel Xe-LPG Plus (1/3, Xe1-ARLH)

Co-authored-by: Xia, Jie <redacted>
Co-authored-by: Liu, Russell <redacted>
* Address comments of bf16 and trailing whitespace

* Rename INTEL_PRE_XE2 to INTEL_XE1 and remove driver workaround

* Add Windows driver check

---------

Co-authored-by: Xia, Jie <redacted>
Co-authored-by: Liu, Russell <redacted>
2 months agowhisper : expose internal VAD speech segments (#3916)
Lin Xiaodong [Wed, 1 Jul 2026 11:10:16 +0000 (19:10 +0800)]
whisper : expose internal VAD speech segments (#3916)

When transcribing with params.vad = true, whisper already computes the speech
segments and keeps them in the state. Expose them so callers can reuse those
boundaries (for example to align or clip subtitles to speech) instead of running
a second, separate VAD pass.

Times are on the original audio timeline in centiseconds; the count is 0 when VAD
was not used. test-vad-full.cpp checks the segments are ordered and non-empty.

2 months agoci, examples : add package-lock.json to examples addon node (#3919)
Daniel Bevenius [Wed, 1 Jul 2026 07:04:21 +0000 (09:04 +0200)]
ci, examples : add package-lock.json to examples addon node (#3919)

* ci, examples : add package-lock.json to examples addon node

This commit commits the package-lock.json file for examples/addon.node.

This is needed to make the CI workflow work properly and after we
started pinning the action versions in the workflow, the CI started
failing because the package-lock.json was not committed. At least that
is what I think is happening.

* ci: use node 20.x and 22.x instead of 16.x and 18.x

* fix CMakeLists.txt target properties for addon.node

2 months agowhisper : map token timestamps to original time when VAD is enabled (#3910)
Lin Xiaodong [Wed, 1 Jul 2026 06:23:50 +0000 (14:23 +0800)]
whisper : map token timestamps to original time when VAD is enabled (#3910)

whisper_full_get_token_data().t0/t1 are in the VAD-processed timeline (silences
removed), so they don't line up with the original audio. Add
whisper_full_get_token_t0/t1 that map them back.

A token inside a speech segment is interpolated within it; a token that falls in a
removed inter-segment silence snaps to the nearest boundary, so it never lands in
the middle of a cut-out gap. Without VAD the raw times are returned unchanged.

2 months agowhisper : make voice_length() utf-8 aware for CJK (#3915)
Lin Xiaodong [Wed, 1 Jul 2026 06:21:35 +0000 (14:21 +0800)]
whisper : make voice_length() utf-8 aware for CJK (#3915)

* whisper : make voice_length() utf-8 aware for CJK

voice_length() weights each token by how long its text takes to say, which drives
how a segment's time is shared between its tokens. It looped over raw bytes, so
every CJK character (3 bytes) was counted ~3x and full-width punctuation never
matched, skewing token timestamps for Chinese/Japanese.

Decode one utf-8 code point at a time and give full-width ,。!? etc. the same
weights as their ASCII counterparts. Pure-ASCII text is unaffected.

* whisper : one statement per line in voice_length()

---------

Co-authored-by: linxiaodong <redacted>
2 months agoci : set GGML_NATIVE=OFF for sanitize builds (#3920)
Daniel Bevenius [Tue, 30 Jun 2026 15:47:22 +0000 (17:47 +0200)]
ci : set GGML_NATIVE=OFF for sanitize builds (#3920)

This commit sets GGML_NATIVE=OFF for all sanitize builds to avoid
the case where the compilation happens using a runner that support
instructions that may not be available on all runners leading to illegal
instruction and failed CI runs.

Refs: https://github.com/ggml-org/whisper.cpp/actions/runs/28444909499/job/84291639530?pr=3919

2 months agoexamples : Improved inference performance of Android example project (#3913)
Yongmin Yoo 유용민 [Tue, 30 Jun 2026 10:12:04 +0000 (19:12 +0900)]
examples : Improved inference performance of Android example project (#3913)

* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android example

* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android.java example

2 months agotalk-llama : sync llama.cpp
Georgi Gerganov [Fri, 26 Jun 2026 12:06:05 +0000 (15:06 +0300)]
talk-llama : sync llama.cpp

2 months agosync : ggml
Georgi Gerganov [Fri, 26 Jun 2026 12:05:10 +0000 (15:05 +0300)]
sync : ggml

2 months agoggml : bump version to 0.15.3 (ggml/1550)
Georgi Gerganov [Fri, 26 Jun 2026 11:37:43 +0000 (14:37 +0300)]
ggml : bump version to 0.15.3 (ggml/1550)

2 months agovulkan: Workaround compiler bug in conv2d coopmat2 path (llama/24924)
Jeff Bolz [Fri, 26 Jun 2026 09:53:32 +0000 (04:53 -0500)]
vulkan: Workaround compiler bug in conv2d coopmat2 path (llama/24924)

* vulkan: Workaround compiler bug in conv2d coopmat2 path

* apply same workaround to CONV_3D

* Apply suggestion from @jeffbolznv

2 months agoCUDA: add cublasSgemmBatched mapping for HIP/MUSA vendor headers (llama/25033)
leonardHONG [Fri, 26 Jun 2026 09:42:56 +0000 (17:42 +0800)]
CUDA: add cublasSgemmBatched mapping for HIP/MUSA vendor headers (llama/25033)

2 months agoggml-cpu: fix SVE leftover path in ggml_vec_dot_f32 (llama/24699)
Tarek Dakhran [Fri, 26 Jun 2026 07:41:56 +0000 (09:41 +0200)]
ggml-cpu: fix SVE leftover path in ggml_vec_dot_f32 (llama/24699)

* ggml-cpu: fix SVE leftover path in ggml_vec_dot_f32

2D convolutions with kernel size 9 produced different results on SVE
enabled ARM devices. After debugging it turned out that ggml_vec_dot_f32
was using data from inactive lanes.

Use svmla_f32_m(pg, sum1, ax1, ay1) so inactive lanes retain sum1.

* cont : clean-up

---------

Co-authored-by: Georgi Gerganov <redacted>
2 months agosycl : clamp softmax input to avoid underflow (llama/24941)
Jassieluo [Fri, 26 Jun 2026 07:02:42 +0000 (15:02 +0800)]
sycl : clamp softmax input to avoid underflow (llama/24941)

2 months agoCUDA: batch out_prod broadcast (dps2>1) path with cublasSgemmBatched (llama/24426)
leonardHONG [Fri, 26 Jun 2026 05:51:25 +0000 (13:51 +0800)]
CUDA: batch out_prod broadcast (dps2>1) path with cublasSgemmBatched (llama/24426)

2 months agoopencl: flush profiling batch at shutdown for incomplete batches (llama/25016)
shaofeiqi [Fri, 26 Jun 2026 01:48:24 +0000 (18:48 -0700)]
opencl: flush profiling batch at shutdown for incomplete batches (llama/25016)

2 months agoCUDA: Various fixes to `cpy.cu` (llama/25000)
Oliver Simons [Thu, 25 Jun 2026 15:29:23 +0000 (17:29 +0200)]
CUDA: Various fixes to `cpy.cu` (llama/25000)

* Add failing test-case to test-backend-ops

Extracted from https://github.com/ggml-org/llama.cpp/issues/24072

* Minimize repro with help of AI

N = 8 * (65535 - 1) + 1 = 524273

* Port and adjust workaround from https://github.com/LostRuins/koboldcpp/commit/0ba798341e0c70517cb226cb63c966b086a3b5b3

Fall-back should share code, also relax y-z constraint to be inclusive

* Add test-case + fallback also for y dim

* Fix x-guards which is 2^{31}-1, so inlusive of INT_MAX

* Fix overflow problems for transposed copy kernel

2 months agoggml : address integer overflows in binary ops CUDA implementation (llama/24706)
fairydreaming [Thu, 25 Jun 2026 08:06:44 +0000 (10:06 +0200)]
ggml : address integer overflows in binary ops CUDA implementation (llama/24706)

* ggml : address integer overflows in binary ops CUDA implementation

* ggml : add size_t casts to avoid integer overflows

* ggml : add more asserts checking integer overflows in binary ops CUDA implementation

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 months agosycl : support --split-mode tensor (llama/24152)
David Spruill [Thu, 25 Jun 2026 05:35:21 +0000 (01:35 -0400)]
sycl : support --split-mode tensor (llama/24152)

* Sycl tp stage1 (llama/1)

* SYCL: tensor parallelism (--split-mode tensor) for dual-GPU

Adds the comm_init/comm_free/comm_allreduce_tensor trio that the
meta-backend queries via get_proc_address to enable backend-specific
all-reduce, mirroring the pattern used by ggml-cuda.cu.

For N=2 (the common dual-GPU case) implements a degenerate ring
all-reduce with two size-branched paths:

  * Small (nelem < 32768): FP32 direct memcpy + per-device ADD kernel
    chained via depends_on(memcpy_event). 4 SYCL submissions/call.

  * Large (nelem >= 32768): BF16-compressed. Each device compresses
    FP32 -> BF16 in a local outbox, cross-device memcpys to the peer's
    inbox (HALF the PCIe bytes), then decompresses + adds into the
    local FP32 partial. 6 SYCL submissions/call but PCIe bytes halved
    -- wins for any tensor where PCIe dominates kernel time.

Threshold and BF16 path pattern mirror the CUDA NCCL allreduce.

Storage: ONE persistent uint8_t buffer per device, 4 * nelem bytes
(matches both path layouts: FP32 nelem floats; BF16 outbox+inbox =
2 * nelem uint16_t each). Single alloc+free per device keeps the
SYCL pool's strict-LIFO invariant trivial.

Initial impl handles N=2 FP32 contiguous tensors. Other cases return
false, causing the meta-backend to use its generic butterfly fallback.

Per-call sync is intentionally omitted. SYCL in-order queue semantics
ensure that the meta-backend's next compute on the same per-device
queue waits for our final ADD, and the next allreduce's first op on
the same persistent buffer waits via the same queue. Only comm_free
does an explicit final wait.

OneCCL is NOT used: OneCCL 2021.17 hardcodes single-device-per-process
in communicator_impl.hpp:47 (condition devices.size() == 1), which is
incompatible with llama.cpp's single-process multi-GPU model.

Measured on dual Intel Arc Pro B70 (NEO 26.05.x, oneAPI 2025.3 +
DPC++ nightly):

  Llama-3.3-70B Q4_K_M, -sm tensor -fa 1 -ctk f16 -ctv f16:
    pp512 = 377.08 t/s  (vs 313.65 layer mode = +20.2%)
    tg128 = 17.40 t/s   (vs   9.74 layer mode = +78.6%)

  Qwen3-Coder-Next-80B-A3B Q3_K_M (MoE):
    pp512 = 216.56 t/s  (vs 156.58 meta-backend butterfly = +38.3%)
    tg128 = 17.60 t/s   (vs  14.31 meta-backend butterfly = +23.0%)

  Qwen3-4B Q4_K_M:
    pp64  = 984.51 t/s, tg16 = 49.29 t/s

Llama-3.3-70B in SYCL TP now comfortably beats production layer mode
on both prefill and decode. Coder-Next-80B-A3B (MoE) also wins on
both — the BF16 path is what unlocks the many-medium-allreduces
prefill pattern.

Build/CMake: no changes. No new dependencies. ~210 lines added across
ggml-sycl.h and ggml-sycl.cpp.

* Fix comments

* documentation update to address PR feedback

* Bring over my device-to-device memcpy chagnes

* move the dev2dev_memcpy calls to the upstream 7-parameter variety

* Fix a typo and remove a trailing whitespace

2 months agosycl : fix the failed UT cases of conv_3d (llama/24900)
Neo Zhang [Thu, 25 Jun 2026 05:27:58 +0000 (13:27 +0800)]
sycl : fix the failed UT cases of conv_3d (llama/24900)

2 months agoopencl: support non-contig rows in norm (llama/24965)
lhez [Thu, 25 Jun 2026 02:21:25 +0000 (19:21 -0700)]
opencl: support non-contig rows in norm (llama/24965)

2 months agohexagon: MUL_MAT and MUL_MAT_ID rework : 32x32 tiled weight repack, kernel-params...
Max Krasnyansky [Wed, 24 Jun 2026 19:14:25 +0000 (12:14 -0700)]
hexagon: MUL_MAT and MUL_MAT_ID rework : 32x32 tiled weight repack, kernel-params, cached graphs (llama/24954)

* hex-mm: new weight layout and fusion updates

* hvx-mm: unroll the new tiled vec_dots to optimize hvx register util

* hex-mm: optimize dyn.quant format for q8_0 and q8_1 to reduce overhead in vec_dots.

* hvx-mm: parallel quantizer per block for large rows

* hvx-mm: simplify and futher optimize dyn.quant and vec_dots

* hvx-mm: keep intermediate per tile accumulators in fp16

* hmx-mm: optimize weight dequant by aligning the repacked tiles with the DMA

* hmx-mm: remove qweight scratch and just use vtcm_weight

* hmx-mm: remove all unused and obsolete code

* hmx-mm: the new tiled repack format is here to stay -- rename all x4x2 to _tiled

* hmx-mm: improve activation processing with dma prefetch

* hex-mm: fix hmx/hvx fallback logic and MUL_MAT_ID allocation (unbreaks OLMoE)

* hex-mm: align the weight tiles with dma just like we did in hmx-mm

* hex-mm: factor out common mm bits into htp/matmul-ops.h

* hex-mm: start moving mm kernel selection to the host

* hex-mm: move all of the matmul param compute into the host

* hmx-mm: restore pipelined mode

* hmx-mm: unroll the dequant functions to optimize register usage

* hmx-mm: further improve activation process

* hex-mm: use vtcm_seq_alloc for all vtcm allocations and define more common functions

* hex-mm: improve mm optimizer to acount for number of activation threads

* hex-mm: fix matmul-id kernel params selection (unbreaks OLMoE and LFM)

* hexagon: remove support for arch < v73 since HMX is now required for most use-cases

* hex-mm: cleanup naming for consistency

* hex-mm: make sure matmul fusion accounts for vtcm allocation

* hex-mm: minor cleanup for kernel_params definition

* hex-mm: replace hardcoded limits with proper checks for vtcm requirements

* hex-mm: add support for non-tiled mm as a fallback option and factor out hvx kernels into separate header

* hex-mm: remove unused functions

* hex-mm: add shorthand for MM_SELECT in run-tool script

* hvx-mm: factor out hvx/hmx microkernels and unify matmul entry and dispatch

* hex-mm: further cleanup matmul fallback path

* hex-mm: refactor matmul entry point and dispatch a bit further

* hexagon: update cmake build to enable hmx for everything

* hex-ops: optimize kernel_param updates and include summary in the logs

* hex-mm: add support for GGML_HEXAGON_MM_SELECT

* hex-mm: add hex-common header

* hex-mm: pass correct number of tasks to workpool

* hex-mm: add proper checks for no-work in dyn.quant tasks

* hex-mm: convert all quantizers into a macro

* hex-mm: fix hvx-flat fallback to pass all MUL_MAT tests

* hex-mm: vectorize q8_1 quantizer

* hex-mm: improve fused ffn mm stride handling

* hex-mm: consistent use of n_threads and pipeline in kernel_params

* hexagon: minor formatting

* hex-mm: update MUL_MAT_ID kernel_param handling to make sure host/npu are in sync

* hvx-mm: go back to accumulating in fp32 in tiled hvx kernels, more accurate and same perf

* hvx-mm: unroll the loops and remove masking that is not needed for tiled accums

* hmx-mm: optimize activation processing (slit loops, some unrolling, etc)

* hmx-mm: minor optimization for output processing

* hex-mm: consistent use of uint32_t and size_t in mm kernels

* hex-mm: remove legacy restrictions for rows to be multiple of 256

* hexagon: replace sprintf with snprintf

* hex-mm: relax hardcoded nrows checks and rely on VTCM size requirements

* hexagon: minor alignment fix

* hexagon: fix trailing spaces

* hex-mm: relax padding from 256 to 128 (leftovers)

* hex-mm: remove redundant checks for weight align to 128

we always use 2D dma for the weights and align them properly

* hmx-mm: MUL_MAT_ID better work distribution between hvx threads and hmx tracing

* hex-mm: specialize per-token mmid activation handling

* hex-profile: update python scripts to handle kernel-params section in the logging output

* hex-mm: move n_prefetch (aka dma_depth) into kernel params and remove unused fields

* hex-trace: use easier to parse format, simply and fix post-proc scripts

* hmx-mm: relax 32 row limit for output processing which helps utilization

* hmx-mm: use start-chunk idx for tracing info

* hmx-mm: parameterize activation dma pipeline

* hexagon: add support for simple graph caching to avoid recomputing kernel-params

* hex-mm: remove left-over repack functions

* hex-mm: tighten n_prefetch asserts

* hex-mm: remove duplicate round/align_up helper

* hexagon: cleanup common header used in host/npu

* hexagon: update early wakeup threshold

* hmx-mm: define cost constants and update solver to assume that repacked ne[1] is padded to 32

* hmx-mm: make precompute_matmul a bit more readable (split into smaller functions, etc)

* hex-mm: remove n_threads constraint

* hex-mm: minor formatting updates

* hex-mm: remove obsolete profiling logs

* hex-mm: restore hardcode gate to refuse lm-head to avoid repacking that tensor

2 months agovulkan: allow reducing the graph submission batches to avoid timeouts (llama/24872)
Wagner Bruna [Wed, 24 Jun 2026 14:29:24 +0000 (11:29 -0300)]
vulkan: allow reducing the graph submission batches to avoid timeouts (llama/24872)

2 months agovulkan: fail the build when a shader fails to compile (llama/24450)
liminfei-amd [Wed, 24 Jun 2026 09:42:03 +0000 (17:42 +0800)]
vulkan: fail the build when a shader fails to compile (llama/24450)

* vulkan-shaders-gen: fail the build when a shader fails to compile

vulkan-shaders-gen did not detect shader-compile subprocess failures, so a
broken libggml-vulkan could be produced while the build reported success and
the breakage only surfaced at run time. execute_command() discarded the child
exit code (POSIX waitpid passed nullptr for status; the Windows branch never
called GetExitCodeProcess) and string_to_spv decided success only from whether
stderr was empty, so a non-zero exit with empty stderr, or a subprocess that
failed to launch, was treated as success.

Return the child exit code from execute_command() (WEXITSTATUS on POSIX,
GetExitCodeProcess on Windows), treat a non-zero exit or non-empty stderr or a
launch exception as a failure, and record it in an atomic flag. main() checks
the flag after process_shaders() and returns EXIT_FAILURE before writing the
output files, so the build stops instead of emitting a broken backend.

Fixes #24393

Signed-off-by: liminfei-amd <redacted>
* vulkan-shaders-gen: simplify compile_failed access and drop unreachable return

Address review feedback on #24450:
- Access the std::atomic<bool> compile_failed directly (= / implicit bool)
  instead of .store()/.load(); the flag stays atomic because the worker
  threads in process_shaders() set it concurrently.
- Remove the unreachable trailing return -1 in execute_command(): on POSIX the
  child _exit()s after execvp and the parent returns (fork()<0 throws); on
  Windows the block returns the exit code.

Signed-off-by: liminfei-amd <redacted>
---------

Signed-off-by: liminfei-amd <redacted>
2 months agovulkan: Apply bias before softmax in FA, to avoid overflow (llama/24909)
Jeff Bolz [Wed, 24 Jun 2026 03:34:00 +0000 (22:34 -0500)]
vulkan: Apply bias before softmax in FA, to avoid overflow (llama/24909)

2 months agovulkan: support all backend tests for SQR/SQRT/SIN/COS/CLAMP/LEAKY_RELU/NORM (llama...
Jeff Bolz [Tue, 23 Jun 2026 14:48:24 +0000 (09:48 -0500)]
vulkan: support all backend tests for SQR/SQRT/SIN/COS/CLAMP/LEAKY_RELU/NORM (llama/24582)

* vulkan: make SQR/SQRT/SIN/COS/CLAMP/LEAKY_RELU use unary.comp

* vulkan: make NORM support noncontig

* add noncontiguous row test cases for norm/l2_norm, handle this in the CPU backend and l2_norm.comp

* fix supports_op for cuda and webgpu

2 months agovulkan: Support GET_ROWS_BACK (llama/24883)
Jeff Bolz [Tue, 23 Jun 2026 13:39:37 +0000 (08:39 -0500)]
vulkan: Support GET_ROWS_BACK (llama/24883)

2 months agovulkan: support CONV_3D (llama/24612)
Jeff Bolz [Tue, 23 Jun 2026 13:39:20 +0000 (08:39 -0500)]
vulkan: support CONV_3D (llama/24612)

* vulkan: support CONV_3D

This is a pretty direct port of conv2d_mm.comp to CONV_3D, done by codex
and cleaned up by me.

* disable slower perf tests

2 months agovulkan: make mul_mm ALIGNED a spec constant (llama/24689)
Jeff Bolz [Tue, 23 Jun 2026 12:26:17 +0000 (07:26 -0500)]
vulkan: make mul_mm ALIGNED a spec constant (llama/24689)

This trims down some of the shader variant explosion and reduces binary size.

2 months agovulkan: link ggml-cpu when GGML_VULKAN_CHECK_RESULTS / RUN_TESTS are enabled (llama...
Wyatt Caldwell [Tue, 23 Jun 2026 10:55:46 +0000 (03:55 -0700)]
vulkan: link ggml-cpu when GGML_VULKAN_CHECK_RESULTS / RUN_TESTS are enabled (llama/24444)

The result-checking and test debug paths in ggml-vulkan.cpp call ggml_graph_compute_with_ctx() to compute a CPU reference graph, but that symbol is defined in ggml-cpu, which ggml-vulkan does not link. Enabling -DGGML_VULKAN_CHECK_RESULTS=ON (or -DGGML_VULKAN_RUN_TESTS=ON) therefore fails to link with an unresolved external (e.g. LNK2019 on MSVC, undefined reference on GCC/Clang). This regressed after ggml-cpu was split into its own library. Link ggml-cpu under those two options so the debug builds link again.

Signed-off-by: Wyatt Caldwell <redacted>
2 months agoggml-webgpu: improve MTP inference by using mat-vec path for small batches (llama...
Masashi Yoshimura [Tue, 23 Jun 2026 08:13:55 +0000 (17:13 +0900)]
ggml-webgpu: improve MTP inference by using mat-vec path for small batches (llama/24811)

* ggml-webgpu: improve small batches decoding

* Add barrier to the NUM_COLS loop in mul-mat-vec

2 months agoopencl: q8_0 gemv precision improvement (llama/24923)
Shawn Gu [Tue, 23 Jun 2026 05:25:21 +0000 (22:25 -0700)]
opencl: q8_0 gemv precision improvement (llama/24923)

2 months agosupport bf16 on bin_bcast OP and unary OPs (llama/24838)
Neo Zhang [Mon, 22 Jun 2026 11:09:02 +0000 (19:09 +0800)]
support bf16 on bin_bcast OP and unary OPs (llama/24838)

* support bf16 on bin_bcast OP and unary OPs

* support the older Intel compiler than 2026.0

2 months agofix(hexagon): use padded stride for ssm-conv weights (llama/24470)
Guanhuai Zhang [Sat, 20 Jun 2026 21:58:49 +0000 (05:58 +0800)]
fix(hexagon): use padded stride for ssm-conv weights (llama/24470)

2 months agoggml : optimize AMX (llama/24806)
Adrien Gallouët [Sat, 20 Jun 2026 10:43:06 +0000 (12:43 +0200)]
ggml : optimize AMX (llama/24806)

Flatten the partition over n_batch * M so every thread participates in
the quantization

    | CPU                             | Model                         | Test   |   t/s OLD |   t/s NEW |   Speedup |
    |:--------------------------------|:------------------------------|:-------|----------:|----------:|----------:|
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B IQ4_NL - 4.5 bpw  | pp512  |    730.71 |    779.86 |      1.07 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B IQ4_NL - 4.5 bpw  | tg128  |     87.88 |     86.79 |      0.99 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B IQ4_XS - 4.25 bpw | pp512  |    725.09 |   1023.31 |      1.41 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B IQ4_XS - 4.25 bpw | tg128  |     83.64 |     83.62 |      1.00 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_0              | pp512  |    820.51 |    924.05 |      1.13 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_0              | tg128  |     90.59 |     92.46 |      1.02 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_1              | pp512  |    776.88 |    872.79 |      1.12 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_1              | tg128  |     89.39 |     90.94 |      1.02 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_K_M            | pp512  |    719.28 |   1009.27 |      1.40 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_K_M            | tg128  |     80.62 |     80.86 |      1.00 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_K_S            | pp512  |    732.29 |   1077.29 |      1.47 |
    | Intel(R) Xeon(R) Platinum 8488C | qwen35 0.8B Q4_K_S            | tg128  |     86.42 |     83.53 |      0.97 |

Signed-off-by: Adrien Gallouët <redacted>
2 months agoggml-webgpu: add adapter toggles for F16 on Vulkan + NVIDIA
Masashi Yoshimura [Fri, 19 Jun 2026 23:12:32 +0000 (08:12 +0900)]
ggml-webgpu: add adapter toggles for F16 on Vulkan + NVIDIA

2 months agomtmd, arg: fix utf8 handling on windows (llama/24779)
Xuan-Son Nguyen [Fri, 19 Jun 2026 20:28:38 +0000 (22:28 +0200)]
mtmd, arg: fix utf8 handling on windows (llama/24779)

* mtmd, arg: fix utf8 handling on windows

* also fix ggml_fopen

* fix build fail

* also fix CLI

2 months agoexamples : fix argument flag for min speech duration in VAD (#3907)
QuantiusBenignus [Fri, 26 Jun 2026 06:09:03 +0000 (02:09 -0400)]
examples : fix argument flag for min speech duration in VAD (#3907)

Fixed the -vspd flag for vad_min_speech_duration_ms, to prevent hiding vad_min_silence_duration_ms.
In usage () clarified the output timestamp units.
Fixed a few typos.

2 months agoexamples : update model names in parakeet-cli README.md [no ci] (#3906)
Daniel Bevenius [Tue, 23 Jun 2026 07:12:31 +0000 (09:12 +0200)]
examples : update model names in parakeet-cli README.md [no ci] (#3906)

This commit updates the parakeet model names which are currently missing
the 'ggml-' prefix.

2 months agoFix pkgconfig configuration (Nix build failure) (#3894)
Nicky Mouha [Tue, 23 Jun 2026 03:36:48 +0000 (23:36 -0400)]
Fix pkgconfig configuration (Nix build failure) (#3894)

2 months agoinclude parakeet in build-xcframework.sh (#3899)
Naitik Shah [Mon, 22 Jun 2026 10:06:51 +0000 (14:06 +0400)]
include parakeet in build-xcframework.sh (#3899)

2 months agotalk-llama : sync llama.cpp
Georgi Gerganov [Fri, 19 Jun 2026 07:19:58 +0000 (10:19 +0300)]
talk-llama : sync llama.cpp

2 months agosync : ggml
Georgi Gerganov [Fri, 19 Jun 2026 07:19:47 +0000 (10:19 +0300)]
sync : ggml

2 months agoggml : bump version to 0.15.2 (ggml/1548)
Georgi Gerganov [Fri, 19 Jun 2026 07:14:26 +0000 (10:14 +0300)]
ggml : bump version to 0.15.2 (ggml/1548)

2 months agoggml-cpu: support K tails in power10 Q8/Q4 MMA matmul (llama/24753)
shalinib-ibm [Fri, 19 Jun 2026 05:55:38 +0000 (11:25 +0530)]
ggml-cpu: support K tails in power10 Q8/Q4 MMA matmul (llama/24753)

* ggml-cpu: support K tails in Power10 MMA Q8/Q4 matmul

This patch removes the requirement that K be divisible by kc in the tinyBlas_Q0_PPC tiled matmul path. Process the final K panel using its actual depth and pass the reduced panel size through packing and kernel execution.  This allows more workloads to use the MMA kernel and reduces fallback to mnpack.

* Apply suggestion from @taronaeo

Co-authored-by: Aaron Teo <redacted>
---------

Co-authored-by: Aaron Teo <redacted>
2 months agoGgml/cuda col2im 1d (llama/24417)
Pascal [Thu, 18 Jun 2026 20:23:01 +0000 (22:23 +0200)]
Ggml/cuda col2im 1d (llama/24417)

* cuda: add GGML_OP_COL2IM_1D, follow-up to the CPU op

* cuda: col2im_1d use fast_div_modulo for the index decomposition

* cuda: col2im_1d tighten supports_op, type match and contiguous dst

2 months agohexagon: support for op-trace (fine-grain tracing of HVX/HMX/DMA events) (llama/24592)
Max Krasnyansky [Thu, 18 Jun 2026 15:35:02 +0000 (08:35 -0700)]
hexagon: support for op-trace (fine-grain tracing of HVX/HMX/DMA events) (llama/24592)

* hex-optrace: add support for optrace and instrument matmul and flash-atten code

* hex-trace: improve trace event and prefetto generator

* hex-trace: add new script dedicated to handling traces, specifically perfetto traces

* hex-trace: add --head/--tail options to profile and trace tools

* hex-trace: fix whitespaces

* hex-trace: fix flake8 warnings

* hex-trace: fix flake8 warnings

* hmx-fa: restore q_tiles clearing

* hex-profile: remove circular dep in includes

* hex-trace: simplify trace sizing check

* hex-profile: sort events in the summary by name

2 months agorename GGML_SYCL_SUPPORT_LEVEL_ZERO (llama/24719)
Neo Zhang [Thu, 18 Jun 2026 08:18:26 +0000 (16:18 +0800)]
rename GGML_SYCL_SUPPORT_LEVEL_ZERO (llama/24719)

* rename GGML_SYCL_SUPPORT_LEVEL_ZERO to GGML_SYCL_SUPPORT_LEVEL_ZERO_API, and GGML_SYCL_ENABLE_LEVEL_ZERO to  GGML_SYCL_USE_LEVEL_ZERO_API

* fix code format

* fix error when rebase

2 months agosycl : support MUL_MAT and OUT_PROD with Q1_0 (llama/24721)
Neo Zhang [Thu, 18 Jun 2026 08:17:37 +0000 (16:17 +0800)]
sycl : support MUL_MAT and OUT_PROD with Q1_0 (llama/24721)

2 months agosupport OPs: conv_2d, conv_2d_dw, conv2d_transpose (llama/24600)
Neo Zhang [Thu, 18 Jun 2026 06:40:03 +0000 (14:40 +0800)]
support OPs: conv_2d, conv_2d_dw, conv2d_transpose (llama/24600)

* fix conflict

* fix format issue, rename

* rm debug code

* correct the file name

2 months agometal : check for BF16 support in concat kernel (llama/24747)
Georgi Gerganov [Thu, 18 Jun 2026 06:16:06 +0000 (09:16 +0300)]
metal : check for BF16 support in concat kernel (llama/24747)

2 months agoggml-cpu: Conditionally enable power11 backend based on compiler support (llama/24687)
shalinib-ibm [Wed, 17 Jun 2026 18:45:19 +0000 (00:15 +0530)]
ggml-cpu: Conditionally enable power11 backend based on compiler support (llama/24687)

* ggml: Conditionally enable power11 backend based on compiler support

Guard POWER11 backend creation behind a compiler flag check for -mcpu=power11. This avoids build failures on current GCC/Clang toolchains while preserving forward compatibility once POWER11 support becomes available.

* Update CMakeLists.txt

ggml-cpu: Use -mcpu=power10 for P10 and P11

2 months agometal : implement rope_back operator (llama/24725)
Georgi Gerganov [Wed, 17 Jun 2026 17:36:05 +0000 (20:36 +0300)]
metal : implement rope_back operator (llama/24725)

Reuse existing rope kernels with a function constant to toggle forward/backward
rotation, avoiding duplicate kernel code.

Assisted-by: pi:llama.cpp/Qwen3.6-27B
2 months agometal : add f16 and bf16 support for concat operator (llama/24724)
Georgi Gerganov [Wed, 17 Jun 2026 16:38:55 +0000 (19:38 +0300)]
metal : add f16 and bf16 support for concat operator (llama/24724)

* metal : add f16 and bf16 support for concat operator

Extend the Metal backend concat operator to support f16 and bf16 tensor
types in addition to the existing f32 and i32 support.

- Template kernel_concat on type T with specializations for float, half,
  bfloat, and int
- Add type-specific pipeline getter ggml_metal_library_get_pipeline_concat()
- Update device support check to allow f16 unconditionally and bf16 when
  device supports bfloat16
- Update dispatch to select the correct kernel specialization by type

Assisted-by: pi:llama.cpp/Qwen3.6-27B
* metal : extend concat operator to support f16, bf16, i8, i16 and i64

Assisted-by: pi:llama.cpp/Qwen3.6-27B
2 months agoadd dev2dev memcpy by SYCL API (llama/24476)
Neo Zhang [Wed, 17 Jun 2026 14:21:34 +0000 (22:21 +0800)]
add dev2dev memcpy by SYCL API (llama/24476)

* add dev2dev memcpy by SYCL API

* mv GGML_SYCL_DEV2DEV_MEMCPY to runntime table

* update the detect method for p2p comm

* fix the erro created during fix confilct

---------

Co-authored-by: Neo Zhang <NA>
2 months agoAdd conv_3d (llama/24691)
Neo Zhang [Wed, 17 Jun 2026 14:20:01 +0000 (22:20 +0800)]
Add conv_3d (llama/24691)

* add conv_3d

* optimize

* update ops.md

* restore test script

* rm unused code

* rm copyright notes

2 months agovulkan: record actual memory properties during buffer creation (llama/24326)
Winston Ma [Wed, 17 Jun 2026 09:14:48 +0000 (17:14 +0800)]
vulkan: record actual memory properties during buffer creation (llama/24326)

2 months agoRevert "cuda: reset cuda context after reading memory size (llama/23935)" (llama...
Ruben Ortlam [Wed, 17 Jun 2026 08:59:35 +0000 (10:59 +0200)]
Revert "cuda: reset cuda context after reading memory size (llama/23935)" (llama/24715)

This reverts commit 0f7fada56bea32c9e0db3874b801d887ff6c4529.

2 months agoci: fix vulkan docker images (llama/24595)
kononnable [Wed, 17 Jun 2026 07:43:45 +0000 (09:43 +0200)]
ci: fix vulkan docker images (llama/24595)

* Update vulkan-shaders-gen.cpp

* Update vulkan-shaders-gen.cpp

add comment describing code change intention

* Update vulkan-shaders-gen.cpp

fix potential UB

2 months agoopencl: optimize mul_mat_f16_f32_l4 for decode (llama/24504)
lhez [Wed, 17 Jun 2026 06:21:26 +0000 (23:21 -0700)]
opencl: optimize mul_mat_f16_f32_l4 for decode (llama/24504)

2 months agoopenvino: OV 2026.2, context-shift, Q5_1 support, gemma4 dense/embedding, and -fa...
Zijun Yu [Wed, 17 Jun 2026 06:11:21 +0000 (14:11 +0800)]
openvino: OV 2026.2, context-shift, Q5_1 support, gemma4 dense/embedding, and -fa off (llama/24503)

* Add interface is_model_splitted() to check the c-graph is splited or not

* Infer and propagate dynamic-dimension indices for all tensors in the GGML graph in api compute_model_outputs()

* Only do this for fallback sub graph

* Move dynamic dims compute in graph missmatch

* ggml-openvino: fix tensor data handling for PERMUTE/VIEW ops in split models

* ggml-openvino:add comments

* ggml-openvino: override VIEW op_case to 0 for split model inputs

* openvino backend: Handle unsupported VIEW shape-mismatch in OpenVINO backend

* Enable additional mul_mat tests and add tensor data saving function (llama/81)

* ggml-openvino: fix CONT/TRANSPOSE mapping and improve dynamic-dimension handling

* OpenVINO: add NORM/TANH support and rework SOFT_MAX translation

* ggml-openvino: extend VIEW handling

* Enable -fa off (llama/118)

* Enable --context-shift

* Fix llm param compute error for normal softmax not the softmax in attention

* OpenVINO backend: fix error for attention size compute in llm param

* use tensor->extra in infer_request i/o

* OpenVINO backend: refacter the compute_llm_params() func add get_attention_pattern_case to easy extand

* OpenVINO backend: clean unused code

* 1to1 match op update (llama/146)

* added translate_1to1_match_1_input function and updated gelu and tanh translations

* Remove unused translation function calls

---------

Co-authored-by: Mustafa Cavus <redacted>
* initial gemma4 support

* removed hardcoded names for kv cache slicing

* OpenVINO backend: Add new attention pattern for llm parameters compute

* flash attn Q shape static conversion

* Remove slice in permute translation when n_seq is 1

* return optional in extract_layer_from_name

* OpenVINO backend: refactor VIEW related operation (llama/148)

* OpenVINO backend: refactor VIEW related operation

* Enable VIEW handling in following ops

* OpenVINO backend does not support GGML_OP_NORM & GGML_OP_L2_NORM with VIEW input accuracy issue from OpenVINO

* OpenVINO backend: Add ops l2_norm & pad

* OpenVINO backend does not support CPY with non-contiguous data or mismatched types

* add op SSM_CONV GATED_DELTA_NET

* OpenVINO backend: fix error for bf16 in OV gpu plugin

* reverted static Q input shape for attention layer

* OpenVINO backend: remove hardcode name inp_tokens, which ignore some leaf case

* Disable remote tensor due to bug in ov gpu

* Disable n_token > 1 GATED_DELTA_NET on gpu

* OpenVINO backend: fix the view op dynamic handling issue in gemma4 & enable view + get_row

* OpenVINO backend: clean code

* OpenVINO backend: enable view + norm/rms_norm

* OpenVINO backend: concat op

* OpenVINO backend: argsort op

* OpenVINO backend: enable unary + view & GGML_UNARY_OP_SOFTPLUS

* Fix issue for test-backend-ops in TOPK_MOE, which compare VIEW ops result, VIEW node in OpenVINO no need compare, the whole graph result is correct

* OpenVINO backend: enable sum_rows

* OpenVINO backend: enable clamp

* OpenVINO backend: enable DIV

* OpenVINO backend: enable GGML_OP_MUL_MAT_ID

* OpenVINO backend: disable MUL_MAT_ID_FUSION case with large mem needed

* OpenVINO backend: Disable GGML_OP_ARGSORT, cause test_backend-ops failed

* OpenVINO backend: fix issue in mul_mat_id

* OpenVINO backend: Disable DIV with broadcast on GPU

* OpenVINO backend: update DIV

* use ov internal op GatedDeltaNet

* OpenVINO backend: enable llama erch test qwen3next

* OpenVINO backend: enable RMS_NORM + VIEW & remove op_case 2 for rope

* OpenVINO backend: fix error

* suggested changes, need review

* suggested changes, need review

* OpenVINO backend: clean unused code & fix build warning

* OpenVINO backend: enable minicpm3 for arch test

* Disable GDN op (llama/177)

* disable gated_delta_net

* update stateful_kv_size correctly in mismatch case

* OpenVINO backend: enable arch test for qwen3vl

* OpenVINO backend: enable cohere2 for arch test

* OpenVINO backend: enable t5 for arch test

* OpenVINO backend: enable jamba for arch test

* OpenVINO backend: remove warning for tmp

* OpenVINO backend: enable kimi-linear for arch test

* Remove unused

* Fix gpt-oss accuracy issue

* OpenVINO backend: enable arctic for arch test

* OpenVINO backend: enable grok for arch test

* Gemma4 initial npu support (llama/179)

* Initiall gemma4 npu support

* temp. fix for gemma4 accuracy bug on npu

* Remove hardcoded names for npu-fold handling

* revert static n tokens for cont translation as it is not needed

* removed unused variable

* ggml-openvino: add GGML_OPENVINO_ENABLE_CACHE env var to control decoder cache. Add environment variable GGML_OPENVINO_ENABLE_CACHE (default: YES). When set to NO, the decoder_cache is bypassed and models are rebuilt from the cgraph on every inference call in both dynamic and static compute paths. This is useful for debugging and verifying correctness without caching interference.

* Revert "Gemma4 initial npu support (#179)"

This reverts commit 0d29a9c4a52dc2c8aa52990f1a3854cfb01768ad.

* OpenVINO backend: disable debug log print

* Update TBB discovery. Delegated to OpenVINOs own config.

* OpenVINO backend: GGML_OPENVINO_ENABLE_CACHE YES -> 1

* OpenVINO backend: fallback FLASH_ATTN_EXT in gemma3n to CPU backend

* Add raw ov infer profiling metric

* Add OV raw infer time metric to static compute path

Co-authored-by: virajwad <redacted>
* Modify precision of static profiling

* update to OV 2026.2, add OV windows CI

* fix editorconfig-checks

* Initiall gemma4 npu support

* temp. fix for gemma4 accuracy bug on npu

* Remove hardcoded names for npu-fold handling

* revert static n tokens for cont translation as it is not needed

* removed unused variable

* test-llama-archs fix

* Fix gemma4 flash_attn fallback

* support im2col

* fix code style

* disable add_rope_sin_cos optimization

* stateless boradcast and rope optimizations

* Enable manual gqa attn by default for stateless gpu

* manual gqa: fixed static batch

* gemma4 llama-bench ctx update fix

* Update OV win CI

* stateful rope fusion temp. fix

* OpenVINO backend: Conslolidate supported ops

* Exclude unsupported GGML_OP_SUB cases

* Exclude unsupported TOPK_MOE cases

* OpenVINO Backend: MUL_MAT enhancements

* Update OV CI

* support f16 mask input for npu

* Make GGML_OPENVINO_* env vars usage uniform

Standardize all GGML_OPENVINO_* env flags:
positive integers >0 to enable. Unset, empty, =0, or non-numeric values to disable.
This fixes cases where text values or empty strings enabled features.

* OpenVINO backend: Enhance envvar handling

* more cleanup

* move ggml_openvino_env_flag to appropriate place

* OpenVINO backend: add REPEAT translator, Q5_1 weights, and GLU view-input fix

* ggml-openvino: fix -Werror=cast-qual in extract_q5_1_data

* Update openvino.Dockerfile

Use BuildKit cache mounts for faster Docker rebuilds.
Use apt instead of dpkg, remove unused .ddeb downloads, add DLLAMA_BUILD_TESTS=OFF.

* ggml-openvino: centralize env var access via *getenv_str/getenv_int helpers

Replace getenv and legacy flags with _str and _int helpers.Minor cleanup, doc updates.

* OpenVINO backend: Enable GGML_OP_ADD_ID

* Uptade openvino backend clamg-format

* clang-format

* Update OPENVINO.md (llama/211)

* OpenVINO backend: fix accuracy issue for op CONCAT with i64 precision

* Remove strict concurrency for gpu-openvino-low-perf

* Update openvino CI keynames; add ccache-clear

* Apply suggestions from code review

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

---------

Co-authored-by: Xuejun Zhai <redacted>
Co-authored-by: Mustafa Cavus <redacted>
Co-authored-by: Mustafa Cavus <redacted>
Co-authored-by: Xuejun <redacted>
Co-authored-by: Wang Yang <redacted>
Co-authored-by: Ravi Panchumarthy <redacted>
Co-authored-by: virajwad <redacted>
Co-authored-by: copilot-swe-agent[bot] <redacted>
Co-authored-by: Mostafa Faheem <redacted>
Co-authored-by: Sigbjørn Skjæret <redacted>
2 months agosycl : Enable to support fp16 by OPs: SQR, SQRT, LOG, SIN, COS, CLAMP (llama/24692)
Neo Zhang [Wed, 17 Jun 2026 05:58:03 +0000 (13:58 +0800)]
sycl : Enable to support fp16 by OPs: SQR, SQRT, LOG, SIN, COS, CLAMP (llama/24692)

2 months agoSYCL: fix use-after-free bug with async memcpy in MoE prefill (llama/24676)
Alexey Kopytko [Wed, 17 Jun 2026 05:57:29 +0000 (14:57 +0900)]
SYCL: fix use-after-free bug with async memcpy in MoE prefill (llama/24676)

* SYCL: fix a bug with async memcpy

* make mmid_row_mapping_host persistent

* comment on stream->wait

* Apply suggestion from @sanmai

* Apply suggestion from @sanmai

* Apply suggestion from @sanmai

2 months agosycl: Add optional USM system allocations (llama/22526)
Francois Dugast [Wed, 17 Jun 2026 05:54:21 +0000 (07:54 +0200)]
sycl: Add optional USM system allocations (llama/22526)

This introduces an optional feature to allocate large GPU buffers (≥ 1GB)
using USM system allocations if supported by the device. It allows using
buffers from the system allocator then letting the system manage memory
migrations between host and device as necessary.

This feature is disabled by default and requires the GGML_SYCL_USM_SYSTEM
environment variable to enable. If USM system allocations are not supported
by the device or the system, we fallback to regular allocations.

This feature can allow VRAM overcommit. For example, the test below fails
on B580 due to lack of memory for allocation, but it passes when enabling
USM system allocations:

  ./examples/sycl/test.sh -m Qwen3.5-27B-Q3_K_M.gguf -lv 4

Signed-off-by: Francois Dugast <redacted>
2 months agovulkan: prefer host-visible memory buffers on UMA devices (llama/22930)
Winston Ma [Tue, 16 Jun 2026 07:36:52 +0000 (15:36 +0800)]
vulkan: prefer host-visible memory buffers on UMA devices (llama/22930)

* implement UMA host-visible memory

* update based on 0cc4m's suggestion

2 months agovulkan: Support gated_delta_net with S_v=16 (llama/24581)
Jeff Bolz [Tue, 16 Jun 2026 07:26:57 +0000 (02:26 -0500)]
vulkan: Support gated_delta_net with S_v=16 (llama/24581)

2 months agosycl: support reordered Q4_K/Q5_K/Q6_K MoE MUL_MAT_ID (llama/24452)
Frosty40 [Tue, 16 Jun 2026 05:35:00 +0000 (00:35 -0500)]
sycl: support reordered Q4_K/Q5_K/Q6_K MoE MUL_MAT_ID (llama/24452)

* sycl: support reordered Q4_K and Q5_K MoE MUL_MAT_ID

Extend reordered-weight handling to fused MoE MUL_MAT_ID for Q4_K and Q5_K expert tensors and add Q5_K reordered DMMV coverage. Unsupported 3D reorder cases now fall back instead of aborting.

* sycl: extend MoE reorder to Q6_K mul_mat_id

2 months agoSupport OP EXPM1, support all UT cases of FLOOR, TRUNC, ROUND (llama/24363)
Neo Zhang [Tue, 16 Jun 2026 05:34:29 +0000 (13:34 +0800)]
Support OP EXPM1, support all UT cases of FLOOR, TRUNC, ROUND (llama/24363)

* support OP EXPM1, support all UT cases of FLOOR, TRUNC, ROUND

* fix conflict

* rebase, support new UT case of repeat, concat

2 months agovulkan: add col2im_1d op (llama/24425)
Pascal [Tue, 16 Jun 2026 04:34:43 +0000 (06:34 +0200)]
vulkan: add col2im_1d op (llama/24425)

* vulkan: add GGML_OP_COL2IM_1D, follow-up to the CPU op

* vulkan: col2im_1d bounded gather loop instead of full-K scan with modulo

* vulkan: col2im_1d address review from @jeffbolznv

* vulkan: col2im_1d return nullptr for unsupported types, address review from @0cc4m

2 months agovulkan: support more CONCAT types (llama/24579)
Jeff Bolz [Mon, 15 Jun 2026 11:19:21 +0000 (06:19 -0500)]
vulkan: support more CONCAT types (llama/24579)

2 months agowasm : fix fallback symbol collision (llama/24639)
Andrei [Mon, 15 Jun 2026 07:11:59 +0000 (00:11 -0700)]
wasm : fix fallback symbol collision (llama/24639)

2 months agoSYCL: use native subgroup size for K-quant DMMV (llama/21700)
Katostrofik [Mon, 15 Jun 2026 07:10:53 +0000 (03:10 -0400)]
SYCL: use native subgroup size for K-quant DMMV (llama/21700)

2 months agosycl: fix soft_max_f32 max reduction (llama/24451)
someoneinjd [Mon, 15 Jun 2026 07:10:12 +0000 (15:10 +0800)]
sycl: fix soft_max_f32 max reduction (llama/24451)

2 months agosycl : fix reorder function; add fp32/fp16 in build script (llama/24578)
Neo Zhang [Mon, 15 Jun 2026 07:08:34 +0000 (15:08 +0800)]
sycl : fix reorder function; add fp32/fp16 in build script (llama/24578)