From 1944de1cfa18ee24245e8e2cea96e006f3ef660c Mon Sep 17 00:00:00 2001 From: Meghana Vankadari Date: Tue, 22 Jun 2021 10:17:47 +0530 Subject: [PATCH] Fixed a bug in Level-3 bench files Details: - BLIS has reserved rs = cs = 1 case only for 1x1 scalars. - For vectors, even though rs = cs = 1 is a valid input, BLIS adjusts the strides to satisfy the error checking. - For an mxn matrix, if m > 1 and n = 1, BLIS sets cs = m to indicate that this is a column vector stored in column major order. Similarly BLIS sets rs = n in case of m = 1 and n > 1. - So determining storage-scheme based on row-stride could lead to errors if one of the matrices becomes vector. - Modified bench files to determine storage scheme based on stor_scheme character instead of checking row-strides. Change-Id: Id2dc0ea11f0e549ce8e49eb2c393442b33851527 --- bench/bench_gemm.c | 4 ++-- bench/bench_gemmt.c | 4 ++-- bench/bench_ger.c | 4 +++- bench/bench_syrk.c | 4 ++-- bench/bench_trsm.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/bench/bench_gemm.c b/bench/bench_gemm.c index 1381df369..ecb22c432 100755 --- a/bench/bench_gemm.c +++ b/bench/bench_gemm.c @@ -221,7 +221,7 @@ int main( int argc, char** argv ) } #ifndef BLIS // Incase if we are using blis interface we don't have to check for col-storage. #ifndef CBLAS - if(bli_obj_row_stride(&c) != 1) + if( ( stor_scheme == 'R' ) || ( stor_scheme == 'r' ) ) { printf("BLAS APIs doesn't support row-storage: Enable CBLAS\n"); continue; @@ -271,7 +271,7 @@ int main( int argc, char** argv ) enum CBLAS_TRANSPOSE cblas_transa; enum CBLAS_TRANSPOSE cblas_transb; - if ( bli_obj_row_stride( &c ) == 1 ) + if ( ( stor_scheme == 'C' ) || ( stor_scheme == 'c' ) ) cblas_order = CblasColMajor; else cblas_order = CblasRowMajor; diff --git a/bench/bench_gemmt.c b/bench/bench_gemmt.c index b7c90a688..aef194135 100644 --- a/bench/bench_gemmt.c +++ b/bench/bench_gemmt.c @@ -207,7 +207,7 @@ int main( int argc, char** argv ) continue; } #ifndef CBLAS - if(bli_obj_row_stride(&c) != 1) + if( ( stor_scheme == 'R' ) || ( stor_scheme == 'r' ) ) { printf("BLAS APIs doesn't support row-storage\n"); continue; @@ -263,7 +263,7 @@ int main( int argc, char** argv ) enum CBLAS_TRANSPOSE cblas_transa; enum CBLAS_TRANSPOSE cblas_transb; - if ( bli_obj_row_stride( &c ) == 1 ) + if ( ( stor_scheme == 'C' ) || ( stor_scheme == 'c' ) ) cblas_order = CblasColMajor; else cblas_order = CblasRowMajor; diff --git a/bench/bench_ger.c b/bench/bench_ger.c index 84e18d943..f6e5b27f5 100644 --- a/bench/bench_ger.c +++ b/bench/bench_ger.c @@ -66,6 +66,7 @@ int main( int argc, char** argv ) dim_t p_inc = 0; // to keep track of number of inputs num_t dt; char dt_ch; + char stor_scheme; int r, n_repeats; double dtime; @@ -107,6 +108,7 @@ int main( int argc, char** argv ) inc_t incy; char tmp[256]; // to store function name, line no present in logs. + stor_scheme = 'C'; // {S,D,C,Z} {transa m n alpha incx incy lda} @@ -185,7 +187,7 @@ int main( int argc, char** argv ) #ifdef CBLAS enum CBLAS_ORDER cblas_order; - if ( bli_obj_row_stride( &a ) == 1 ) + if ( ( stor_scheme == 'C' ) || ( stor_scheme == 'c' ) ) cblas_order = CblasColMajor; else cblas_order = CblasRowMajor; diff --git a/bench/bench_syrk.c b/bench/bench_syrk.c index d219ef09a..017b010df 100644 --- a/bench/bench_syrk.c +++ b/bench/bench_syrk.c @@ -188,7 +188,7 @@ int main( int argc, char** argv ) continue; } #ifndef CBLAS - if(bli_obj_row_stride(&c) != 1) + if( ( stor_scheme == 'R' ) || ( stor_scheme == 'r' ) ) { printf("BLAS APIs doesn't support row-storage\n"); continue; @@ -239,7 +239,7 @@ int main( int argc, char** argv ) enum CBLAS_UPLO cblas_uplo; enum CBLAS_TRANSPOSE cblas_transa; - if ( bli_obj_row_stride( &c ) == 1 ) + if ( ( stor_scheme == 'C' ) || ( stor_scheme == 'c' ) ) cblas_order = CblasColMajor; else cblas_order = CblasRowMajor; diff --git a/bench/bench_trsm.c b/bench/bench_trsm.c index e7631f82a..c95f51cc8 100644 --- a/bench/bench_trsm.c +++ b/bench/bench_trsm.c @@ -232,7 +232,7 @@ int main( int argc, char** argv ) enum CBLAS_SIDE cblas_side; enum CBLAS_DIAG cblas_diag; - if ( bli_obj_row_stride( &c ) == 1 ) + if ( ( stor_scheme == 'C' ) || ( stor_scheme == 'c' ) ) cblas_order = CblasColMajor; else cblas_order = CblasRowMajor;