Optimizing matrix multiply using PHiPAC: a portable, high-performance, ANSI C coding methodology
Modern microprocessors can achieve high performance on linear algebra kernels but this currently requires extensive machinoapeci6c hand tuning. We have developed a methodology whereby near-peak performance on a wide range of systems can be achieved automatically for such routines. First, by analyzing current machines and C compilers, we’ve developed guidelines for writing Portable, High-Performance, ANSI C (PHiPAC, pre nounced Weopack”). Second, rather than code by hand, we produce parameterized code generators. Third, we write search scripts that find the best parameters for a given system. We report on a BLAS GEMM compatible multi-level cache-blocked matrix multiply generator which produces code that achieves around 90% of peak on the Sparcstation-20/61, IBM RS/6000-590, HP 712/8Oi, SGI Power Challenge RBk, and SGI Octane RlOk, and over 80% of peak on the SGI Indigo R4k. The resulting routines are competitive with vendoroptimized BLAS GEMMs. l CS Divirion, University of California at Berkeley and the International Computer Science Inatitute. The author ncknowledgea the support of JSBP contract F49620-94COOSS. ‘CS Divirion, University of California at Berkeley and the International Computer Science Inrtitute. The author acknowledger the support of ONR UBJ Grant NOO01492-J-1617. ‘CS Divirion, Univenity of California at Berkeley. The author acknowledgea the rupport of ARPA contract DAALOSQIC-0047 (University of ‘Ibnneaaee Subcontract OBA4466.02). tCS Division and Mathematia Dept., University of California at Berkeley. The author acknowledger the rupport of ARPA contract DAAL0991-C-0047 (Univenity of Tenneaaee Subcontract OBA4466.02). ARPA contract DAAH04961-0077 (University of Tennea&Subcontract OB.A7463.02), DOE grant‘ DE PG0394ER26219, DOE contract W-31-109-Eng-33, NSF grant ASC-QSlSQSS, and DOE grant DEFG03-94ER26206. Permission to make digitahbard copies of all or pntt of this material for personal or classrocm use is mted without fee pmvided that the copies are not made or distributed for profit or commercial advantage, the copy right notice. the title ofthe publication and its date appear. and notice is given that copyigbht is by petmission of the ACM, Inc. To copy otherwise. to republish. to post on servers or to r&tribute to lists. requires specific permission and/or fee ICY 97 Vienna Austria Copyright 1997 ACM O-8979l-902-5/97ff..SB.50