计算机科学 > 数学软件
[提交于 2026年11月28日]
标题:Fast matrix multiplication: mixing fast, accurate schemes over a vendor GEMM, chosen by a calibrated planner
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:Fast matrix multiplication is in practice a few levels of a Strassen-like scheme over a vendor's General Matrix Multiplication (GEMM) routine. We treat each scheme as an operator that takes a problem one level down, and let every level of a plan use a different one. On Apple's M4 Pro, over Accelerate's GEMM, a calibrated planner chooses among accurate forms of the $\langle 2\times2\times2:7\rangle$, $\langle 4\times4\times4:48\rangle$ and $\langle 3\times3\times6:40\rangle$ schemes. A level runs as three fused passes over memory, so its cost is the blocks it moves, not its arithmetic. At $n=13824$ the plans run $1.71\times$ (f32) and $1.88\times$ (f64) faster than Accelerate's GEMM with 0.38 and 0.50 of its error on well-scaled inputs. At 6912 and 13824 they are 5-16% faster than the best plans built from the $\langle 4\times4\times4:48\rangle$ scheme alone, with 0.57-0.75 of their error. The planner's error model predicts a plan's error from where its levels sit (a level's own rounding is multiplied by the levels above it), and the planner uses it to choose between plans of equal speed. A conventional implementation of Strassen-Winograd (one block operation at a time), the algorithm of IBM ESSL's _GEMMS, over the same GEMM is 1.21-1.54 times slower than the plans and has 1.9-9.7 times their error; fused $2\times2$ levels, which the library also has, are level with the $4\times4$ scheme at half the depth. On badly scaled inputs the plans need exact power-of-two prescaling, at up to 4% of the time, and inputs whose magnitudes cross between blocks defeat them. In f32, sharing a level's products with the GPU brings the speedup over Accelerate to $3.1\times$.
提交历史
来自:Greg Sidebottom[v1] 2026年11月28日 星期六 03:42:54 UTC (72 KB)