koboldcpp/ggml/include
Aman Gupta d454a204ef
llama: create new fused op for QSA mask (#30640)
* llama: create new fused op for QSA scoring

* enroll glm5.3-next too

* tests : initialize the remaining tensors in test_kpool_mask

The harness sentinels were left uninitialized, so leftover memory could read as NaN and fail the NaN check.

* ggml: generalize the k-pool mask op into ggml_top_k_mask

The k-pool mask op only covered the pooled QSA selection of qwen4exp
and glm5-next, while the DSA models and the DeepSeek V4 CSA build the
same top-k mask by hand with fill, set_rows and add.

ggml_top_k_mask(mask, top_k, score, blocks, extra) keeps the mask
cells of the live picks and the extra cells, and sets the rest to
-inf. Every row tensor is 4D in the layout of top_k, and the mask is
broadcast to those rows, so a selection can also be made per head.
score, blocks and extra are optional: without score every pick is
live, without blocks a pick is a cell, and extra holds the cells a
row keeps without a pick.

llm_graph_context::build_fused_top_k_mask views the row tensors in
the layout of kq_mask and registers the fused node. The k-pool
models, the DSA attention of build_attn and the DeepSeek V4 CSA mask
use it when the probe enables the op, and keep their current path on
backends without it.

---------

Co-authored-by: Pascal <admin@serveurperso.com>
2026-10-22 01:02:22 +08:00
..
ggml-alloc.h ggml : add alloc_buffer_n to buffer type interface (#23671) 2026-10-02 11:08:08 +03:00
ggml-backend.h llama : report compute graph reallocations during inference (#30329) 2026-10-12 11:53:58 +03:00
ggml-blas.h ggml : build backends as libraries (#10256) 2024-11-14 18:04:35 +01:00
ggml-cann.h docs : Minor cleanups (#19252) 2026-02-02 08:38:55 +02:00
ggml-cpp.h ggml : fix ggml_gallocr_ptr type (ggml/1205) 2025-05-01 09:58:44 +03:00
ggml-cpu.h kleidiai: Add SME vs SME2 distinction in kernel dispatch (#25478) 2026-07-16 08:57:04 -07:00
ggml-cuda.h CUDA: remove -sm row, refactor cuBLAS (#24216) 2026-07-06 20:04:53 +02:00
ggml-et.h ggml-et: Initial ET backend (#24179) 2026-07-10 12:38:34 +08:00
ggml-hexagon.h Add experimental ggml-hexagon backend for the Hexagon NPU (#16547) 2025-10-22 13:47:09 -07:00
ggml-metal.h metal : refactor + optimize v2 (#15995) 2025-09-17 20:38:12 +03:00
ggml-opencl.h Introducing experimental OpenCL backend with support for Qualcomm Adreno GPUs (#10693) 2024-12-13 12:23:52 -08:00
ggml-openvino.h ggml : add OpenVINO backend (#15307) 2026-03-14 07:56:55 +02:00
ggml-opt.h chore : correct typos [no ci] (#20041) 2026-03-05 08:50:21 +01:00
ggml-rpc.h llama: create new fused op for QSA mask (#30640) 2026-10-22 01:02:22 +08:00
ggml-sycl.h sycl : fix compile warnings 2026-09-23 11:47:24 +03:00
ggml-virtgpu.h ggml-virtgpu: make the code thread safe (#19204) 2026-02-04 10:46:18 +08:00
ggml-vulkan.h vulkan: Make Vulkan optional at runtime (#11493). (#11494) 2025-02-10 07:17:21 +01:00
ggml-webgpu.h ggml: Add initial WebGPU backend (#14521) 2025-07-16 18:18:51 +03:00
ggml-zdnn.h ci: add zdnn backend build but not test (#29541) 2026-09-29 20:45:14 +03:00
ggml-zendnn.h ggml-zendnn : add ZenDNN backend for AMD CPUs (#17690) 2025-12-07 00:13:33 +08:00
ggml.h llama: create new fused op for QSA mask (#30640) 2026-10-22 01:02:22 +08:00
gguf.h gguf : add tensor shape accessor (#24405) 2026-07-13 13:55:15 +03:00