/*************************************** Auteur : Pierre Aubert Mail : aubertp7@gmail.com Licence : CeCILL-C ****************************************/ #include "phoenix_intrinsics.h" #include #include "sgemm_intrinsics.h" ///Compute the Matrix-Matrix product of the x,y matrices /** @param[out] matOut : result * @param matX : left matrix * @param matY : right matrix * @param size : size of the square matrices */ void sgemm_intrinsics(float* matOut, const float* matX, const float* matY, long unsigned int size){ memset(matOut, 0, sizeof(float)*size*size); long unsigned int vecSize(PLIB_VECTOR_SIZE_FLOAT); long unsigned int nbVec(size/vecSize); for(long unsigned int i(0lu); i < size; ++i){ //Iterate over X rows const float * rowX = matX + i*size; //Get current X row float * rowOut = matOut + i*size; //Get current out row for(long unsigned int k(0lu); k < size; ++k){ //Part of dot product PRegVecf regX = plib_broadcast_ss(rowX[k]); const float* rowY = matY + k*size; //Get current Y row for(long unsigned int j(0lu); j < nbVec; ++j){ PRegVecf regY = plib_load_ps(rowY + vecSize*j); PRegVecf regRes = plib_load_ps(rowOut + vecSize*j); regRes = plib_add_ps(regRes, plib_mul_ps(regX, regY)); plib_store_ps(rowOut + vecSize*j, regRes); } } } }