llama.cpp
75bfc7de - metal : keep the MUL_MAT weight scale off skipped MoE slots (#33430)

Commit
6 hours ago
metal : keep the MUL_MAT weight scale off skipped MoE slots (#33430) * metal : keep skipped MoE slots unscaled with a per-tensor scale kernel_mul_mat_scale reads the expert ids only when the weight scale is per-expert or per-channel-per-expert, so a per-tensor scale also scaled the slots of a skipped expert. The MoE matmul kernels zero those slots, which turns 0 * +inf into NaN and fails the MUL_MAT_ID scale_gran=3 tests. Always pass the ids for MUL_MAT_ID and separate the skip check from the per-expert scale offset. Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB) * metal : keep the matmul weight scale inside the matmul op The scale pass had to be chained by hand after ggml_metal_op_mul_mat and ggml_metal_op_mul_mat_id in the encoder switch, and the two cases dropped its return value on the way. Make it a private tail step of both ops, the same way kernel_mul_mm_id_map0 and kernel_mul_mm_id_zero belong to ggml_metal_op_mul_mat_id, and assert the invariant that made ignoring the fused result safe: a scaled matmul never fuses a following ADD. No functional change. Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB)
Author
Parents
Loading