llama.cpp b11266:Vulkan 后端优化 F32 矩阵加载
原标题:b11266
AI 摘要
llama.cpp 发布 b11266 版本,主要针对 Vulkan 后端优化:在 F32 A 矩阵 2 对齐时一次加载两个元素,并补上了 mul_mat_vec.comp 中 a_offset 的 2 对齐校验。作者指出 Intel 硬件不喜欢逐个加载 F32,而 [B]F16 在 Intel BMG 特定形状下一次加载 4 个反而更慢。在 B60 上的 test-backend-ops perf 显示多个 MUL_MAT 形状获得明显加速,例如 n=1 时从 153 GFLOPS 提升到 221 GFLOPS。
正文节选
<details open> vulkan : Load F32 A matrix 2 at a time when its 2-aligned (#29254) It turns out Intel doesn't particularly like loading F32s one at a time and we already have the _2aliagned load logic in mul_mat_vec, so here we use it. While we do already check all the requirements to load elements 4 at a time across [B]F16 and F32, it turns out [B]F16 loading 4 at a time is sometimes slower on very specific shapes on Intel BMG. Loading 4 at a time is a bit faster on F32, but its not material