AISpot

llama.cpp 修復 Hexagon IM2COL DMA 環形佇列溢位

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

llama.cpp 建置 b11516 修復了 Hexagon NPU 上 IM2COL patch-embed 的 DMA 環形佇列溢位問題:當 IC*KH 超過 255 時,每執行緒 256 項的 DMA 環寫滿後新描述符被靜默丟棄,導致 VTCM 暫存緩衝的剩餘行未寫入,陳舊資料(常為 NaN/inf)汙染輸出。修復方式是在環滿時淘汰最舊描述符並呼叫 dma_queue_flush() 等待,與同檔案 blocked kernel 的做法一致。

原標題:b11516
閱讀原文

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

原文

hexagon: fix IM2COL patch-embed DMA ring overflow ( #30189 ) hexagon: fix IM2COL patch-embed DMA ring overflow The exact-tiling (stride == kernel, no pad/dilation) IM2COL DMA kernel issues IC KH DDR->VTCM descriptors per output row without checking the return value of dma_queue_push(), and then pops IC KH times. The per-thread DMA ring holds 256 entries and a push into a full ring returns false and drops the transfer, so for IC*KH > 255 the remaining rows of the VTCM staging buffer were never written and stale data (often NaN/inf) leaked into the output. Solution is to retire the oldest descriptor when the ring is full, just as the blocked kernel in the same file already does, and wait with dma_queue_flush(). For testing, added exact-tiling test cases with IC*KH > 256 (2D 1x1, 2D 2x2 patch embed and 1D, F16 and F32 dst), which fail on HTP without this fix. Apply suggestion from @max-krasnyansky Co-authored-by: Max Krasnyansky [email protected] Website: https://llama.app Attestations: https://github.com/ggml-org/llama.cpp/attestations/54222989 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 評分48

llama.cpp b11560 為 Hexagon NPU 新增 IM2COL_3D 支援

llama.cpp 建置 b11560 為 Hexagon NPU 後端新增 IM2COL_3D 支援,並把 hex-im2col 核心重寫為規範的 DMA 雙緩衝流水線,去掉除法運算與低效的 fp16 轉換,同時將 kernel_params 與 VTCM 佈局預計算移到 host 側、支援非連續檢視。該系列提交由 OpenCode 輔助完成,共同作者為高通的 Max Krasnyansky。

llama.cpp releasesAI 評分45

llama.cpp Hexagon 後端為二進位制運算元擴充套件標量 DMA 廣播支援

llama.cpp 發布 b11580 建置,Hexagon 後端為二進位制運算元擴充套件了標量 DMA 廣播支援,並刪除全部非 DMA 路徑,同時新增對非連續 stride 的處理。REPEAT 與 COMPLEX 核心這次也改用 DMA,hex-add-id 為 src2 索引加法補上 DMA;hex-geglu-erf 新增僅 F32 的門控,該運算元不支援 F16。

llama.cpp releasesAI 評分43

llama.cpp 更新 Hexagon 後端,預設動態緩衝升至 512MB

llama.cpp b11490 把 Hexagon 後端的預設動態緩衝從 128MB 提升到 512MB,原因是 128MB 在大 MoE 模型上會導致效能退化。hex-bufs 新增 alloc_buffer_n 支援,並可將大張量拆分到獨立緩衝區;環境變數 GGML_HEXAGON_MBUF 改為接受 dyn、static、total 三個值。hex-run 還新增 --no-embd-offload 選項,用於簡化需要該設定的裝置上的命令列。

llama.cpp releasesAI 評分43

llama.cpp b11574 最佳化 Hexagon NPU 複製與拼接運算元

llama.cpp 發布 b11574 建置,重點最佳化 Hexagon NPU 後端的 CPY/CONCAT 與 gather-rows 運算元:按 DMA 描述符分塊搬執行、加入雙緩衝與迴圈展開,緩解短行場景受 DMA 延遲拖累的問題,並支援 3/4 維維度摺疊。該版本還把 mdev 下 vtcm_acquire 的同步狀態全部改為原子操作,修復多裝置配置中的隨機卡死,並新增只建置/安裝 Hexagon 後端的選項。