AISpot

llama.cpp 將 ggml-cpu 的 concat 重寫為單一 row kernel,覆蓋全部型別

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

llama.cpp 建置 b11906 把 ggml-cpu 的 concat 重寫為單個按行執行的 kernel,所有型別共用一套實現,量化型別也包含在內:稠密源行只需一次 memcpy,轉置源則按元素逐個複製,元素大小在編譯期已知。行不再只沿 i2 維度切分(該維度常為 1),而是按 32 行一組分塊分給多執行緒;遇到轉置源時在外層迴圈遍歷元素,讓同一 tile 的各行讀取相鄰地址。

原標題:b11906
閱讀原文

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

原文

ggml-cpu : rewrite concat as one row kernel for all types ( #31179 ) Every dst row comes from src0 or src1, or for dim 0 from the row of src0 followed by the row of src1, so a single kernel covers every type: a dense source row is one memcpy, quantized types included, and a strided source is copied element by element with the element size known at compile time. Rows are split across threads instead of i2 alone, which is often 1, and are copied in tiles of 32: for a transposed source the elements are walked in the outer loop, so the rows of a tile read neighboring addresses instead of jumping a full row stride per element. Add transposed b cases to test_concat, the layout of the delta-net conv input, and a perf case for it. Website: https://llama.app Attestations: https://github.com/ggml-org/llama.cpp/attestations/60075257 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 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 評分45

llama.cpp 修復 ggml-cpu 多執行緒 SET_ROWS 越界寫

llama.cpp 修復了 ggml-cpu 後端 SET_ROWS 運算元的多執行緒越界寫入問題:該運算元按 n_tasks=1 規劃,但每個執行緒都會執行並各自佔用 F16→F32 轉換緩衝區的一行,當計算圖中還有別的多執行緒運算元時,編號大於 0 的執行緒就會寫到工作緩衝區之外;修復方式是把 set_rows 併入 n_task=n_threads 的執行緒組。

llama.cpp releasesAI 評分46

llama.cpp 修復 ggml CLAMP 非連續檢視定址錯誤

ggml 修復了 CLAMP 運算元在非連續檢視上的定址錯誤,涉及 CPU 與 CUDA 後端。CUDA 此前按 ggml_nelements 做平坦處理、忽略檢視 stride,CPU 則把第 j 行按 j*nb01 定址、忽略 nb02/nb03;現在兩者都改為遵循 dims 1..3 的 stride,且 CUDA 的 supports_op 要求行連續,與 Metal 一致。

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 保持原樣,寫回只輸出一半行。