Commit Graph

4808 Commits

Author SHA1 Message Date
Neo Zhang
bcbc5bc554 support op col2im_1d (llama/25264)
* support op col2im_1d

* update ops.md

* rm unused words

* update for bf16

* optimize 1%-11% as the review comments

* fix the format issue

* update as the review comments
2026-07-10 13:06:42 +03:00
Neo Zhang
a0b8896847 support OP cross_entropy_loss, cross_entropy_loss_back (llama/25236)
* support OP cross_entropy_loss, cross_entropy_loss_back

* correct format issue
2026-07-10 13:06:42 +03:00
Todd Malsbary
e1d865d834 sycl : set K_QUANTS_PER_ITERATION to 1 on DMMV path (llama/25063)
* sycl: add supported types to ggml_sycl_supports_reorder_dmmv

The reordered feature is implemented in ggml_sycl_op_dequantize_mul_mat_vec,
but gated by ggml_sycl_supports_reorder_dmmv. This commit fixes the gate.

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

* sycl: set K_QUANTS_PER_ITERATION=1 to improve utilization

When combined with opening the reorder gate, this improves GPU
utilization on B70, giving a significant boost to tg t/s.

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

* sycl: replace QK_WARP_SIZE with WARP_SIZE for QK_5

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

* sycl: add missing types to ggml_backend_sycl_buffer_init_tensor

Without this, the extra field is not allocated and the reorder path
will not take effect.

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

---------

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
2026-07-10 13:06:42 +03:00
Neo Zhang
120fc3729d fix unsupport ACC UT cases for noncontiguous (llama/25124)
* fix unsupport ACC UT cases for noncontiguous

* update ops.md
2026-07-10 13:06:42 +03:00
Neo Zhang
bfd86f4304 sycl : enhance argsort to support all UT cases (llama/25125) 2026-07-10 13:06:42 +03:00
Neo Zhang
f353a27988 sycl : use sycl func to fix AOT double type issue (llama/25081) 2026-07-10 13:06:42 +03:00
Neo Zhang
2c6e470ced sycl : rename the env vars from "disable" to "enable" (llama/25042) 2026-07-10 13:06:42 +03:00
An Long
753e101595 ggml : make ggml_time_init idempotent (llama/24422) 2026-07-10 13:06:42 +03:00
fairydreaming
bd5ce1ed48 vulkan : check src0 type in GGML_OP_SET_ROWS to avoid failures due to unimplemented f16 support (llama/25351)
* vulkan : check src0 type in GGML_OP_SET_ROWS to avoid failures due to unimplemented f16 support

* chore : get rid of else

---------

Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
2026-07-10 13:06:42 +03:00
Hongqiang Wang
3a1387caf8 opencl: general flash attention decode performance optimizations (llama/25366)
* opencl: vec flash-attention decode kernels for f16/q8_0/q4_0 KV

* opencl: improve non FA KQ mv kernels

* opencl: tweaks for multiquery FA

* opencl: some tweaks for FA q1 kernels

* opencl: FA with DK=DV=512 for gemma-4

* opencl: various fixes

* opencl: cleanup

* opencl: fix FA decode crash for DK=512 (gemma-4)

The DK=512 decode-only program does not create the f32_f16 prefill
kernel, so the compiled check in ensure_fa_variant never hit and
supports_op gave inconsistent answers for the same op. block_n is also
unset for DK=512 decode; guard it to avoid an out-of-range read at
dispatch.

* opencl: run DK=512 FA decode on CPU

DK=512 decode is bandwidth-bound and faster on the CPU than the GPU,
increasingly so with depth. Decline it in supports_op; prefill stays on the GPU.

* opencl: compile MQ_GQA=8 FA kernels in a minimal program

The full program compiled with -D MQ_GQA=8 runs the Adreno compiler out
of memory at DK>=256. Only the vec_mq kernels are used from this
program, so compile it with FA_MQ_ONLY, which excludes everything else.
Also include the program name in the compile error log.

* opencl: remove stray token in flash_attn_f32_f16.cl

A stray "." broke the f32_f16 program build.

* opencl: split f16-KV FA decode finer (FD_KV_PER_SPLIT_F16)

The 2048 default under-fills the GPU on single-query f16-KV decode;
use 512 for f16 KV to get more splits. Quantized KV keeps 2048.

---------

Co-authored-by: Li He <lih@qti.qualcomm.com>
2026-07-10 13:06:42 +03:00
Pascal
91ca310157 metal: add col2im_1d op (f32/f16/bf16) (llama/25176)
* metal: add col2im_1d op (f32/f16/bf16)

Gather kernel mirroring the CPU/CUDA path: each output (t_out, oc)
reads its ceil(K/s0) source columns with an F32 accumulator, a single
write and no atomics. One thread per output element, 256 per
threadgroup.

* metal: check dst contiguity and type match in supports_op for COL2IM_1D

Align the GGML_OP_COL2IM_1D predicate with the CPU, CUDA, and Vulkan
backends: the kernel writes dst with linear indexing and assumes the
same type as src0, so supports_op must also require a contiguous dst
and op->type == op->src[0]->type.

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

Co-authored-by: YiChen Lv <63285796+forforever73@users.noreply.github.com>

---------

Co-authored-by: YiChen Lv <63285796+forforever73@users.noreply.github.com>
2026-07-10 13:06:42 +03:00
Johannes Gäßler
3f05208e5c CUDA: remove -sm row, refactor cuBLAS (llama/24216)
* CUDA: remove -sm row, refactor cuBLAS

* fix CDNA + BF16 logic

* fix bad return

* fix src0 strides, contiguous requirements

* fix GGML_CUDA_FORCE_CUBLAS

* fix casts to BF16
2026-07-10 13:06:42 +03:00
Alexey Kopytko
82ac928a5d CUDA: extend K-type validation to V-types for flash attention (llama/24403)
* CUDA: extend K-type validation to V-types for flash attention

* reorder
2026-07-10 13:06:42 +03:00
ragz4125
7d8e64fe37 ggml-cpu: use UE4M3 LUT in ARM NVFP4 dot product (llama/25331) 2026-07-10 13:06:42 +03:00
shalinib-ibm
ce2c003f17 ggml-cpu: Enable tiled matmul on AIX (llama/25199)
The matmul_tiled path uses large local stack buffers for A_pack and B_pack. On AIX this can trigger a segmentation fault, so reduce the buffer footprint there to keep the tiled path usable.

 Performance Impact:
    ~ 2x gains in PP_Speed for FP32, Q4_0 and Q8_0 models tested with llama-bench, llama-batched-bench and llama-cli.
    Models used: Llama3.2 3b Instruct F32, qwen 2.5 3b Q4_0 and Q8_0
2026-07-10 13:06:42 +03:00
hokanosekai
2ec3883df0 vulkan: fix 32-bit integer overflow in CEIL_DIV (llama/25245) 2026-07-10 13:06:42 +03:00
a-huk
9fe449cbd0 ggml-hip: enable -ffast-math for HIP builds (llama/23862) 2026-07-10 13:06:42 +03:00
adavyas
ec6e0f2c29 ggml-cuda: optimize conv_transpose_1d indexing (llama/25310) 2026-07-10 13:06:42 +03:00
Eve
38c6260238 abort if we see a multi buffer (llama/25276) 2026-07-10 13:06:42 +03:00
liminfei-amd
f6f1252b05 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 <91481003+liminfei-amd@users.noreply.github.com>
2026-07-10 13:06:42 +03:00
Vexxie
1222c01f0e 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 <johannesg@5d6.de>

---------

Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
2026-07-10 13:06:42 +03:00
fairydreaming
93cff36f15 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 <sszymczy@gmail.com>
2026-07-10 13:06:42 +03:00
fairydreaming
0a58b4b546 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 <sszymczy@gmail.com>
2026-07-10 13:06:42 +03:00
Piotr Wilkin (ilintar)
b28289008c 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 <noreply@anthropic.com>

* Update tests/test-backend-ops.cpp

Co-authored-by: Oliver Simons <osimons@nvidia.com>

* Add comment for case 288 in topk-moe.cu

---------

Co-authored-by: Oliver Simons <osimons@nvidia.com>
2026-07-10 13:06:42 +03:00
Gaurav Garg
28ef70c68c 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
2026-07-10 13:06:42 +03:00
lhez
759197a754 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
2026-07-10 13:06:42 +03:00
Max Krasnyansky
cae089f4a1 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
2026-07-10 13:06:42 +03:00
Johannes Gäßler
388a1fc962 CUDA: consistent use of __restrict__ + PDL for FA (llama/25185) 2026-07-10 13:06:42 +03:00
ragz4125
dd1c9a552b ggml-cpu: add AVX2 optimization for nvfp4 dot product and use UE4M3 LUT (llama/23961) 2026-07-10 13:06:42 +03:00
lhez
9804f9736c opencl: initial q1_0 support (llama/25160)
* opencl: general q1_0 support

* opencl: add Adreno GEMM/GEMV for q1_0
2026-07-10 13:06:42 +03:00
fairydreaming
52302312e6 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 <sszymczy@gmail.com>
2026-07-10 13:06:42 +03:00
Matt Jallo
63285ff81f CUDA: fix get_rows_back for tables with more than 65535 rows (grid-y clamp + stride) (llama/25103) 2026-07-10 13:06:42 +03:00
Johannes Gäßler
2b35abc294 CUDA: fix Gemma E4B MTP FlashAttention (llama/25148)
* CUDA: fix Gemma E4B MTP FlashAttention

* remove unused template declaration
2026-07-10 13:06:42 +03:00
Kevin Liu
899c7ed4ac 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
2026-07-10 13:06:42 +03:00
zduford
2ea7a752af 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
2026-07-10 13:06:42 +03:00
Masashi Yoshimura
b313fd3ce8 ggml-webgpu: add support for NVFP4 (llama/25143) 2026-07-10 13:06:42 +03:00
Oliver Simons
7999638e04 Revert "sched : reintroduce less synchronizations during split compute (#20793)" (llama/25138) 2026-07-10 13:06:42 +03:00
Ruben Ortlam
ba36235565 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
2026-07-10 13:06:42 +03:00
Hongqiang Wang
5f51daf516 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 <lih@qti.qualcomm.com>
2026-07-10 13:06:42 +03:00
Gaurav Garg
868367609f 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
2026-07-10 13:06:42 +03:00
Neo Zhang
a4ac1c0369 sycl : fix failed ut cases of norm (llama/25044) 2026-07-10 13:06:42 +03:00
Ruben Ortlam
d54eb4fe2e vulkan: fix step operator for 0 input (llama/25036) 2026-07-10 13:06:42 +03:00
Andreas Kieslinger
e4234013e9 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 <ggerganov@gmail.com>

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

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* Apply suggestions from @johannesgaessler code review

Co-authored-by: Johannes Gäßler <johannesg@5d6.de>

* 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 <ggerganov@gmail.com>
Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
2026-07-10 13:06:42 +03:00
Ravi Panchumarthy
3e97b98452 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 <mostafas.main.email@gmail.com>
Co-authored-by: Xuejun <Xuejun.Zhai@intel.com>
2026-07-10 13:06:42 +03:00
nullname
c497d75e00 vulkan: opt mul_mat_vecq for mi50 (llama/22933) 2026-07-10 13:06:42 +03:00
Jiang, Fish
1c8ea5fb92 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 <jie.xia@intel.com>
Co-authored-by: Liu, Russell <russell.liu@intel.com>

* 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 <jie.xia@intel.com>
Co-authored-by: Liu, Russell <russell.liu@intel.com>
2026-07-10 13:06:42 +03:00
Lin Xiaodong
6fc7c33b4c 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.
2026-07-01 13:10:16 +02:00
Daniel Bevenius
167d225f3a 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
2026-07-01 09:04:21 +02:00
Lin Xiaodong
5cad7abb1e 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.
2026-07-01 08:23:50 +02:00
Lin Xiaodong
909307c8bd 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 <calm.lin@wukongsch.com>
2026-07-01 08:21:35 +02:00