llama.cpp 修復 Metal 後端複製到非連續目標視訊記憶體越界寫入
llama.cpp 的 b12076 版本修復了 Metal 後端 cpy kernel 在目標張量第 0 維非連續時的定址錯誤:原先 kernel_cpy_t_t 用隱式元素大小步長索引目標最內層維,未使用 args.nb0,導致寫入 permute 後的檢視時地址算錯。該問題由 #31446 新增的 test-backend-ops cpy 用例(permute_dst = {1, 0, 2, 3})發現;當目標在第 0 維連續時定址不變。
原標題:b12076
閱讀原文
| 評分 | 40 / 42(平均 41,門檻 60) |
| 狀態 | 未入選 |
|---|
原文
metal : fix cpy kernel for dst non-contiguous in dim 0 ( #31581 )
kernel_cpy_t_t indexed the dst innermost dim with an implicit element-size
stride instead of args.nb0, so cpy into a permuted view (nb0 != type size)
wrote the wrong addresses. caught by the new test-backend-ops cpy case with
permute_dst = {1, 0, 2, 3} from #31446 . addressing is unchanged when dst is
contiguous in dim 0.
Assisted-by: dsh:llama.cpp/ggml-org/GLM-5.3-Flash-GGUF (Mac Studio, M5 Ultra, 256GB)
Website:
https://llama.app
Attestations:
https://github.com/ggml-org/llama.cpp/attestations/63216604
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 評分48
llama.cpp 發布 b11575 建置,修復 Metal 後端在大張量上 kernel_mul_mm 核心報錯的問題,改動位於 ggml/src/ggml-metal/kernels/mul_mm.metal。該修復由 Codex 輔助完成,影響在 Apple Silicon 上通過 Metal 做推理的使用者。
llama.cpp releasesAI 評分41
llama.cpp 建置版本 b11895 修復了 Metal 後端在大型矩陣輸出偏移時出現的整數溢位,同時加寬了 batch 偏移與 MUL_MAT_ID 的 token 索引。改動由 Codex 輔助完成,屬於影響大模型在 Apple Silicon 上推理正確性的底層修復,本次建置仍按慣例提供 macOS、Linux、Windows、Android 等多平台二進位制包。
llama.cpp releasesAI 評分52
llama.cpp 建置版本 b11569 修復了 Metal 後端 mul_mat_id 在 id 重複時輸出錯誤、丟行乃至溢位到下一個 expert 切片的問題。新實現先做一遍預掃描,為每個 expert 建立緊湊的 (token, slot) 條目列表,並借鑑 Vulkan 方案讓 map0 額外輸出 tile 描述符,kernel_mul_mm_id 按描述符處理單個 tile,重複 id 由此被隱式處理。
llama.cpp releasesAI 評分44
llama.cpp 建置 b11972 修復了兩個可能導致越界寫入的缺陷。common 部分讀取控制向量時,方向張量的層索引此前沒有上界,超大索引會讓以 int 計算的緩衝區大小和寫偏移溢位,從而寫到緩衝區之前;現在改為傳入模型層數、拒絕超限索引,並用 size_t 計算。
llama.cpp releasesAI 評分40
llama.cpp 發布建置 b11693,核心改動是修復 SYCL 後端在 mul_mat、split buffer 和 host pool 中的記憶體錯誤(PR #29889)。該版本同時更新了預編譯產物清單,覆蓋 macOS/iOS、Linux、Windows、Android,包含 CUDA 12/13、Vulkan、ROCm 10.0、OpenVINO 以及 SYCL FP32/FP16 等後端。