diff --git a/CREDITS b/CREDITS index b56054429..c9a4e1d2e 100644 --- a/CREDITS +++ b/CREDITS @@ -91,6 +91,7 @@ but many others have contributed code and feedback, including Kiran Varaganti @kvaragan (AMD) Natalia Vassilieva (Hewlett Packard Enterprise) Zhang Xianyi @xianyi (Chinese Academy of Sciences) + RuQing Xu @xrq-phys (The University of Tokyo) Benda Xu @heroxbd Costas Yamin @cosstas Chenhan Yu @ChenhanYu (The University of Texas at Austin) diff --git a/frame/base/bli_cntx.h b/frame/base/bli_cntx.h index ba7785dcf..87341f793 100644 --- a/frame/base/bli_cntx.h +++ b/frame/base/bli_cntx.h @@ -280,7 +280,7 @@ BLIS_INLINE bool_t bli_cntx_get_l3_nat_ukr_prefs_dt( num_t dt, l3ukr_t ukr_id, c { mbool_t* mbool = bli_cntx_get_l3_nat_ukr_prefs( ukr_id, cntx ); - return bli_mbool_get_dt( dt, mbool ); + return ( bool_t )bli_mbool_get_dt( dt, mbool ); } // ----------------------------------------------------------------------------- @@ -382,7 +382,7 @@ BLIS_INLINE bool_t bli_cntx_get_l3_sup_ker_prefs_dt( num_t dt, stor3_t stor_id, { mbool_t* mbool = bli_cntx_get_l3_sup_ker_prefs( stor_id, cntx ); - return bli_mbool_get_dt( dt, mbool ); + return ( bool_t )bli_mbool_get_dt( dt, mbool ); } // ----------------------------------------------------------------------------- diff --git a/frame/base/bli_env.c b/frame/base/bli_env.c index 7e057f3bc..fafb38e8f 100644 --- a/frame/base/bli_env.c +++ b/frame/base/bli_env.c @@ -37,10 +37,10 @@ // ----------------------------------------------------------------------------- -dim_t bli_env_get_var( const char* env, dim_t fallback ) +gint_t bli_env_get_var( const char* env, gint_t fallback ) { - dim_t r_val; - char* str; + gint_t r_val; + char* str; // Query the environment variable and store the result in str. str = getenv( env ); @@ -50,7 +50,7 @@ dim_t bli_env_get_var( const char* env, dim_t fallback ) { // If there was no error, convert the string to an integer and // prepare to return that integer. - r_val = strtol( str, NULL, 10 ); + r_val = ( gint_t )strtol( str, NULL, 10 ); } else { diff --git a/frame/base/bli_env.h b/frame/base/bli_env.h index 713d28eb3..de86fadff 100644 --- a/frame/base/bli_env.h +++ b/frame/base/bli_env.h @@ -37,7 +37,7 @@ #ifndef BLIS_ENV_H #define BLIS_ENV_H -dim_t bli_env_get_var( const char* env, dim_t fallback ); +gint_t bli_env_get_var( const char* env, gint_t fallback ); //void bli_env_set_var( const char* env, dim_t value ); #endif diff --git a/frame/base/bli_mbool.h b/frame/base/bli_mbool.h index fca4c3d32..f3c71f2d6 100644 --- a/frame/base/bli_mbool.h +++ b/frame/base/bli_mbool.h @@ -38,7 +38,7 @@ BLIS_INLINE bool_t bli_mbool_get_dt( num_t dt, mbool_t* mb ) { - return mb->v[ dt ]; + return ( bool_t )( mb->v[ dt ] ); } // mbool_t modification diff --git a/frame/base/bli_pack.c b/frame/base/bli_pack.c index 73a3c0024..7ccca2826 100644 --- a/frame/base/bli_pack.c +++ b/frame/base/bli_pack.c @@ -125,18 +125,18 @@ void bli_pack_init_rntm_from_env // Try to read BLIS_PACK_A and BLIS_PACK_B. For each variable, default to // -1 if it is unset. - pack_a = bli_env_get_var( "BLIS_PACK_A", -1 ); - pack_b = bli_env_get_var( "BLIS_PACK_B", -1 ); + gint_t pack_a_env = bli_env_get_var( "BLIS_PACK_A", -1 ); + gint_t pack_b_env = bli_env_get_var( "BLIS_PACK_B", -1 ); // Enforce the default behavior first, then check for affirmative FALSE, and // finally assume anything else is TRUE. - if ( pack_a == -1 ) pack_a = FALSE; // default behavior - else if ( pack_a == 0 ) pack_a = FALSE; // zero is FALSE - else pack_a = TRUE; // anything else is TRUE + if ( pack_a_env == -1 ) pack_a = FALSE; // default behavior + else if ( pack_a_env == 0 ) pack_a = FALSE; // zero is FALSE + else pack_a = TRUE; // anything else is TRUE - if ( pack_b == -1 ) pack_b = FALSE; // default behavior - else if ( pack_b == 0 ) pack_b = FALSE; // zero is FALSE - else pack_b = TRUE; // anything else is TRUE + if ( pack_b_env == -1 ) pack_b = FALSE; // default behavior + else if ( pack_b_env == 0 ) pack_b = FALSE; // zero is FALSE + else pack_b = TRUE; // anything else is TRUE #else diff --git a/frame/base/bli_rntm.h b/frame/base/bli_rntm.h index 4d0b8510f..bda6439dd 100644 --- a/frame/base/bli_rntm.h +++ b/frame/base/bli_rntm.h @@ -47,8 +47,8 @@ typedef struct rntm_s dim_t num_threads; dim_t* thrloop; - dim_t pack_a; - dim_t pack_b; + bool_t pack_a; + bool_t pack_b; bool_t l3_sup; pool_t* sba_pool; @@ -103,11 +103,11 @@ BLIS_INLINE dim_t bli_rntm_pr_ways( rntm_t* rntm ) BLIS_INLINE bool_t bli_rntm_pack_a( rntm_t* rntm ) { - return rntm->pack_a; + return ( bool_t )( rntm->pack_a ); } BLIS_INLINE bool_t bli_rntm_pack_b( rntm_t* rntm ) { - return rntm->pack_b; + return ( bool_t )( rntm->pack_b ); } BLIS_INLINE bool_t bli_rntm_l3_sup( rntm_t* rntm ) diff --git a/frame/include/bli_misc_macro_defs.h b/frame/include/bli_misc_macro_defs.h index bc7ff19b8..f746b1bf8 100644 --- a/frame/include/bli_misc_macro_defs.h +++ b/frame/include/bli_misc_macro_defs.h @@ -96,12 +96,12 @@ BLIS_INLINE guint_t bli_round_to_mult( guint_t val, guint_t mult ) BLIS_INLINE bool_t bli_is_odd( gint_t a ) { - return ( a % 2 == 1 ); + return ( bool_t )( a % 2 == 1 ); } BLIS_INLINE bool_t bli_is_even( gint_t a ) { - return ( a % 2 == 0 ); + return ( bool_t )( a % 2 == 0 ); } // swap_dims diff --git a/frame/include/bli_obj_macro_defs.h b/frame/include/bli_obj_macro_defs.h index 64f893ed7..5ab8acbdd 100644 --- a/frame/include/bli_obj_macro_defs.h +++ b/frame/include/bli_obj_macro_defs.h @@ -351,15 +351,15 @@ BLIS_INLINE bool_t bli_obj_is_packed( obj_t* obj ) BLIS_INLINE bool_t bli_obj_is_row_packed( obj_t* obj ) { return ( bool_t ) - ( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ - BLIS_BITVAL_PACKED_ROWS ); + ( ( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ + BLIS_BITVAL_PACKED_ROWS ) ); } BLIS_INLINE bool_t bli_obj_is_col_packed( obj_t* obj ) { return ( bool_t ) - ( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ - BLIS_BITVAL_PACKED_COLUMNS ); + ( ( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ + BLIS_BITVAL_PACKED_COLUMNS ) ); } BLIS_INLINE bool_t bli_obj_is_panel_packed( obj_t* obj ) @@ -421,148 +421,148 @@ BLIS_INLINE void bli_obj_apply_conj( conj_t conj, obj_t* obj ) BLIS_INLINE void bli_obj_set_conjtrans( trans_t trans, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_CONJTRANS_BITS ) | trans; + ( ( obj->info & ~BLIS_CONJTRANS_BITS ) | trans ); } BLIS_INLINE void bli_obj_set_onlytrans( trans_t trans, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_TRANS_BIT ) | trans; + ( ( obj->info & ~BLIS_TRANS_BIT ) | trans ); } BLIS_INLINE void bli_obj_set_conj( conj_t conj, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_CONJ_BIT ) | conj; + ( ( obj->info & ~BLIS_CONJ_BIT ) | conj ); } BLIS_INLINE void bli_obj_set_uplo( uplo_t uplo, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_UPLO_BITS ) | uplo; + ( ( obj->info & ~BLIS_UPLO_BITS ) | uplo ); } BLIS_INLINE void bli_obj_set_diag( diag_t diag, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_UNIT_DIAG_BIT ) | diag; + ( ( obj->info & ~BLIS_UNIT_DIAG_BIT ) | diag ); } BLIS_INLINE void bli_obj_set_invert_diag( invdiag_t invdiag, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_INVERT_DIAG_BIT ) | invdiag; + ( ( obj->info & ~BLIS_INVERT_DIAG_BIT ) | invdiag ); } BLIS_INLINE void bli_obj_set_dt( num_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_DATATYPE_BITS ) | dt; + ( ( obj->info & ~BLIS_DATATYPE_BITS ) | dt ); } BLIS_INLINE void bli_obj_set_target_dt( num_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_TARGET_DT_BITS ) | - ( dt << BLIS_TARGET_DT_SHIFT ); + ( ( obj->info & ~BLIS_TARGET_DT_BITS ) | + ( dt << BLIS_TARGET_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_target_domain( dom_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_TARGET_DOMAIN_BIT ) | - ( dt << BLIS_TARGET_DT_SHIFT ); + ( ( obj->info & ~BLIS_TARGET_DOMAIN_BIT ) | + ( dt << BLIS_TARGET_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_target_prec( prec_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_TARGET_PREC_BIT ) | - ( dt << BLIS_TARGET_DT_SHIFT ); + ( ( obj->info & ~BLIS_TARGET_PREC_BIT ) | + ( dt << BLIS_TARGET_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_exec_dt( num_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_EXEC_DT_BITS ) | - ( dt << BLIS_EXEC_DT_SHIFT ); + ( ( obj->info & ~BLIS_EXEC_DT_BITS ) | + ( dt << BLIS_EXEC_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_exec_domain( dom_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_EXEC_DOMAIN_BIT ) | - ( dt << BLIS_EXEC_DT_SHIFT ); + ( ( obj->info & ~BLIS_EXEC_DOMAIN_BIT ) | + ( dt << BLIS_EXEC_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_exec_prec( prec_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_EXEC_PREC_BIT ) | - ( dt << BLIS_EXEC_DT_SHIFT ); + ( ( obj->info & ~BLIS_EXEC_PREC_BIT ) | + ( dt << BLIS_EXEC_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_comp_dt( num_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_COMP_DT_BITS ) | - ( dt << BLIS_COMP_DT_SHIFT ); + ( ( obj->info & ~BLIS_COMP_DT_BITS ) | + ( dt << BLIS_COMP_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_comp_domain( dom_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_COMP_DOMAIN_BIT ) | - ( dt << BLIS_COMP_DT_SHIFT ); + ( ( obj->info & ~BLIS_COMP_DOMAIN_BIT ) | + ( dt << BLIS_COMP_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_comp_prec( prec_t dt, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_COMP_PREC_BIT ) | - ( dt << BLIS_COMP_DT_SHIFT ); + ( ( obj->info & ~BLIS_COMP_PREC_BIT ) | + ( dt << BLIS_COMP_DT_SHIFT ) ); } // NOTE: This function queries and modifies info2. BLIS_INLINE void bli_obj_set_scalar_dt( num_t dt, obj_t* obj ) { obj->info2 = ( objbits_t ) - ( obj->info2 & ~BLIS_SCALAR_DT_BITS ) | - ( dt << BLIS_SCALAR_DT_SHIFT ); + ( ( obj->info2 & ~BLIS_SCALAR_DT_BITS ) | + ( dt << BLIS_SCALAR_DT_SHIFT ) ); } // NOTE: This function queries and modifies info2. BLIS_INLINE void bli_obj_set_scalar_domain( dom_t dt, obj_t* obj ) { obj->info2 = ( objbits_t ) - ( obj->info2 & ~BLIS_SCALAR_DOMAIN_BIT ) | - ( dt << BLIS_SCALAR_DT_SHIFT ); + ( ( obj->info2 & ~BLIS_SCALAR_DOMAIN_BIT ) | + ( dt << BLIS_SCALAR_DT_SHIFT ) ); } // NOTE: This function queries and modifies info2. BLIS_INLINE void bli_obj_set_scalar_prec( prec_t dt, obj_t* obj ) { obj->info2 = ( objbits_t ) - ( obj->info2 & ~BLIS_SCALAR_PREC_BIT ) | - ( dt << BLIS_SCALAR_DT_SHIFT ); + ( ( obj->info2 & ~BLIS_SCALAR_PREC_BIT ) | + ( dt << BLIS_SCALAR_DT_SHIFT ) ); } BLIS_INLINE void bli_obj_set_pack_schema( pack_t schema, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_PACK_SCHEMA_BITS ) | schema; + ( ( obj->info & ~BLIS_PACK_SCHEMA_BITS ) | schema ); } BLIS_INLINE void bli_obj_set_pack_order_if_upper( packord_t ordif, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_PACK_REV_IF_UPPER_BIT ) | ordif; + ( ( obj->info & ~BLIS_PACK_REV_IF_UPPER_BIT ) | ordif ); } BLIS_INLINE void bli_obj_set_pack_order_if_lower( packord_t ordif, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_PACK_REV_IF_LOWER_BIT ) | ordif; + ( ( obj->info & ~BLIS_PACK_REV_IF_LOWER_BIT ) | ordif ); } // NOTE: The packbuf_t bitfield in the obj_t is currently unused. Instead, @@ -572,13 +572,13 @@ BLIS_INLINE void bli_obj_set_pack_order_if_lower( packord_t ordif, obj_t* obj ) BLIS_INLINE void bli_obj_set_pack_buffer_type( packbuf_t buf_type, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_PACK_BUFFER_BITS ) | buf_type; + ( ( obj->info & ~BLIS_PACK_BUFFER_BITS ) | buf_type ); } BLIS_INLINE void bli_obj_set_struc( struc_t struc, obj_t* obj ) { obj->info = ( objbits_t ) - ( obj->info & ~BLIS_STRUC_BITS ) | struc; + ( ( obj->info & ~BLIS_STRUC_BITS ) | struc ); } BLIS_INLINE void bli_obj_toggle_trans( obj_t* obj ) @@ -601,43 +601,50 @@ BLIS_INLINE void bli_obj_toggle_uplo( obj_t* obj ) BLIS_INLINE obj_t* bli_obj_root( obj_t* obj ) { - return ( obj->root ); + return ( obj_t* )( obj->root ); } BLIS_INLINE bool_t bli_obj_root_is_general( obj_t* obj ) { - return bli_obj_is_general( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_general( bli_obj_root( obj ) ) ); } BLIS_INLINE bool_t bli_obj_root_is_hermitian( obj_t* obj ) { - return bli_obj_is_hermitian( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_hermitian( bli_obj_root( obj ) ) ); } BLIS_INLINE bool_t bli_obj_root_is_symmetric( obj_t* obj ) { - return bli_obj_is_symmetric( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_symmetric( bli_obj_root( obj ) ) ); } BLIS_INLINE bool_t bli_obj_root_is_triangular( obj_t* obj ) { - return bli_obj_is_triangular( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_triangular( bli_obj_root( obj ) ) ); } BLIS_INLINE bool_t bli_obj_root_is_herm_or_symm( obj_t* obj ) { - return bli_obj_is_hermitian( bli_obj_root( obj ) ) || - bli_obj_is_symmetric( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_hermitian( bli_obj_root( obj ) ) || + bli_obj_is_symmetric( bli_obj_root( obj ) ) ); } BLIS_INLINE bool_t bli_obj_root_is_upper( obj_t* obj ) { - return bli_obj_is_upper( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_upper( bli_obj_root( obj ) ) ); } BLIS_INLINE bool_t bli_obj_root_is_lower( obj_t* obj ) { - return bli_obj_is_lower( bli_obj_root( obj ) ); + return ( bool_t ) + ( bli_obj_is_lower( bli_obj_root( obj ) ) ); } // Root matrix modification @@ -699,32 +706,32 @@ BLIS_INLINE dim_t bli_obj_dim( mdim_t mdim, obj_t* obj ) BLIS_INLINE dim_t bli_obj_min_dim( obj_t* obj ) { return bli_min( bli_obj_length( obj ), - bli_obj_width( obj ) ); + bli_obj_width( obj ) ); } BLIS_INLINE dim_t bli_obj_max_dim( obj_t* obj ) { return bli_max( bli_obj_length( obj ), - bli_obj_width( obj ) ); + bli_obj_width( obj ) ); } BLIS_INLINE dim_t bli_obj_length_after_trans( obj_t* obj ) { - return ( bli_obj_has_trans( obj ) ? bli_obj_width( obj ) + return ( bli_obj_has_trans( obj ) ? bli_obj_width( obj ) : bli_obj_length( obj ) ); } BLIS_INLINE dim_t bli_obj_width_after_trans( obj_t* obj ) { return ( bli_obj_has_trans( obj ) ? bli_obj_length( obj ) - : bli_obj_width( obj ) ); + : bli_obj_width( obj ) ); } BLIS_INLINE bool_t bli_obj_is_1x1( obj_t* x ) { return ( bool_t ) ( bli_obj_length( x ) == 1 && - bli_obj_width( x ) == 1 ); + bli_obj_width( x ) == 1 ); } // Stride/increment query @@ -746,17 +753,20 @@ BLIS_INLINE inc_t bli_obj_imag_stride( obj_t* obj ) BLIS_INLINE inc_t bli_obj_row_stride_mag( obj_t* obj ) { - return ( bli_abs( obj->rs ) ); + return ( inc_t ) + ( bli_abs( obj->rs ) ); } BLIS_INLINE inc_t bli_obj_col_stride_mag( obj_t* obj ) { - return ( bli_abs( obj->cs ) ); + return ( inc_t ) + ( bli_abs( obj->cs ) ); } BLIS_INLINE inc_t bli_obj_imag_stride_mag( obj_t* obj ) { - return ( bli_abs( obj->is ) ); + return ( inc_t ) + ( bli_abs( obj->is ) ); } // Note: The purpose of these functions is to obtain the length and width @@ -787,25 +797,25 @@ BLIS_INLINE dim_t bli_obj_width_stored( obj_t* obj ) BLIS_INLINE dim_t bli_obj_length_stored_after_trans( obj_t* obj ) { - return ( bli_obj_has_trans( obj ) ? bli_obj_width_stored( obj ) + return ( bli_obj_has_trans( obj ) ? bli_obj_width_stored( obj ) : bli_obj_length_stored( obj ) ); } BLIS_INLINE dim_t bli_obj_width_stored_after_trans( obj_t* obj ) { return ( bli_obj_has_trans( obj ) ? bli_obj_length_stored( obj ) - : bli_obj_width_stored( obj ) ); + : bli_obj_width_stored( obj ) ); } BLIS_INLINE dim_t bli_obj_vector_dim( obj_t* x ) { - return ( bli_obj_length( x ) == 1 ? bli_obj_width( x ) + return ( bli_obj_length( x ) == 1 ? bli_obj_width( x ) : bli_obj_length( x ) ); } BLIS_INLINE inc_t bli_obj_vector_inc( obj_t* x ) { - return ( bli_obj_is_1x1( x ) ? 1 : \ + return ( bli_obj_is_1x1( x ) ? 1 : ( bli_obj_length( x ) == 1 ? bli_obj_col_stride( x ) : bli_obj_row_stride( x ) ) ); @@ -815,7 +825,7 @@ BLIS_INLINE bool_t bli_obj_is_vector( obj_t* x ) { return ( bool_t ) ( bli_obj_length( x ) == 1 || - bli_obj_width( x ) == 1 ); + bli_obj_width( x ) == 1 ); } BLIS_INLINE bool_t bli_obj_is_row_vector( obj_t* x ) @@ -834,7 +844,7 @@ BLIS_INLINE bool_t bli_obj_has_zero_dim( obj_t* x ) { return ( bool_t ) ( bli_obj_length( x ) == 0 || - bli_obj_width( x ) == 0 ); + bli_obj_width( x ) == 0 ); } // Dimension modification @@ -862,13 +872,12 @@ BLIS_INLINE void bli_obj_set_dims( dim_t m, dim_t n, obj_t* obj ) BLIS_INLINE void bli_obj_set_dims_with_trans( trans_t trans, dim_t m, dim_t n, obj_t* obj ) { - //if ( bli_does_notrans( trans ) ) - if ( ( ~trans & BLIS_TRANS_BIT ) == BLIS_BITVAL_TRANS ) + if ( bli_does_notrans( trans ) ) { bli_obj_set_length( m, obj ); bli_obj_set_width( n, obj ); } - else + else // if ( bli_does_trans( trans ) ) { bli_obj_set_length( n, obj ); bli_obj_set_width( m, obj ); @@ -1019,7 +1028,8 @@ BLIS_INLINE bool_t bli_obj_is_unstored_subpart( obj_t* obj ) BLIS_INLINE void* bli_obj_buffer( obj_t* obj ) { - return ( obj->buffer ); + return ( void* ) + ( obj->buffer ); } // Buffer address modification @@ -1048,7 +1058,8 @@ BLIS_INLINE void bli_obj_copy_internal_scalar( obj_t* a, obj_t* b ) BLIS_INLINE siz_t bli_obj_elem_size( obj_t* obj ) { - return ( obj->elem_size ); + return ( siz_t ) + ( obj->elem_size ); } // Element size modification @@ -1239,8 +1250,7 @@ BLIS_INLINE void bli_obj_toggle_region_ref( obj_t* obj ) BLIS_INLINE void bli_obj_toggle_uplo_if_trans( trans_t trans, obj_t* obj ) { - //if ( bli_does_trans( trans ) && - if ( ( trans & BLIS_TRANS_BIT ) == BLIS_BITVAL_TRANS && + if ( bli_does_trans( trans ) && bli_obj_is_upper_or_lower( obj ) ) { bli_obj_toggle_uplo( obj ); diff --git a/frame/include/bli_param_macro_defs.h b/frame/include/bli_param_macro_defs.h index f31ff8cb1..ed4f2c7bd 100644 --- a/frame/include/bli_param_macro_defs.h +++ b/frame/include/bli_param_macro_defs.h @@ -310,7 +310,7 @@ BLIS_INLINE bool_t bli_is_upper_or_lower( uplo_t uplo ) { return ( bool_t ) ( bli_is_upper( uplo ) || - bli_is_lower( uplo ) ); + bli_is_lower( uplo ) ); } BLIS_INLINE bool_t bli_is_dense( uplo_t uplo ) @@ -328,8 +328,9 @@ BLIS_INLINE bool_t bli_is_zeros( uplo_t uplo ) BLIS_INLINE uplo_t bli_uplo_toggled( uplo_t uplo ) { return ( uplo_t ) - ( bli_is_upper_or_lower( uplo ) ? - ( ( uplo ^ BLIS_LOWER_BIT ) ^ BLIS_UPPER_BIT ) : uplo + ( bli_is_upper_or_lower( uplo ) + ? ( ( uplo ^ BLIS_LOWER_BIT ) ^ BLIS_UPPER_BIT ) + : uplo ); } @@ -369,7 +370,7 @@ BLIS_INLINE bool_t bli_is_herm_or_symm( struc_t struc ) { return ( bool_t ) ( bli_is_hermitian( struc ) || - bli_is_symmetric( struc ) ); + bli_is_symmetric( struc ) ); } @@ -503,7 +504,7 @@ BLIS_INLINE dim_t bli_determine_blocksize_dim_b( dim_t i, dim_t dim, dim_t b_alg { return ( dim_t ) ( i == 0 && dim % b_alg != 0 ? dim % b_alg - : b_alg ); + : b_alg ); } @@ -544,23 +545,23 @@ BLIS_INLINE bool_t bli_is_gen_stored( inc_t rs, inc_t cs ) { return ( bool_t ) ( bli_abs( rs ) != 1 && - bli_abs( cs ) != 1 ); + bli_abs( cs ) != 1 ); } BLIS_INLINE bool_t bli_is_row_tilted( dim_t m, dim_t n, inc_t rs, inc_t cs ) { return ( bool_t ) ( bli_abs( cs ) == bli_abs( rs ) - ? n < m - : bli_abs( cs ) < bli_abs( rs ) ); + ? n < m + : bli_abs( cs ) < bli_abs( rs ) ); } BLIS_INLINE bool_t bli_is_col_tilted( dim_t m, dim_t n, inc_t rs, inc_t cs ) { return ( bool_t ) ( bli_abs( rs ) == bli_abs( cs ) - ? m < n - : bli_abs( rs ) < bli_abs( cs ) ); + ? m < n + : bli_abs( rs ) < bli_abs( cs ) ); } BLIS_INLINE bool_t bli_has_nonunit_inc1( inc_t s1 ) @@ -611,16 +612,16 @@ BLIS_INLINE bool_t bli_is_strictly_above_diag( doff_t diagoff, trans_t trans, di { return ( bool_t ) ( bli_does_trans( trans ) - ? ( ( doff_t )n <= -diagoff ) - : ( ( doff_t )m <= -diagoff ) ); + ? ( ( doff_t )n <= -diagoff ) + : ( ( doff_t )m <= -diagoff ) ); } BLIS_INLINE bool_t bli_is_strictly_below_diag( doff_t diagoff, trans_t trans, dim_t m, dim_t n ) { return ( bool_t ) ( bli_does_trans( trans ) - ? ( ( doff_t )m <= diagoff ) - : ( ( doff_t )n <= diagoff ) ); + ? ( ( doff_t )m <= diagoff ) + : ( ( doff_t )n <= diagoff ) ); } BLIS_INLINE bool_t bli_is_outside_diag( doff_t diagoff, trans_t trans, dim_t m, dim_t n ) @@ -780,7 +781,8 @@ BLIS_INLINE bool_t bli_is_n_dim( mdim_t mdim ) BLIS_INLINE mdim_t bli_dim_toggled( mdim_t mdim ) { - return ( mdim == BLIS_M ? BLIS_N : BLIS_M ); + return ( mdim_t ) + ( mdim == BLIS_M ? BLIS_N : BLIS_M ); } BLIS_INLINE void bli_toggle_dim( mdim_t* mdim ) @@ -948,15 +950,15 @@ BLIS_INLINE bool_t bli_is_packed( pack_t schema ) BLIS_INLINE bool_t bli_is_row_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ - BLIS_BITVAL_PACKED_ROWS ); + ( ( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ + BLIS_BITVAL_PACKED_ROWS ) ); } BLIS_INLINE bool_t bli_is_col_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ - BLIS_BITVAL_PACKED_COLUMNS ); + ( ( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^ + BLIS_BITVAL_PACKED_COLUMNS ) ); } BLIS_INLINE bool_t bli_is_panel_packed( pack_t schema ) @@ -968,37 +970,37 @@ BLIS_INLINE bool_t bli_is_panel_packed( pack_t schema ) BLIS_INLINE bool_t bli_is_4mi_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_4MI; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_4MI ); } BLIS_INLINE bool_t bli_is_3mi_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MI; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MI ); } BLIS_INLINE bool_t bli_is_3ms_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MS; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MS ); } BLIS_INLINE bool_t bli_is_ro_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RO; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RO ); } BLIS_INLINE bool_t bli_is_io_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_IO; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_IO ); } BLIS_INLINE bool_t bli_is_rpi_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RPI; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RPI ); } BLIS_INLINE bool_t bli_is_rih_packed( pack_t schema ) @@ -1012,13 +1014,13 @@ BLIS_INLINE bool_t bli_is_rih_packed( pack_t schema ) BLIS_INLINE bool_t bli_is_1r_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1R; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1R ); } BLIS_INLINE bool_t bli_is_1e_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1E; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1E ); } BLIS_INLINE bool_t bli_is_1m_packed( pack_t schema ) @@ -1031,19 +1033,19 @@ BLIS_INLINE bool_t bli_is_1m_packed( pack_t schema ) BLIS_INLINE bool_t bli_is_nat_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) == 0; + ( ( schema & BLIS_PACK_FORMAT_BITS ) == 0 ); } BLIS_INLINE bool_t bli_is_ind_packed( pack_t schema ) { return ( bool_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) != 0; + ( ( schema & BLIS_PACK_FORMAT_BITS ) != 0 ); } BLIS_INLINE guint_t bli_pack_schema_index( pack_t schema ) { return ( guint_t ) - ( schema & BLIS_PACK_FORMAT_BITS ) >> BLIS_PACK_FORMAT_SHIFT; + ( ( schema & BLIS_PACK_FORMAT_BITS ) >> BLIS_PACK_FORMAT_SHIFT ); } diff --git a/frame/thread/bli_thrcomm.c b/frame/thread/bli_thrcomm.c index 39d2204ee..ef46a7ad4 100644 --- a/frame/thread/bli_thrcomm.c +++ b/frame/thread/bli_thrcomm.c @@ -86,7 +86,7 @@ void bli_thrcomm_barrier_atomic( dim_t t_id, thrcomm_t* comm ) // fact, if everything else is working, a binary variable is sufficient, // which is what we do here (i.e., 0 is incremented to 1, which is then // decremented back to 0, and so forth). - bool_t orig_sense = __atomic_load_n( &comm->barrier_sense, __ATOMIC_RELAXED ); + gint_t orig_sense = __atomic_load_n( &comm->barrier_sense, __ATOMIC_RELAXED ); // Register ourselves (the current thread) as having arrived by // incrementing the barrier_threads_arrived variable. We must perform diff --git a/frame/thread/bli_thrcomm_openmp.c b/frame/thread/bli_thrcomm_openmp.c index fffc4169e..174b4a0c5 100644 --- a/frame/thread/bli_thrcomm_openmp.c +++ b/frame/thread/bli_thrcomm_openmp.c @@ -87,7 +87,7 @@ void bli_thrcomm_barrier( dim_t t_id, thrcomm_t* comm ) #if 0 if ( comm == NULL || comm->n_threads == 1 ) return; - bool_t my_sense = comm->barrier_sense; + gint_t my_sense = comm->barrier_sense; dim_t my_threads_arrived; _Pragma( "omp atomic capture" ) @@ -100,7 +100,7 @@ void bli_thrcomm_barrier( dim_t t_id, thrcomm_t* comm ) } else { - volatile bool_t* listener = &comm->barrier_sense; + volatile gint_t* listener = &comm->barrier_sense; while ( *listener == my_sense ) {} } #endif diff --git a/frame/thread/bli_thrcomm_openmp.h b/frame/thread/bli_thrcomm_openmp.h index befc5f404..f69bc6bf4 100644 --- a/frame/thread/bli_thrcomm_openmp.h +++ b/frame/thread/bli_thrcomm_openmp.h @@ -64,8 +64,14 @@ struct thrcomm_s void* sent_object; dim_t n_threads; - //volatile bool_t barrier_sense; - bool_t barrier_sense; + // NOTE: barrier_sense was originally a bool_t, but upon redefining bool_t + // as bool we discovered that some gcc __atomic built-ins don't allow the + // use of bool for the variables being operated upon. (Specifically, this + // was observed of __atomic_fetch_xor(), but it likely applies to all other + // related built-ins.) Thus, we get around this by redefining barrier_sense + // as a gint_t. + //volatile gint_t barrier_sense; + gint_t barrier_sense; dim_t barrier_threads_arrived; }; #endif diff --git a/frame/thread/bli_thrcomm_pthreads.h b/frame/thread/bli_thrcomm_pthreads.h index f24849cb3..8105b0571 100644 --- a/frame/thread/bli_thrcomm_pthreads.h +++ b/frame/thread/bli_thrcomm_pthreads.h @@ -56,8 +56,14 @@ struct thrcomm_s // bli_pthread_mutex_t mutex; //#endif - //volatile bool_t barrier_sense; - bool_t barrier_sense; + // NOTE: barrier_sense was originally a bool_t, but upon redefining bool_t + // as bool we discovered that some gcc __atomic built-ins don't allow the + // use of bool for the variables being operated upon. (Specifically, this + // was observed of __atomic_fetch_xor(), but it likely applies to all other + // related built-ins.) Thus, we get around this by redefining barrier_sense + // as a gint_t. + //volatile gint_t barrier_sense; + gint_t barrier_sense; dim_t barrier_threads_arrived; }; #endif diff --git a/frame/thread/bli_thrcomm_single.h b/frame/thread/bli_thrcomm_single.h index f608ab37a..176c99d8b 100644 --- a/frame/thread/bli_thrcomm_single.h +++ b/frame/thread/bli_thrcomm_single.h @@ -61,7 +61,13 @@ struct thrcomm_s void* sent_object; dim_t n_threads; - bool_t barrier_sense; + // NOTE: barrier_sense was originally a bool_t, but upon redefining bool_t + // as bool we discovered that some gcc __atomic built-ins don't allow the + // use of bool for the variables being operated upon. (Specifically, this + // was observed of __atomic_fetch_xor(), but it likely applies to all other + // related built-ins.) Thus, we get around this by redefining barrier_sense + // as a gint_t. + gint_t barrier_sense; dim_t barrier_threads_arrived; }; #endif