SGEMM-cube:基于FP16 Cube单元在昇腾NPUs上实现精度可恢复的FP32 GEMM近似方案
SGEMM-cube: Precision-Recovery FP32 GEMM Approximation on Ascend NPUs with FP16 Matrix Engines
AI总结:
该研究针对昇腾NPUs缺乏高效FP32 GEMM支持的问题,提出SGEMM-cube方案,基于FP16 Cube单元实现FP32精度GEMM近似,在昇腾910A上精度优于原生FP16 GEMM且达65.3 TFLOP/s。
摘要:
现代AI加速器提供高吞吐量的低精度矩阵运算引擎,但往往缺乏对FP32 GEMM的高效支持。本文提出SGEMM-cube,这是一种基于FP16 Cube单元构建的、面向昇腾NPUs的FP32精度GEMM近似方案。遵循Ootomo和Yokota提出的定长双字拆分方法,每个FP32操作数由FP16高位分量和缩放后的FP16残差表示。乘积通过三个FP16 GEMM重构,同时省略残差-残差项;因此该方法以FP32级精度为目标,而非位精确仿真。在RN(舍入到最近)FP32累加模型下,我们进行分量级误差分析,结果显示省略的项不超过短FP32内积的舍入误差,且对于实际相关的内积长度,总误差由普通FP32累加主导。我们进一步分析残差下溢和舍入到最近转换下的缩放问题,比较两种累加顺序,并将感知L1分块和双缓冲适配到昇腾的软件管理内存层级。在昇腾910A上,SGEMM-cube的精度显著优于原生FP16 GEMM,在评估的输入分布和指数范围内,与测试的OpenBLAS FP32 SGEMM基线相当,且达到65.3 TFLOP/s,为三GEMM FP32等效峰值的77%。
英文摘要:
Modern AI accelerators provide high-throughput low-precision matrix engines, but often lack efficient support for FP32 GEMM. This paper presents SGEMM-cube, an FP32-accuracy GEMM approximation for Ascend NPUs built on FP16 Cube units. Following the fixed-length two-word splitting of Ootomo and Yokota, each FP32 operand is represented by an FP16 high component and a scaled FP16 residual. The product is reconstructed from three FP16 GEMMs while omitting the residual-residual term; the method therefore targets FP32-level accuracy rather than bit-exact emulation. Under an RN FP32-accumulation model, we provide a componentwise error analysis showing that the omitted term is no larger than the rounding error of a short FP32 inner product and that, for practically relevant inner-product lengths, the overall error is dominated by ordinary FP32 accumulation. We further analyze residual underflow and scaling under round-to-nearest conversion, compare two accumulation orders, and adapt L1-aware blocking and double buffering to Ascend's software-managed memory hierarchy. On Ascend 910A, SGEMM-cube is substantially more accurate than native FP16 GEMM, is comparable to the tested OpenBLAS FP32 SGEMM baseline for the evaluated input distributions and exponent range, and reaches 65.3\,TFLOP/s, or 77\% of the three-GEMM FP32-equivalent peak.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。