AISpot

llama.cpp 最佳化 GDN 卷積狀態寫入,每 token 裝置複製減半

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

llama.cpp 合併補丁 b12086:build_conv_state_at 改為直接寫入卷積輸入尾部,不再先做連續複製,使每個 GDN 層每生成一個 token 的裝置複製從兩次降為一次。在含 36 個 GDN 層的 Qwen3.8-Flash-Next 上,每 token 複製數由 72 次降至 36 次;投機解碼回滾時也會少一次複製。

原標題:b12086
閱讀原文

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

原文

qwen4exp: write the conv state tail without an intermediate cont ( #31443 ) build_conv_state_at makes a contiguous copy of the conv input tail before writing it into the recurrent state, so every GDN layer issues two device copies per generated token where one is enough. On Qwen3.8-Flash-Next (36 GDN layers) that is 72 copies per token, now 36. Speculative decoding adds one more per rollback slot. ggml_cpy reads the strided view directly, as the shared build_conv_state already does, so the extra copy is dropped. Website: https://llama.app Attestations: https://github.com/ggml-org/llama.cpp/attestations/63360154 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 評分56

llama.cpp CUDA 後端融合 FFN gate/up 矩陣乘與 GLU

llama.cpp 的 CUDA 後端把稠密 FFN 的 gate 與 up 兩次矩陣乘合併為一次 mul_mat_q 呼叫,並在寫回階段直接計算 GLU,主要加速 prompt 處理。權重按每 8 行交錯裝載,使每個執行緒同時持有 up 值與對應的 gate 值,MMA 迴圈、warp 佈局與 vec_dot 保持原樣,寫回只輸出一半行。

llama.cpp releasesAI 評分42

llama.cpp 修復 Gemma 4 重複存放 token_embd 表,純 CPU 載入省下 216 MiB

llama.cpp 發布 b12008,修復 Gemma 3n 與 Gemma 4 中 token_embd 表被重複存放的問題:改為先建立 token_embd,再建立與它繫結的輸出層。此前當輸入與輸出共用同一種緩衝型別,也就是純 CPU、-ngl 0 執行時,同一張表會被存兩份。實測 gemma-4-E2B-it Q4_K_M 在關閉 mmap 的情況下,CPU 模型緩衝從 3163.73 MiB 降至 2947.73 MiB,省約 216 MiB。

llama.cpp releasesAI 評分45

llama.cpp 新增 ggml 批次張量複製 API,並支援 CUDA

llama.cpp 建置 b12002 為 ggml 加入通用批次張量複製 API,並把 llama 的 context io 改為按批次執行裝置張量複製。新 API 已獲 CUDA 後端支援,會按緩衝區型別分組排程,同時移除了舊的非同步 tensor_n 介面並補上空緩衝區鉤子,還修復了二維批次張量的識別問題。測試方面,test-backend-tensor 經過重構,用 mock 緩衝區型別驗證鉤子呼叫、逐張量回退,以及 cpy_tensor_n 的全有全無語義。

llama.cpp releasesAI 評分43

llama.cpp 修復 ggml conv_1d 批次輸入轉置錯誤

llama.cpp 修復了 ggml conv_1d 在批次輸入下輸出通道與批次維度錯位的問題。conv_1d 背後的 GEMM 把 batch 折進行,結果在記憶體中是 [OL, N, OC],reshape 卻宣告為 [OL, OC, N],形狀正確但內容被轉置,因此不報錯、通道與批次交錯;N==1 時兩種讀法等價,倉庫裡三個 vocoder 都沒觸發。