Fixing bench overflow in GFLOPS computation

Fixing a bug in some bench applications where GFLOPS computation ran into integer overflows because explicit type casting to double was not done in the computation

removing all multiplies by 1.0 during GFLOP computation

AMD-Internal: CPUPL-7016

---------
Co-authored-by: Rayan <rohrayan@amd.com>
This commit is contained in:
Rayan, Rohan
2025-08-01 11:08:53 +05:30
committed by GitHub
parent a26f0a93f9
commit 1bb1160061
17 changed files with 23 additions and 19 deletions

View File

@@ -217,7 +217,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 1.0 * n ) / dtime_save / 1.0e9;
gflops = (double)n / ( dtime_save * 1.0e9 );
if ( bli_obj_is_complex( &x ) ) gflops *= 2.0;
#ifdef PRINT

View File

@@ -202,7 +202,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = n / ( dtime_save * 1.0e9 );
gflops = (double)n / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 2.0;
printf( "data_asumv_%s", BLAS );

View File

@@ -243,7 +243,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 3.0 * n ) / ( dtime_save * 1.0e9 );
gflops = ( 3.0 * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;
printf( "data_axpbyv_%s", BLAS );

View File

@@ -236,7 +236,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 3.0 * n ) / ( dtime_save * 1.0e9 );
gflops = ( 3.0 * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;
printf( "data_axpyv_%s", BLAS );

View File

@@ -241,8 +241,8 @@ int main( int argc, char** argv )
exit(1);
#endif
gflops = (n * 1) / (dtime_save * 1.0e9);
if(bli_is_complex(dt)) gflops *= 2;
gflops = (double)n / (dtime_save * 1.0e9);
if(bli_is_complex(dt)) gflops *= 2.0;
printf( "data_copyv_%s", BLAS );

View File

@@ -325,7 +325,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 2.0 * n ) / ( dtime_save * 1.0e9 );
gflops = ( 2.0 * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;
printf( "data_dotv_%s", BLAS );

View File

@@ -470,7 +470,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 2.0 * m * k * n ) / ( dtime_save * 1.0e9 );
gflops = ( 2.0 * (double)m * (double)k * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;

View File

@@ -962,7 +962,7 @@ int main( int argc, char** argv )
#endif
}
gflops = ( 2.0 * m * k * n ) / ( dtime_save * 1.0e9 );
gflops = ( 2.0 * (double)m * (double)k * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;

View File

@@ -453,7 +453,9 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( n * k * n ) / ( dtime_save * 1.0e9 );
// if n * k * n is not explicitly type cast, then there are cases where n*k*n overflows
// which results in negative gflops.
gflops = ( (double)n * (double)k * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;

View File

@@ -384,7 +384,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 2.0 * m * n ) / ( dtime_save * 1.0e9 );
gflops = ( 2.0 * (double)m * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;

View File

@@ -309,7 +309,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( 2.0 * m * n ) / ( dtime_save * 1.0e9 );
gflops = ( 2.0 * (double)m * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;

View File

@@ -214,7 +214,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = (2*n) / ( dtime_save * 1.0e9 );
gflops = (2.0 * (double)n) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 2.0;

View File

@@ -274,7 +274,7 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = n / ( dtime_save * 1.0e9 );
gflops = (double)n / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt_x ) )
{

View File

@@ -225,7 +225,7 @@ int main( int argc, char** argv )
exit(1);
#endif
gflops = ( 1.0 * n ) / ( dtime_save * 1.0e9 );
gflops = (double)n / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;
printf( "data_swapv_%s", BLAS );

View File

@@ -401,7 +401,9 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
gflops = ( n * k * n ) / ( dtime_save * 1.0e9 );
// if n * k * n is not explicitly type cast, then there are cases where n*k*n overflows
// which results in negative gflops.
gflops = ( (double)n * (double)k * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;

View File

@@ -388,9 +388,9 @@ int main( int argc, char** argv )
dtime_save = bli_clock_min_diff( dtime_save, dtime );
}
if ( bli_is_left( side ) )
gflops = ( 1.0 * m * m * n ) / ( dtime_save * 1.0e9 );
gflops = ( (double)m * (double)m * (double)n ) / ( dtime_save * 1.0e9 );
else
gflops = ( 1.0 * m * n * n ) / ( dtime_save * 1.0e9 );
gflops = ( (double)m * (double)n * (double)n ) / ( dtime_save * 1.0e9 );
if ( bli_is_complex( dt ) ) gflops *= 4.0;
#ifdef BLIS
printf( "data_trsm_blis\t\t");

View File

@@ -372,7 +372,7 @@ int main( int argc, char** argv )
exit(1);
#endif
gflops = ( 1.0 * m * m ) / ( dtime_save * 1.0e9 );
gflops = ( (double)m * (double)m ) / ( dtime_save * 1.0e9 );
#ifdef BLIS
printf( "data_trsv_blis" );