From b053337387dbdef9035be03538222670a21707ca Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Thu, 10 Oct 2013 18:26:55 -0500 Subject: [PATCH] Added fusing factors, MR/NR to test suite output. Details: - Updated the test suite driver (and modules where appropriate) so that the level-1f fusing factors are output along with the variable dimension. While this is not strictly necessary, since the fusing factors are output in the initial parameter summary, it allows extra reassurance to the user since the fusing factors appear alongside the variable dimension, which together give a complete picture of the problem size. Similar changes were made for outputting the register blocksizes when reporting results for the micro-kernel test modules. --- testsuite/src/test_axpyf.c | 4 + testsuite/src/test_dotxaxpyf.c | 4 + testsuite/src/test_dotxf.c | 4 + testsuite/src/test_gemm_ukr.c | 5 ++ testsuite/src/test_gemmtrsm_ukr.c | 5 ++ testsuite/src/test_libblis.c | 143 ++++++++++++++++++++++++------ testsuite/src/test_libblis.h | 13 ++- testsuite/src/test_trsm_ukr.c | 5 ++ 8 files changed, 155 insertions(+), 28 deletions(-) diff --git a/testsuite/src/test_axpyf.c b/testsuite/src/test_axpyf.c index 340b032f6..5265d8316 100644 --- a/testsuite/src/test_axpyf.c +++ b/testsuite/src/test_axpyf.c @@ -145,6 +145,10 @@ void libblis_test_axpyf_experiment( test_params_t* params, // Query the operation's fusing factor for the current datatype. b_n = bli_axpyf_fusefac( datatype ); + // Store the fusing factor so that the driver can retrieve the value + // later when printing results. + op->dim_aux[0] = b_n; + // Map parameter characters to BLIS constants. bli_param_map_char_to_blis_conj( pc_str[0], &conja ); bli_param_map_char_to_blis_conj( pc_str[1], &conjx ); diff --git a/testsuite/src/test_dotxaxpyf.c b/testsuite/src/test_dotxaxpyf.c index 8e567dc00..d4b2b00dc 100644 --- a/testsuite/src/test_dotxaxpyf.c +++ b/testsuite/src/test_dotxaxpyf.c @@ -155,6 +155,10 @@ void libblis_test_dotxaxpyf_experiment( test_params_t* params, // Query the operation's fusing factor for the current datatype. b_n = bli_dotxaxpyf_fusefac( datatype ); + // Store the fusing factor so that the driver can retrieve the value + // later when printing results. + op->dim_aux[0] = b_n; + // Map parameter characters to BLIS constants. bli_param_map_char_to_blis_conj( pc_str[0], &conjat ); bli_param_map_char_to_blis_conj( pc_str[1], &conja ); diff --git a/testsuite/src/test_dotxf.c b/testsuite/src/test_dotxf.c index fa1734b29..78729db7b 100644 --- a/testsuite/src/test_dotxf.c +++ b/testsuite/src/test_dotxf.c @@ -147,6 +147,10 @@ void libblis_test_dotxf_experiment( test_params_t* params, // Query the operation's fusing factor for the current datatype. b_n = bli_dotxf_fusefac( datatype ); + // Store the fusing factor so that the driver can retrieve the value + // later when printing results. + op->dim_aux[0] = b_n; + // Map parameter characters to BLIS constants. bli_param_map_char_to_blis_conj( pc_str[0], &conjat ); bli_param_map_char_to_blis_conj( pc_str[1], &conjx ); diff --git a/testsuite/src/test_gemm_ukr.c b/testsuite/src/test_gemm_ukr.c index ceef641f8..6e27a8f30 100644 --- a/testsuite/src/test_gemm_ukr.c +++ b/testsuite/src/test_gemm_ukr.c @@ -158,6 +158,11 @@ void libblis_test_gemm_ukr_experiment( test_params_t* params, m = bli_blksz_for_type( datatype, gemm_mr ); n = bli_blksz_for_type( datatype, gemm_nr ); + // Store the register blocksizes so that the driver can retrieve the + // values later when printing results. + op->dim_aux[0] = m; + op->dim_aux[1] = n; + // Create test scalars. bli_obj_init_scalar( datatype, &kappa ); bli_obj_init_scalar( datatype, &alpha ); diff --git a/testsuite/src/test_gemmtrsm_ukr.c b/testsuite/src/test_gemmtrsm_ukr.c index 9c86348e4..57eb6cf9f 100644 --- a/testsuite/src/test_gemmtrsm_ukr.c +++ b/testsuite/src/test_gemmtrsm_ukr.c @@ -180,6 +180,11 @@ void libblis_test_gemmtrsm_ukr_experiment( test_params_t* params, m = bli_blksz_for_type( datatype, gemm_mr ); n = bli_blksz_for_type( datatype, gemm_nr ); + // Store the register blocksizes so that the driver can retrieve the + // values later when printing results. + op->dim_aux[0] = m; + op->dim_aux[1] = n; + // Map parameter characters to BLIS constants. bli_param_map_char_to_blis_uplo( pc_str[0], &uploa ); diff --git a/testsuite/src/test_libblis.c b/testsuite/src/test_libblis.c index 51b19d15d..b7532819a 100644 --- a/testsuite/src/test_libblis.c +++ b/testsuite/src/test_libblis.c @@ -239,9 +239,9 @@ void libblis_test_read_ops_file( char* input_filename, test_ops_t* ops ) // Level-1f libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_M, 2, &(ops->axpy2v) ); libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_M, 3, &(ops->dotaxpyv) ); - libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_M, 2, &(ops->axpyf) ); - libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_M, 2, &(ops->dotxf) ); - libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_M, 4, &(ops->dotxaxpyf) ); + libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_MF, 2, &(ops->axpyf) ); + libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_MF, 2, &(ops->dotxf) ); + libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_MF, 4, &(ops->dotxaxpyf) ); // Level-2 libblis_test_read_op_info( ops, input_stream, BLIS_TEST_DIMS_MN, 2, &(ops->gemv) ); @@ -752,7 +752,8 @@ void libblis_test_output_op_struct( FILE* os, test_op_t* op, char* op_str ) libblis_test_fprintf_c( os, "%s m k %d %d\n", op_str, op->dim_spec[0], op->dim_spec[1] ); } - else if ( dimset == BLIS_TEST_DIMS_M ) + else if ( dimset == BLIS_TEST_DIMS_M || + dimset == BLIS_TEST_DIMS_MF ) { libblis_test_fprintf_c( os, "%s m %d\n", op_str, op->dim_spec[0] ); @@ -843,6 +844,7 @@ unsigned int libblis_test_get_n_dims_from_dimset( dimset_t dimset ) else if ( dimset == BLIS_TEST_DIMS_MN ) n_dims = 2; else if ( dimset == BLIS_TEST_DIMS_MK ) n_dims = 2; else if ( dimset == BLIS_TEST_DIMS_M ) n_dims = 1; + else if ( dimset == BLIS_TEST_DIMS_MF ) n_dims = 1; else if ( dimset == BLIS_TEST_DIMS_K ) n_dims = 1; else if ( dimset == BLIS_TEST_NO_DIMS ) n_dims = 0; else @@ -856,6 +858,35 @@ unsigned int libblis_test_get_n_dims_from_dimset( dimset_t dimset ) +unsigned int libblis_test_get_n_dims_from_string( char* dims_str ) +{ + unsigned int n_dims; + char* cp; + + cp = dims_str; + + for ( n_dims = 0; *cp != '\0'; ++n_dims ) + { + //printf( "n_dims = %u\n", n_dims ); + while ( isspace( *cp ) ) + { + //printf( "current char: _%c_", *cp ); + ++cp; + } + + while ( isdigit( *cp ) ) + { + //printf( "current char: _%c_", *cp ); + ++cp; + } + } + //printf( "n_dims finally = %u\n", n_dims ); + + return n_dims; +} + + + dim_t libblis_test_get_dim_from_prob_size( int dim_spec, unsigned int p_size ) { @@ -1012,6 +1043,7 @@ void libblis_test_op_driver( test_params_t* params, char dims_str[64]; char label_str[128]; unsigned int n_spaces; + unsigned int n_dims_print; FILE* output_stream = NULL; @@ -1264,29 +1296,23 @@ void libblis_test_op_driver( test_params_t* params, sc_str[sci], funcname_str ); -//printf( "fucname_str: %s\n", funcname_str ); -//printf( "n_spaces %u strlen( funcname_str ) %u\n", n_spaces, strlen( funcname_str ) ); -//printf( "max_str_len %u\n", MAX_FUNC_STRING_LENGTH ); -//fflush( stdout ); + // Compute the number of spaces we have left to fill given + // length of our operation's name. n_spaces = MAX_FUNC_STRING_LENGTH - strlen( funcname_str ); fill_string_with_n_spaces( blank_str, n_spaces ); // Print all dimensions to a single string. - strcpy( dims_str, "" ); - for ( i = 0; i < op->n_dims; ++i ) - { - sprintf( &dims_str[strlen(dims_str)], " %5u", - ( unsigned int ) - libblis_test_get_dim_from_prob_size( op->dim_spec[i], - p_cur ) ); - } + libblis_test_build_dims_string( op, p_cur, dims_str ); + + // Count the number of dimensions that were printed to the string. + n_dims_print = libblis_test_get_n_dims_from_string( dims_str ); // Output the results of the test. Use matlab format if requested. if ( params->output_matlab_format ) { libblis_test_fprintf( stdout, - "%s%s( %3u, 1:%u ) = [ %s %6.3lf %9.2le ]; %c %s\n", - funcname_str, blank_str, pi, op->n_dims + 2, + "%s%s( %3u, 1:%u ) = [%s %6.3lf %9.2le ]; %c %s\n", + funcname_str, blank_str, pi, n_dims_print + 2, dims_str, perf, resid, OUTPUT_COMMENT_CHAR, pass_str ); @@ -1294,8 +1320,8 @@ void libblis_test_op_driver( test_params_t* params, // Also output to a file if requested (and successfully opened). if ( output_stream ) libblis_test_fprintf( output_stream, - "%s%s( %3u, 1:%u ) = [ %s %6.3lf %9.2le ]; %c %s\n", - funcname_str, blank_str, pi, op->n_dims + 2, + "%s%s( %3u, 1:%u ) = [%s %6.3lf %9.2le ]; %c %s\n", + funcname_str, blank_str, pi, n_dims_print + 2, dims_str, perf, resid, OUTPUT_COMMENT_CHAR, pass_str ); @@ -1303,7 +1329,7 @@ void libblis_test_op_driver( test_params_t* params, else { libblis_test_fprintf( stdout, - "%s%s %s %6.3lf %9.2le %s\n", + "%s%s %s %6.3lf %9.2le %s\n", funcname_str, blank_str, dims_str, perf, resid, pass_str ); @@ -1311,7 +1337,7 @@ void libblis_test_op_driver( test_params_t* params, // Also output to a file if requested (and successfully opened). if ( output_stream ) libblis_test_fprintf( output_stream, - "%s%s %s %6.3lf %9.2le %s\n", + "%s%s %s %6.3lf %9.2le %s\n", funcname_str, blank_str, dims_str, perf, resid, pass_str ); @@ -1386,6 +1412,64 @@ void libblis_test_build_function_string( char* prefix_str, sprintf( &funcname_str[strlen(funcname_str)], "_%s_%s", pc_str, sc_str ); else sprintf( &funcname_str[strlen(funcname_str)], "_%s", sc_str ); + + if ( strlen( funcname_str ) > MAX_FUNC_STRING_LENGTH ) + libblis_test_printf_error( "Function name string length (%d) exceeds maximum (%d).\n", + strlen( funcname_str ), MAX_FUNC_STRING_LENGTH ); + +} + + +void libblis_test_build_dims_string( test_op_t* op, + dim_t p_cur, + char* dims_str ) +{ + unsigned int i; + + // For level-1f experiments with fusing factors, we grab the fusing + // factor from the op struct. We do something similar for micro-kernel + // calls. + if ( op->dimset == BLIS_TEST_DIMS_MF ) + { + //sprintf( &dims_str[strlen(dims_str)], " %5u %5u", + sprintf( dims_str, " %5u %5u", + ( unsigned int ) + libblis_test_get_dim_from_prob_size( op->dim_spec[0], + p_cur ), + ( unsigned int ) op->dim_aux[0] ); + } + else if ( op->dimset == BLIS_TEST_DIMS_K ) + { + //sprintf( &dims_str[strlen(dims_str)], " %5u %5u %5u", + sprintf( dims_str, " %5u %5u %5u", + ( unsigned int ) op->dim_aux[0], + ( unsigned int ) op->dim_aux[1], + ( unsigned int ) + libblis_test_get_dim_from_prob_size( op->dim_spec[0], + p_cur ) ); + } + else if ( op->dimset == BLIS_TEST_NO_DIMS ) + { + //sprintf( &dims_str[strlen(dims_str)], " %5u %5u", + sprintf( dims_str, " %5u %5u", + ( unsigned int ) op->dim_aux[0], + ( unsigned int ) op->dim_aux[1] ); + } + else // For all other operations, we just use the dim_spec[] values + // and the current problem size. + { + // Initialize the string as empty. + sprintf( dims_str, "%s", "" ); + + // Print all dimensions to a single string. + for ( i = 0; i < op->n_dims; ++i ) + { + sprintf( &dims_str[strlen(dims_str)], " %5u", + ( unsigned int ) + libblis_test_get_dim_from_prob_size( op->dim_spec[i], + p_cur ) ); + } + } } @@ -1410,7 +1494,7 @@ void libblis_test_build_col_labels_string( test_op_t* op, char* l_str ) "
_ " ); } - n_spaces = 5; + n_spaces = 6; fill_string_with_n_spaces( blank_str, n_spaces ); sprintf( &l_str[strlen(l_str)], "%s", blank_str ); @@ -1418,11 +1502,17 @@ void libblis_test_build_col_labels_string( test_op_t* op, char* l_str ) if ( op->dimset == BLIS_TEST_DIMS_MNK || op->dimset == BLIS_TEST_DIMS_MN || op->dimset == BLIS_TEST_DIMS_MK || - op->dimset == BLIS_TEST_DIMS_M ) + op->dimset == BLIS_TEST_DIMS_M || + op->dimset == BLIS_TEST_DIMS_K || + op->dimset == BLIS_TEST_DIMS_MF || + op->dimset == BLIS_TEST_NO_DIMS ) sprintf( &l_str[strlen(l_str)], " %5s", "m" ); if ( op->dimset == BLIS_TEST_DIMS_MNK || - op->dimset == BLIS_TEST_DIMS_MN ) + op->dimset == BLIS_TEST_DIMS_MN || + op->dimset == BLIS_TEST_DIMS_K || + op->dimset == BLIS_TEST_DIMS_MF || + op->dimset == BLIS_TEST_NO_DIMS ) sprintf( &l_str[strlen(l_str)], " %5s", "n" ); if ( op->dimset == BLIS_TEST_DIMS_MNK || @@ -1448,6 +1538,9 @@ void fill_string_with_n_spaces( char* str, unsigned int n_spaces ) { unsigned int i; + // Initialze to empty string in case n_spaces == 0. + sprintf( str, "%s", "" ); + for ( i = 0; i < n_spaces; ++i ) sprintf( &str[i], " " ); } diff --git a/testsuite/src/test_libblis.h b/testsuite/src/test_libblis.h index 8cc99edb2..95c05ce58 100644 --- a/testsuite/src/test_libblis.h +++ b/testsuite/src/test_libblis.h @@ -65,7 +65,7 @@ #define INPUT_BUFFER_SIZE 256 #define MAX_FILENAME_LENGTH 256 #define MAX_BINARY_NAME_LENGTH 256 -#define MAX_FUNC_STRING_LENGTH 27 +#define MAX_FUNC_STRING_LENGTH 26 #define FLOPS_PER_UNIT_PERF 1e9 #define MAX_NUM_MSTORAGE 4 @@ -131,8 +131,9 @@ typedef enum BLIS_TEST_DIMS_MN = 1, BLIS_TEST_DIMS_MK = 2, BLIS_TEST_DIMS_M = 3, - BLIS_TEST_DIMS_K = 4, - BLIS_TEST_NO_DIMS = 5, + BLIS_TEST_DIMS_MF = 4, + BLIS_TEST_DIMS_K = 5, + BLIS_TEST_NO_DIMS = 6, } dimset_t; @@ -176,6 +177,7 @@ typedef struct unsigned int n_dims; dimset_t dimset; int dim_spec[ MAX_NUM_DIMENSIONS ]; + int dim_aux[ MAX_NUM_DIMENSIONS ]; unsigned int n_params; char params[ MAX_NUM_PARAMETERS ]; bool_t test_done; @@ -304,6 +306,7 @@ char* libblis_test_get_string_for_result( double residual, num_t dt, param_t libblis_test_get_param_type_for_char( char p_type ); operand_t libblis_test_get_operand_type_for_char( char o_type ); unsigned int libblis_test_get_n_dims_from_dimset( dimset_t dimset ); +unsigned int libblis_test_get_n_dims_from_string( char* dims_str ); dim_t libblis_test_get_dim_from_prob_size( int dim_spec, unsigned int p_size ); // --- Parameter/storage string generation --- @@ -346,6 +349,10 @@ void libblis_test_build_function_string( char* prefix_str, char* sc_str, char* func_str ); +void libblis_test_build_dims_string( test_op_t* op, + dim_t p_cur, + char* dims_str ); + void libblis_test_build_filename_string( char* prefix_str, char* op_str, char* funcname_str ); diff --git a/testsuite/src/test_trsm_ukr.c b/testsuite/src/test_trsm_ukr.c index b0367c15c..af9e0e405 100644 --- a/testsuite/src/test_trsm_ukr.c +++ b/testsuite/src/test_trsm_ukr.c @@ -157,6 +157,11 @@ void libblis_test_trsm_ukr_experiment( test_params_t* params, m = bli_blksz_for_type( datatype, gemm_mr ); n = bli_blksz_for_type( datatype, gemm_nr ); + // Store the register blocksizes so that the driver can retrieve the + // values later when printing results. + op->dim_aux[0] = m; + op->dim_aux[1] = n; + // Map parameter characters to BLIS constants. bli_param_map_char_to_blis_uplo( pc_str[0], &uploa );