llama.cpp b11475 修复 Metal 后端 MUL_MAT+ADD 融合 bug
原标题:b11475
AI 摘要
llama.cpp 发布 b11475 版本,修复了 Metal 后端中 MUL_MAT+ADD 融合的一个 bug:当残差本身也是 MUL_MAT 时,融合逻辑会错误地选取未写入的输出缓冲区。该问题导致 Clef 决策模型在 Metal 上概率输出趋于均匀(如 billing 概率 0.28,而 CPU 后端为 0.977),且与量化无关。修复方式是在编码器中按身份选择操作数,并新增 MUL_MAT_ADD 测试模式,修复前 Metal 上 28 个用例中有 27 个失败。
正文节选
<details open> metal : fix MUL_MAT+ADD fusion when the residual is itself a MUL_MAT (#30100) * metal : fix MUL_MAT+ADD fusion when the residual is itself a MUL_MAT ggml_metal_op_mul_mat_mma picks the residual of a fused MUL_MAT+ADD as "the ADD operand whose op is not MUL_MAT". When both operands of the ADD are mat-mul outputs (x = W1 @ u + W2 @ v), that test is true for both, so the residual resolves to the fused mat-mul's own, never-written output and the kernel adds whatever that buffer hol