Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental version of obj_t using bit fields for the various flags. #528

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions frame/0/bli_l0_oapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void PASTEMAC0(opname) \
bli_init_once(); \
\
num_t dt_chi; \
num_t dt_absq_c = bli_obj_dt_proj_to_complex( absq ); \
num_t dt_absq_c = bli_dt_proj_to_complex( bli_obj_dt( absq ) ); \
\
void* buf_chi; \
void* buf_absq = bli_obj_buffer_at_off( absq ); \
Expand Down Expand Up @@ -274,7 +274,7 @@ void PASTEMAC0(opname) \
bli_init_once(); \
\
num_t dt_chi; \
num_t dt_zeta_c = bli_obj_dt_proj_to_complex( zeta_r ); \
num_t dt_zeta_c = bli_dt_proj_to_complex( bli_obj_dt( zeta_r ) ); \
\
void* buf_chi; \
\
Expand Down
4 changes: 2 additions & 2 deletions frame/1m/packm/bli_packm_part.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void bli_packm_acquire_mpart_t2b( subpart_t requested_part,

// Partitioning top-to-bottom through packed column panels (which are
// row-stored) is not yet supported.
if ( bli_obj_is_col_packed( obj ) )
if ( bli_is_col_packed( bli_obj_pack_schema( obj ) ) )
{
bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
}
Expand Down Expand Up @@ -130,7 +130,7 @@ void bli_packm_acquire_mpart_l2r( subpart_t requested_part,

// Partitioning left-to-right through packed row panels (which are
// column-stored) is not yet supported.
if ( bli_obj_is_row_packed( obj ) )
if ( bli_is_row_packed( bli_obj_pack_schema( obj ) ) )
{
bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
}
Expand Down
6 changes: 3 additions & 3 deletions frame/3/bli_l3_blocksize.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ dim_t PASTEMAC0(opname) \
multiple of MR if A is Hermitian or symmetric, or NR if B is
Hermitian or symmetric. If neither case applies, then we leave
the blocksizes unchanged. */ \
if ( bli_obj_root_is_herm_or_symm( a ) ) \
if ( bli_is_herm_or_symm( bli_obj_struc( bli_obj_root( a ) ) ) ) \
{ \
mnr = bli_cntx_get_blksz_def_dt( dt, BLIS_MR, cntx ); \
b_alg = bli_align_dim_to_mult( b_alg, mnr ); \
b_max = bli_align_dim_to_mult( b_max, mnr ); \
} \
else if ( bli_obj_root_is_herm_or_symm( b ) ) \
else if ( bli_is_herm_or_symm( bli_obj_struc( bli_obj_root( b ) ) ) ) \
{ \
mnr = bli_cntx_get_blksz_def_dt( dt, BLIS_NR, cntx ); \
b_alg = bli_align_dim_to_mult( b_alg, mnr ); \
Expand Down Expand Up @@ -257,7 +257,7 @@ dim_t PASTEMAC0(opname) \
/* Nudge the default and maximum kc blocksizes up to the nearest
multiple of MR if the triangular matrix is on the left, or NR
if the triangular matrix is one the right. */ \
if ( bli_obj_root_is_triangular( a ) ) \
if ( bli_obj_is_triangular( bli_obj_root( a ) ) ) \
mnr = bli_cntx_get_blksz_def_dt( dt, BLIS_MR, cntx ); \
else \
mnr = bli_cntx_get_blksz_def_dt( dt, BLIS_NR, cntx ); \
Expand Down
16 changes: 8 additions & 8 deletions frame/3/bli_l3_direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ dir_t bli_trmm_direct
// - right,lower: forwards
// - right,upper: backwards

if ( bli_obj_root_is_triangular( a ) )
if ( bli_obj_is_triangular( bli_obj_root( a ) ) )
{
if ( bli_obj_root_is_lower( a ) ) direct = BLIS_BWD;
if ( bli_obj_is_lower( bli_obj_root( a ) ) ) direct = BLIS_BWD;
else direct = BLIS_FWD;
}
else // if ( bli_obj_root_is_triangular( b ) )
else // if ( bli_obj_is_triangular( bli_obj_root( b ) ) )
{
if ( bli_obj_root_is_lower( b ) ) direct = BLIS_FWD;
if ( bli_obj_is_lower( bli_obj_root( b ) ) ) direct = BLIS_FWD;
else direct = BLIS_BWD;
}

Expand All @@ -124,14 +124,14 @@ dir_t bli_trsm_direct
// - right,lower: backwards
// - right,upper: forwards

if ( bli_obj_root_is_triangular( a ) )
if ( bli_obj_is_triangular( bli_obj_root( a ) ) )
{
if ( bli_obj_root_is_lower( a ) ) direct = BLIS_FWD;
if ( bli_obj_is_lower( bli_obj_root( a ) ) ) direct = BLIS_FWD;
else direct = BLIS_BWD;
}
else // if ( bli_obj_root_is_triangular( b ) )
else // if ( bli_obj_is_triangular( bli_obj_root( b ) ) )
{
if ( bli_obj_root_is_lower( b ) ) direct = BLIS_BWD;
if ( bli_obj_is_lower( bli_obj_root( b ) ) ) direct = BLIS_BWD;
else direct = BLIS_FWD;
}

Expand Down
2 changes: 1 addition & 1 deletion frame/3/gemm/bli_gemm_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ void bli_gemm_md_zgemm
//num_t dt_c2 = bli_obj_dt( c );
//num_t dt_c1 = bli_dt_proj_to_complex( dt_c2 );
//num_t dt_c = bli_dt_proj_to_double_prec( dt_c1 );
//num_t dt_c = bli_obj_dt_proj_to_complex( c );
//num_t dt_c = bli_dt_proj_to_complex( bli_obj_dt( c ) );
num_t dt_c = BLIS_DCOMPLEX;

if ( bli_obj_is_single_prec( c ) ) dt_c = BLIS_SCOMPLEX;
Expand Down
6 changes: 3 additions & 3 deletions frame/3/gemm/bli_gemm_md.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ BLIS_INLINE bool bli_gemm_md_is_crr( obj_t* a, obj_t* b, obj_t* c )
if ( bli_obj_is_complex( c ) &&
bli_obj_is_real( a ) &&
bli_obj_is_real( b ) &&
bli_obj_exec_domain( c ) == BLIS_REAL )
bli_is_real( bli_obj_exec_dt( c ) ) )
r_val = TRUE;

return r_val;
Expand All @@ -121,7 +121,7 @@ BLIS_INLINE bool bli_gemm_md_is_ccr( obj_t* a, obj_t* b, obj_t* c )
if ( bli_obj_is_complex( c ) &&
bli_obj_is_complex( a ) &&
bli_obj_is_real( b ) &&
bli_obj_exec_domain( c ) == BLIS_COMPLEX )
bli_is_complex( bli_obj_exec_dt( c ) ) )
r_val = TRUE;

return r_val;
Expand All @@ -141,7 +141,7 @@ BLIS_INLINE bool bli_gemm_md_is_crc( obj_t* a, obj_t* b, obj_t* c )
if ( bli_obj_is_complex( c ) &&
bli_obj_is_real( a ) &&
bli_obj_is_complex( b ) &&
bli_obj_exec_domain( c ) == BLIS_COMPLEX )
bli_is_complex( bli_obj_exec_dt( c ) ) )
r_val = TRUE;

return r_val;
Expand Down
2 changes: 1 addition & 1 deletion frame/3/herk/bli_herk_x_ker_var2.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void bli_herk_x_ker_var2
gemm_var_oft f;

// Set a bool based on the uplo field of C's root object.
if ( bli_obj_root_is_lower( c ) ) uplo = 0;
if ( bli_obj_is_lower( bli_obj_root( c ) ) ) uplo = 0;
else uplo = 1;

// Index into the variant array to extract the correct function pointer.
Expand Down
8 changes: 4 additions & 4 deletions frame/3/trmm/bli_trmm_xx_ker_var2.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ void bli_trmm_xx_ker_var2
// Set two bools: one based on the implied side parameter (the structure
// of the root object) and one based on the uplo field of the triangular
// matrix's root object (whether that is matrix A or matrix B).
if ( bli_obj_root_is_triangular( a ) )
if ( bli_obj_is_triangular( bli_obj_root( a ) ) )
{
side = 0;
if ( bli_obj_root_is_lower( a ) ) uplo = 0;
if ( bli_obj_is_lower( bli_obj_root( a ) ) ) uplo = 0;
else uplo = 1;
}
else // if ( bli_obj_root_is_triangular( b ) )
else // if ( bli_obj_is_triangular( bli_obj_root( b ) ) )
{
side = 1;
if ( bli_obj_root_is_lower( b ) ) uplo = 0;
if ( bli_obj_is_lower( bli_obj_root( b ) ) ) uplo = 0;
else uplo = 1;
}

Expand Down
4 changes: 2 additions & 2 deletions frame/3/trsm/bli_trsm_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void bli_trsm_int
// Set two bools: one based on the implied side parameter (the structure
// of the root object) and one based on the uplo field of the triangular
// matrix's root object (whether that is matrix A or matrix B).
if ( bli_obj_root_is_triangular( a ) )
if ( bli_obj_is_triangular( bli_obj_root( a ) ) )
{
// If alpha is non-unit, typecast and apply it to the scalar
// attached to B (the non-triangular matrix).
Expand All @@ -108,7 +108,7 @@ void bli_trsm_int
bli_obj_scalar_apply_scalar( alpha, &b_local );
}
}
else // if ( bli_obj_root_is_triangular( b ) )
else // if ( bli_obj_is_triangular( bli_obj_root( b ) ) )
{
// If alpha is non-unit, typecast and apply it to the scalar
// attached to A (the non-triangular matrix).
Expand Down
8 changes: 4 additions & 4 deletions frame/3/trsm/bli_trsm_xx_ker_var2.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ void bli_trsm_xx_ker_var2
// Set two bools: one based on the implied side parameter (the structure
// of the root object) and one based on the uplo field of the triangular
// matrix's root object (whether that is matrix A or matrix B).
if ( bli_obj_root_is_triangular( a ) )
if ( bli_obj_is_triangular( bli_obj_root( a ) ) )
{
side = 0;
if ( bli_obj_root_is_lower( a ) ) uplo = 0;
if ( bli_obj_is_lower( bli_obj_root( a ) ) ) uplo = 0;
else uplo = 1;
}
else // if ( bli_obj_root_is_triangular( b ) )
else // if ( bli_obj_is_triangular( bli_obj_root( b ) ) )
{
side = 1;
if ( bli_obj_root_is_lower( b ) ) uplo = 0;
if ( bli_obj_is_lower( bli_obj_root( b ) ) ) uplo = 0;
else uplo = 1;
}

Expand Down
24 changes: 12 additions & 12 deletions frame/base/bli_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,21 +356,21 @@ void bli_obj_free

buf_a = bli_obj_buffer_at_off( a );

bli_zzsets( 0.0, 0.0, value );
bli_zzsets( 0.0, 0.0, value );

if ( bli_obj_is_float( a ) )
if ( bli_obj_dt( a ) == BLIS_FLOAT )
{
bli_szcopys( *(( float* )buf_a), value );
}
else if ( bli_obj_is_double( a ) )
else if ( bli_obj_dt( a ) == BLIS_DOUBLE )
{
bli_dzcopys( *(( double* )buf_a), value );
}
else if ( bli_obj_is_scomplex( a ) )
else if ( bli_obj_dt( a ) == BLIS_SCOMPLEX )
{
bli_czcopys( *(( scomplex* )buf_a), value );
}
else if ( bli_obj_is_dcomplex( a ) )
else if ( bli_obj_dt( a ) == BLIS_DCOMPLEX )
{
bli_zzcopys( *(( dcomplex* )buf_a), value );
}
Expand Down Expand Up @@ -500,7 +500,7 @@ void bli_adjust_strides
// Set the column stride to indicate that this is a column vector
// stored in column-major order. This is done for legacy reasons,
// because we at one time we had to satisify the error checking
// in the underlying BLAS library, which expects the leading
// in the underlying BLAS library, which expects the leading
// dimension to be set to at least m, even if it will never be
// used for indexing since it is a vector and thus only has one
// column of data.
Expand Down Expand Up @@ -664,9 +664,9 @@ void bli_obj_print
fprintf( file, " ps %lu\n", ( unsigned long )bli_obj_panel_stride( obj ) );
fprintf( file, "\n" );

fprintf( file, " info %lX\n", ( unsigned long )(*obj).info );
fprintf( file, " info \n" );
fprintf( file, " - is complex %lu\n", ( unsigned long )bli_obj_is_complex( obj ) );
fprintf( file, " - is d. prec %lu\n", ( unsigned long )bli_obj_is_double_prec( obj ) );
fprintf( file, " - is d. prec %lu\n", ( unsigned long )bli_is_double_prec( bli_obj_dt( obj ) ) );
fprintf( file, " - datatype %lu\n", ( unsigned long )bli_obj_dt( obj ) );
fprintf( file, " - target dt %lu\n", ( unsigned long )bli_obj_target_dt( obj ) );
fprintf( file, " - exec dt %lu\n", ( unsigned long )bli_obj_exec_dt( obj ) );
Expand All @@ -675,16 +675,16 @@ void bli_obj_print
fprintf( file, " - has trans %lu\n", ( unsigned long )bli_obj_has_trans( obj ) );
fprintf( file, " - has conj %lu\n", ( unsigned long )bli_obj_has_conj( obj ) );
fprintf( file, " - unit diag? %lu\n", ( unsigned long )bli_obj_has_unit_diag( obj ) );
fprintf( file, " - struc type %lu\n", ( unsigned long )bli_obj_struc( obj ) >> BLIS_STRUC_SHIFT );
fprintf( file, " - uplo type %lu\n", ( unsigned long )bli_obj_uplo( obj ) >> BLIS_UPLO_SHIFT );
fprintf( file, " - struc type %lu\n", ( unsigned long )bli_obj_struc( obj ) );
fprintf( file, " - uplo type %lu\n", ( unsigned long )bli_obj_uplo( obj ) );
fprintf( file, " - is upper %lu\n", ( unsigned long )bli_obj_is_upper( obj ) );
fprintf( file, " - is lower %lu\n", ( unsigned long )bli_obj_is_lower( obj ) );
fprintf( file, " - is dense %lu\n", ( unsigned long )bli_obj_is_dense( obj ) );
fprintf( file, " - pack schema %lu\n", ( unsigned long )bli_obj_pack_schema( obj ) >> BLIS_PACK_SCHEMA_SHIFT );
fprintf( file, " - pack schema %lu\n", ( unsigned long )bli_obj_pack_schema( obj ) );
fprintf( file, " - packinv diag? %lu\n", ( unsigned long )bli_obj_has_inverted_diag( obj ) );
fprintf( file, " - pack ordifup %lu\n", ( unsigned long )bli_obj_is_pack_rev_if_upper( obj ) );
fprintf( file, " - pack ordiflo %lu\n", ( unsigned long )bli_obj_is_pack_rev_if_lower( obj ) );
fprintf( file, " - packbuf type %lu\n", ( unsigned long )bli_obj_pack_buffer_type( obj ) >> BLIS_PACK_BUFFER_SHIFT );
fprintf( file, " - packbuf type %lu\n", ( unsigned long )bli_obj_pack_buffer_type( obj ) );
fprintf( file, "\n" );
}

30 changes: 15 additions & 15 deletions frame/base/bli_part.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void bli_acquire_mpart_mdim
// object is packed to row or column storage, as such objects can be
// partitioned through normally.) Note that the function called below
// assumes forward partitioning.
if ( bli_obj_is_panel_packed( obj ) )
if ( bli_is_panel_packed( bli_obj_pack_schema( obj ) ) )
{
bli_packm_acquire_mpart_t2b( req_part, i, b, obj, sub_obj );
return;
Expand Down Expand Up @@ -266,7 +266,7 @@ void bli_acquire_mpart_mdim
// diagonal, then set the subpartition structure to "general"; otherwise
// we let the subpartition inherit the storage structure of its immediate
// parent.
if ( !bli_obj_root_is_general( sub_obj ) &&
if ( !bli_obj_is_general( bli_obj_root( sub_obj ) ) &&
bli_obj_is_outside_diag( sub_obj ) )
{
// NOTE: This comment may be out-of-date since we now distinguish
Expand All @@ -287,16 +287,16 @@ void bli_acquire_mpart_mdim
// matrix is triangular, the subpartition should be marked as zero.
if ( bli_obj_is_unstored_subpart( sub_obj ) )
{
if ( bli_obj_root_is_hermitian( sub_obj ) )
if ( bli_obj_is_hermitian( bli_obj_root( sub_obj ) ) )
{
bli_obj_reflect_about_diag( sub_obj );
bli_obj_toggle_conj( sub_obj );
}
else if ( bli_obj_root_is_symmetric( sub_obj ) )
else if ( bli_obj_is_symmetric( bli_obj_root( sub_obj ) ) )
{
bli_obj_reflect_about_diag( sub_obj );
}
else if ( bli_obj_root_is_triangular( sub_obj ) )
else if ( bli_obj_is_triangular( bli_obj_root( sub_obj ) ) )
{
bli_obj_set_uplo( BLIS_ZEROS, sub_obj );
}
Expand Down Expand Up @@ -355,7 +355,7 @@ void bli_acquire_mpart_ndim
// object is packed to row or column storage, as such objects can be
// partitioned through normally.) Note that the function called below
// assumes forward partitioning.
if ( bli_obj_is_panel_packed( obj ) )
if ( bli_is_panel_packed( bli_obj_pack_schema( obj ) ) )
{
bli_packm_acquire_mpart_l2r( req_part, j, b, obj, sub_obj );
return;
Expand Down Expand Up @@ -489,7 +489,7 @@ void bli_acquire_mpart_ndim
// diagonal), and the subpartition does not intersect the root matrix's
// diagonal, then we might need to modify some of the subpartition's
// properties, depending on its structure type.
if ( !bli_obj_root_is_general( sub_obj ) &&
if ( !bli_obj_is_general( bli_obj_root( sub_obj ) ) &&
bli_obj_is_outside_diag( sub_obj ) )
{
// NOTE: This comment may be out-of-date since we now distinguish
Expand All @@ -510,16 +510,16 @@ void bli_acquire_mpart_ndim
// matrix is triangular, the subpartition should be marked as zero.
if ( bli_obj_is_unstored_subpart( sub_obj ) )
{
if ( bli_obj_root_is_hermitian( sub_obj ) )
if ( bli_obj_is_hermitian( bli_obj_root( sub_obj ) ) )
{
bli_obj_reflect_about_diag( sub_obj );
bli_obj_toggle_conj( sub_obj );
}
else if ( bli_obj_root_is_symmetric( sub_obj ) )
else if ( bli_obj_is_symmetric( bli_obj_root( sub_obj ) ) )
{
bli_obj_reflect_about_diag( sub_obj );
}
else if ( bli_obj_root_is_triangular( sub_obj ) )
else if ( bli_obj_is_triangular( bli_obj_root( sub_obj ) ) )
{
bli_obj_set_uplo( BLIS_ZEROS, sub_obj );
}
Expand Down Expand Up @@ -579,7 +579,7 @@ void bli_acquire_mpart_mndim
// object is packed to row or column storage, as such objects can be
// partitioned through normally.) Note that the function called below
// assumes forward partitioning.
if ( bli_obj_is_panel_packed( obj ) )
if ( bli_is_panel_packed( bli_obj_pack_schema( obj ) ) )
{
bli_packm_acquire_mpart_tl2br( req_part, ij, b, obj, sub_obj );
return;
Expand Down Expand Up @@ -742,7 +742,7 @@ void bli_acquire_mpart_mndim
// diagonal, then set the subpartition structure to "general"; otherwise
// we let the subpartition inherit the storage structure of its immediate
// parent.
if ( !bli_obj_root_is_general( sub_obj ) &&
if ( !bli_obj_is_general( bli_obj_root( sub_obj ) ) &&
req_part != BLIS_SUBPART00 &&
req_part != BLIS_SUBPART11 &&
req_part != BLIS_SUBPART22 )
Expand Down Expand Up @@ -775,16 +775,16 @@ void bli_acquire_mpart_mndim
// matrix is triangular, the subpartition should be marked as zero.
if ( bli_obj_is_unstored_subpart( sub_obj ) )
{
if ( bli_obj_root_is_hermitian( sub_obj ) )
if ( bli_obj_is_hermitian( bli_obj_root( sub_obj ) ) )
{
bli_obj_reflect_about_diag( sub_obj );
bli_obj_toggle_conj( sub_obj );
}
else if ( bli_obj_root_is_symmetric( sub_obj ) )
else if ( bli_obj_is_symmetric( bli_obj_root( sub_obj ) ) )
{
bli_obj_reflect_about_diag( sub_obj );
}
else if ( bli_obj_root_is_triangular( sub_obj ) )
else if ( bli_obj_is_triangular( bli_obj_root( sub_obj ) ) )
{
bli_obj_set_uplo( BLIS_ZEROS, sub_obj );
}
Expand Down
4 changes: 2 additions & 2 deletions frame/base/bli_prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ void bli_prune_unref_mparts( obj_t* p, mdim_t mdim_p,
// Only update the affected offset fields if the object in question
// is NOT a packed object. Otherwise, bli_obj_buffer_at_off() will
// compute the wrong address within the macro-kernel object wrapper.
if ( !bli_obj_is_packed( p ) ) { bli_obj_inc_off( mdim_p, off_inc, p ); }
if ( !bli_obj_is_packed( s ) ) { bli_obj_inc_off( mdim_s, off_inc, s ); }
if ( !bli_is_packed( bli_obj_pack_schema( p ) ) ) { bli_obj_inc_off( mdim_p, off_inc, p ); }
if ( !bli_is_packed( bli_obj_pack_schema( s ) ) ) { bli_obj_inc_off( mdim_s, off_inc, s ); }
}
}