修复了一个 llama.cpp 的错误,该错误在所有 32 位 ARM 设备上悄无声息地禁用了 Vulkan GPU。

2作者: perinban4 个月前
我在三星 Galaxy Watch 4 Classic (armeabi-v7a, Mali G68) 上运行 llama.cpp 时,注意到 Vulkan 后端拒绝了每一个量化的 MUL_MAT 操作,尽管它报告“33/33 层已卸载到 GPU”。 根本原因:在 llama-model-loader.cpp 的 create_tensor() 中,张量步幅计算中缺少了块大小除法。错误的步幅导致 ggml_nbytes() 溢出,在 32 位系统上超过了 max_buffer_size,因为 size_t 是 32 位的。 在 64 位设备上,溢出被静默屏蔽——数值错误但仍在 GPU 内存限制内,所以没有人注意到。这个 bug 可能已经存在多年了。 修复和上下文:https://github.com/Perinban/llama.cpp/tree/axon-dev
查看原文
While running llama.cpp on a Samsung Galaxy Watch 4 Classic (armeabi-v7a, Mali G68), I noticed the Vulkan backend was rejecting every quantized MUL_MAT operation despite reporting &quot;33&#x2F;33 layers offloaded to GPU&quot;.<p>Root cause: a missing block size division in tensor stride calculation inside create_tensor() in llama-model-loader.cpp. The wrong stride cascades into ggml_nbytes() overflow, exceeding max_buffer_size on 32-bit where size_t is 32-bit.<p>On 64-bit devices the overflow is silently masked — wrong value but still within GPU memory limits so nobody noticed. Bug has likely been there for years.<p>Fix and context: https:&#x2F;&#x2F;github.com&#x2F;Perinban&#x2F;llama.cpp&#x2F;tree&#x2F;axon-dev