how-to-optimize-gemm
how-to-optimize-gemm copied to clipboard
MMult_4x4_13.c incorrect if clause
In MMult_4x4_13.c
for ( j=0; j<n; j+=4 ){ /* Loop over the columns of C, unrolled by 4 */
for ( i=0; i<m; i+=4 ){ /* Loop over the rows of C */
/* Update C( i,j ), C( i,j+1 ), C( i,j+2 ), and C( i,j+3 ) in
one routine (four inner products) */
if ( j == 0 ) PackMatrixA( k, &A( i, 0 ), lda, &packedA[ i*k ] );
AddDot4x4( k, &packedA[ i*k ], 4, &B( 0,j ), ldb, &C( i,j ), ldc );
}
}
I don't think this if ( j == 0 ) clause is correct, because the PackMatrixA function receives the i variable as an argument.
If this line is correct, could someone explain me why?