AISpot
所屬事件:llama.cpp 統一 KV 快取改用 kv_rows 切片並修復零行(1 個來源 · 2 則報導)

2026 年 11 月 2 日至 3 日,llama.cpp 合併兩項統一 KV 快取改動。11 月 2 日的 b12059 合併 #29510,把多序列統一 KV 快取從稠密 KQ mask 改為 kv_rows 切片,以提升 flash attention 效率:每個序列維護一份 cell 點陣圖,按置位順序生成… 看完整事件

llama.cpp 多序列統一 KV 快取改用 kv_rows 切片

llama.cpp releases版本更新地端推論開源開發工具

llama.cpp 合併 #29510,多序列共享的統一 KV 快取改用 kv_rows 切片,取代稠密的 KQ mask,以提升 flash attention 的效率。每個序列維護一份 cell 點陣圖,按置位順序生成 cell 列表,並在 seq_pos_inc/dec 時增量更新,刪除 cell 時不必重建;被 SWA 對所有 token 隱藏的 cell 會從列表中剔除。

統一 KV 快取不再回退到稠密 KQ mask,多序列併發(如多槽位草稿)在 llama.cpp 本地推理中可直接受益,且改動已隨 macOS、Linux、Windows、Android 各平台建置發布。

原標題:b12059
閱讀原文

同一事件共有 2 則報導(1 個來源),看事件全貌

評分50 / 55(平均 52,門檻 60)
狀態未入選

原文

llama : flash_attn_ext_rows - more efficient unified kv for multi-seq ( #29510 ) llama : use llm_attn_mask and kv_rows for unified attention Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4-Flash-Vision-Exp-GGUF (Mac Studio, M2 Ultra, 192GB) Co-authored-by: Georgi Gerganov [email protected] cont : optimize get_seq_cells llama : build the kv_rows lists from per-sequence cell bitmaps Keep a bitmap over the cells for each sequence (the transpose of seq ), updated in seq_pos_inc/dec, and build the cell lists by walking its set bits. The lists stay in cell order, cells shared by several sequences go to every list, and nothing has to be rebuilt when cells are removed. Also leave out of the lists the cells that the SWA hides from every token of the slice (standard and chunked SWA). cont : make get_kv_rows_p_min private cont : minor metal llama : use kv_rows for every ubatch of a unified cache A ubatch made of equal-length runs with a single sequence each (f.ex. the drafts of several slots) now splits into per-sequence slices. Any other ubatch (interleaved, uneven or coupled sequences) becomes a single slice over the cells of all its sequences instead of falling back to the dense KQ mask, so the graph keeps the topology of the reserved graph. llama : merge get_kv_rows_seq_ids and get_kv_rows_p_min into get_kv_rows_slices Assisted-by: dsh:llama.cpp/ggml-org/GLM-5.3-Flash-GGUF (Mac Studio, M5 Ultra, 256GB) Co-authored-by: Georgi Gerganov [email protected] Website: https://llama.app Attestations: https://github.com/ggml-org/llama.cpp/attestations/62864128 macOS/iOS: macOS Apple Silicon (arm64) macOS Apple Silicon (arm64, KleidiAI enabled) DISABLED macOS Intel (x64) iOS XCFramework Linux: Ubuntu x64 (CPU) Ubuntu arm64 (CPU) Ubuntu s390x (CPU) Ubuntu 26.04 s390x (CPU) Ubuntu 26.04 s390x (zDNN) Ubuntu x64 (Vulkan) Ubuntu arm64 (Vulkan) Ubuntu x64 (CUDA 12) - CUDA 12.8 libraries Ubuntu x64 (CUDA 13) - CUDA 13.4 libraries Ubuntu arm64 (CUDA 13) - CUDA 13.4 libraries Ubuntu x64 (ROCm 10.0) Ubuntu x64 (OpenVINO) Ubuntu x64 (SYCL FP32) Ubuntu x64 (SYCL FP16) Linux arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU) - setup guide Android: Android arm64 (CPU) Android arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU) - setup guide Windows: Windows x64 (CPU) Windows arm64 (CPU) Windows arm64 (OpenCL Adreno) Windows x64 (CUDA 12) - CUDA 12.4 DLLs Windows x64 (CUDA 13) - CUDA 13.4 DLLs Windows arm64 (CUDA 13) - CUDA 13.4 DLLs Windows x64 (Vulkan) Windows arm64 (Vulkan) Windows x64 (OpenVINO) Windows x64 (SYCL) Windows x64 (ROCm 10.0) openEuler: DISABLED openEuler x86 (310p) openEuler x86 (910b, ACL Graph) openEuler aarch64 (310p) openEuler aarch64 (910b, ACL Graph) UI: UI

相關報導

llama.cpp releasesAI 評分36

llama.cpp 重構稀疏注意力 K 池選擇,與 kq_mask 形狀解耦

llama.cpp 讓 qwen4exp (QSA) 與 glm5-next 的稀疏注意力選擇不再跟隨 kq_mask 的形狀,改為在 KV cache 單元上按 [n_kv, n_tokens] 建置,到 attention 前才拆成 K 檢視的流。這樣 dense mask 可以自行改變佈局(例如按序列的行列表),不必改動稀疏層。同時刪掉了 build_fused_top_k_mask 中未使用的引數。

llama.cpp releases● 精選AI 評分66

llama.cpp SYCL 新增量化 KV 快取的 DPAS flash attention 核心

llama.cpp 的 SYCL 後端新增 DPAS flash attention 核心,解碼與小批次(1 到 31 個 query token)可直接在 q4_0、q8_0 的 KV 塊上執行,不必做標量反量化或每次呼叫都把整個快取轉成 f16。Q.K 在 XMX 上使用 s8×s4 與 s8×s8 DPAS,V.P 仍保持 f16;覆蓋 head size 64 到 512、最多 32 的 GQA 與 attention sinks,prompt 階段仍走原有核心。

llama.cpp releases● 精選AI 評分68

llama.cpp Hexagon 的 flash_attn 改為按 KV 頭切分

llama.cpp 的 Hexagon 後端在 row-split 多核模式下把 flash_attn 從按 Q token 切分改為按 KV head 切分,讓每個核心只讀自己負責的那部分 KV cache,不再重複讀取全部 KV cache。該行為由 GGML_HEXAGON_FA_HEAD_SPLIT 控制,預設開啟;當 n_kv_heads 不能被核心數整除時回退到原 token-block 切分(如 4 核上只有 2 個 KV head 的 Gemma-4)。