Optimisation of Automatic Matrix Multiplication Mixing Accuracy Based on Polyhedral Models
Mixed precision is a numerical computation technique in computers that improves the efficiency of computation by con-verting some of the data types in the computation from high precision to low precision.Matrix multiplication has an important and wide application in computer science and mathematics,using mixed precision techniques in matrix multiplication to speed up the computational process is a challenging task.Existing mixed-precision optimisation suffers from several problems,such as high storage overhead,having to be implemented on specific hardware units,limiting the deployment options of models or algorithms and reducing their portability.In the face of the above problems,this paper proposes and implements an automatic mixed-precision code generation tool based on polyhedral models AGMMMPC.By adding the low-precision-by-high-precision-plus-basic-mixed-precision matrix multiplication code generation functionality to the source-source PPCG compiler,and using the precision tuning(PT)algorithm to find high-frequency errors in the basic mixed-precision computation.These points are processed by high preci-sion calculation method,while the rest are processed by the basic mixed precision calculation method,which effectively reduces the error in the basic mixed precision calculation,and realises the automatic generation of source-to-source mixed-precision code for matrix multiplication for the first time.Experiments show that the maximum acceleration ratio of the advanced mixed-preci-sion code generated by AGMMMPC is 1.39 and the geometric mean acceleration ratio is 1.14 on X86 platform with high-preci-sion computation as the benchmark.