Skip to content

Commit

Permalink
Converted function-like macros to static functions.
Browse files Browse the repository at this point in the history
Details:
- Converted most C preprocessor macros in bli_param_macro_defs.h and
  bli_obj_macro_defs.h to static functions.
- Reshuffled some functions/macros to bli_misc_macro_defs.h and also
  between bli_param_macro_defs.h and bli_obj_macro_defs.h.
- Changed obj_t-initializing macros in bli_type_defs.h to static
  functions.
- Removed some old references to BLIS_TWO and BLIS_MINUS_TWO from
  bli_constants.h.
- Whitespace changes in select files (four spaces to single tab).
  • Loading branch information
fgvanzee committed May 8, 2018
1 parent 75d0d10 commit 4b36e85
Show file tree
Hide file tree
Showing 247 changed files with 5,435 additions and 5,305 deletions.
2 changes: 1 addition & 1 deletion config/template/kernels/1/bli_dotv_template_noopt_var1.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void bli_zdotv_template_noopt
// toggling the effective conjugation of x and then conjugating the
// resulting dot product.
if ( bli_is_conj( conjy ) )
bli_toggle_conj( conjx_use );
bli_toggle_conj( &conjx_use );


// Iterate over elements of x and y to compute:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void bli_zdotaxpyv_template_noopt
// toggling the effective conjugation of xt and then conjugating the
// resulting dot product.
if ( bli_is_conj( conjy ) )
bli_toggle_conj( conjxt_use );
bli_toggle_conj( &conjxt_use );


// Iterate over elements of x, y, and z to compute:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void bli_zdotxaxpyf_template_noopt
// toggling the effective conjugation of At and then conjugating the
// resulting dot products.
if ( bli_is_conj( conjw ) )
bli_toggle_conj( conjat_use );
bli_toggle_conj( &conjat_use );


// Iterate over the columns of A and elements of w and z to compute:
Expand Down
2 changes: 1 addition & 1 deletion config/template/kernels/1f/bli_dotxf_template_noopt_var1.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void bli_zdotxf_template_noopt
// toggling the effective conjugation of A and then conjugating the
// resulting product A^T*x.
if ( bli_is_conj( conjx ) )
bli_toggle_conj( conjat_use );
bli_toggle_conj( &conjat_use );


// Iterate over columns of A and rows of x to compute:
Expand Down
48 changes: 24 additions & 24 deletions examples/oapi/0obj_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ int main( int argc, char** argv )

// Let's inspect the amount of padding inserted for alignment. Note
// the difference between the m dimension and the column stride.
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( a8 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( a8 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( a8 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( a8 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( a8 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( a8 ) );
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( &a8 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( &a8 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( &a8 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( &a8 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( &a8 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( &a8 ) );

//
// Example 6: Inspect object fields after creation of other floating-
Expand All @@ -139,28 +139,28 @@ int main( int argc, char** argv )
bli_obj_create( BLIS_SCOMPLEX, 3, 5, 0, 0, &a10);
bli_obj_create( BLIS_DCOMPLEX, 3, 5, 0, 0, &a11 );

printf( "datatype %s\n", bli_dt_string( bli_obj_dt( a9 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( a9 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( a9 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( a9 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( a9 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( a9 ) );
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( &a9 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( &a9 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( &a9 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( &a9 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( &a9 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( &a9 ) );

printf( "\n" );
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( a10 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( a10 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( a10 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( a10 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( a10 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( a10 ) );
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( &a10 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( &a10 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( &a10 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( &a10 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( &a10 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( &a10 ) );

printf( "\n" );
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( a11 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( a11 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( a11 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( a11 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( a11 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( a11 ) );
printf( "datatype %s\n", bli_dt_string( bli_obj_dt( &a11 ) ) );
printf( "datatype size %d bytes\n", bli_dt_size( bli_obj_dt( &a11 ) ) );
printf( "m dim (# of rows): %d\n", ( int )bli_obj_length( &a11 ) );
printf( "n dim (# of cols): %d\n", ( int )bli_obj_width( &a11 ) );
printf( "row stride: %d\n", ( int )bli_obj_row_stride( &a11 ) );
printf( "col stride: %d\n", ( int )bli_obj_col_stride( &a11 ) );

//
// Example 7: Initialize an object's elements to random values and then
Expand Down
6 changes: 3 additions & 3 deletions examples/oapi/5level1m.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int main( int argc, char** argv )
// on 'e', the input operand. Transposition can be indicated by setting a
// bit in the object. Since it always starts out as "no transpose", we can
// simply toggle the bit.
bli_obj_toggle_trans( e );
bli_obj_toggle_trans( &e );

// Another way to mark and object for transposition is to set it directly.
//bli_obj_set_onlytrans( BLIS_TRANSPOSE, &e );
Expand Down Expand Up @@ -192,8 +192,8 @@ int main( int argc, char** argv )
bli_printm( "h (initial value):", &h, "%4.1f", "" );

// Set both the transpose and conjugation bits.
bli_obj_toggle_trans( g );
bli_obj_toggle_conj( g );
bli_obj_toggle_trans( &g );
bli_obj_toggle_conj( &g );

// Copy 'g' to 'h', conjugating and transposing 'g' in the process.
// Once again, notice that it's the source operand that we've marked for
Expand Down
40 changes: 20 additions & 20 deletions examples/oapi/6level1m_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ int main( int argc, char** argv )
bli_obj_create( dt, m, n, rs, cs, &a );

// First, we mark the matrix structure as triangular.
bli_obj_set_struc( BLIS_TRIANGULAR, a )
bli_obj_set_struc( BLIS_TRIANGULAR, &a )

// Next, we specify whether the lower part or the upper part is to be
// recognized as the "stored" region (which we call the uplo field). The
// strictly opposite part (in this case, the strictly lower region) will
// be *assumed* to be zero during computation. However, when printed out,
// the strictly lower part may contain junk values.
bli_obj_set_uplo( BLIS_UPPER, a );
bli_obj_set_uplo( BLIS_UPPER, &a );

// Now set the upper triangle to random values.
bli_randm( &a );
Expand All @@ -89,16 +89,16 @@ int main( int argc, char** argv )
bli_obj_create( dt, m, n, rs, cs, &b );

// Set structure and uplo.
bli_obj_set_struc( BLIS_TRIANGULAR, b )
bli_obj_set_uplo( BLIS_UPPER, b );
bli_obj_set_struc( BLIS_TRIANGULAR, &b )
bli_obj_set_uplo( BLIS_UPPER, &b );

// Create an alias, 'bl', of the original object 'b'. Both objects will
// refer to the same underlying matrix elements, but now we will have two
// different "views" into the matrix. Aliases are simply "shallow copies"
// of the objects, meaning no additional memory allocation takes place.
// Therefore it is up to the API user (you) to make sure that you only
// free the original object (or exactly one of the aliases).
bli_obj_alias_to( b, bl );
bli_obj_alias_to( &b, &bl );

// Digression: Each object contains a diagonal offset (even vectors),
// even if it is never needed. The diagonal offset for a newly-created
Expand All @@ -111,10 +111,10 @@ int main( int argc, char** argv )
// x-axis value.

// Set the diagonal offset of 'bl' to -1.
bli_obj_set_diag_offset( -1, bl );
bli_obj_set_diag_offset( -1, &bl );

// Set the uplo field of 'bl' to "lower".
bli_obj_set_uplo( BLIS_LOWER, bl );
bli_obj_set_uplo( BLIS_LOWER, &bl );

// Set the upper triangle of 'b' to random values.
bli_randm( &b );
Expand Down Expand Up @@ -148,7 +148,7 @@ int main( int argc, char** argv )
bli_obj_create( dt, m, n, rs, cs, &c );

// Reset the diagonal offset of 'bl' to 0.
bli_obj_set_diag_offset( 0, bl );
bli_obj_set_diag_offset( 0, &bl );

// Copy the lower triangle of matrix 'b' from Example 2 to object 'c'.
// This should give us -1.0 in the strictly lower part and some non-zero
Expand Down Expand Up @@ -212,7 +212,7 @@ int main( int argc, char** argv )

// We want to pluck out the lower triangle and transpose it into the upper
// triangle of 'd'.
bli_obj_toggle_trans( bl );
bli_obj_toggle_trans( &bl );

// Now we copy the transpose of the lower part of 'bl' into the upper
// part of 'd'. (Again, notice that we haven't modified any properties of
Expand Down Expand Up @@ -242,11 +242,11 @@ int main( int argc, char** argv )
bli_printm( "e: initial value (all -1.0)", &e, "%4.1f", "" );

// Create an alias to work with.
bli_obj_alias_to( e, el );
bli_obj_alias_to( &e, &el );

// Set structure and uplo of 'el'.
bli_obj_set_struc( BLIS_TRIANGULAR, el )
bli_obj_set_uplo( BLIS_LOWER, el );
bli_obj_set_struc( BLIS_TRIANGULAR, &el )
bli_obj_set_uplo( BLIS_LOWER, &el );

// Digression: Notice that "triangular" structure does not require that
// the matrix be square. Rather, it simply means that either the part above
Expand All @@ -259,8 +259,8 @@ int main( int argc, char** argv )

// Move the diagonal offset of 'el' to 1 and flip the uplo field to
// "upper".
bli_obj_set_diag_offset( 1, el );
bli_obj_set_uplo( BLIS_UPPER, el );
bli_obj_set_diag_offset( 1, &el );
bli_obj_set_uplo( BLIS_UPPER, &el );

// Set the upper triangle to zero.
bli_setm( &BLIS_ZERO, &el );
Expand All @@ -287,23 +287,23 @@ int main( int argc, char** argv )
bli_printm( "h: initial value (all -1.0)", &h, "%4.1f", "" );

// Set the diagonal offset of 'h' to -1.
bli_obj_set_diag_offset( -1, h );
bli_obj_set_diag_offset( -1, &h );

// Set the structure and uplo of 'h'.
bli_obj_set_struc( BLIS_TRIANGULAR, h )
bli_obj_set_uplo( BLIS_UPPER, h );
bli_obj_set_struc( BLIS_TRIANGULAR, &h )
bli_obj_set_uplo( BLIS_UPPER, &h );

// Randomize the elements on and above the first subdiagonal.
bli_randm( &h );

bli_printm( "h: after randomizing above first subdiagonal", &h, "%4.1f", "" );

// Create an alias to work with.
bli_obj_alias_to( h, hl );
bli_obj_alias_to( &h, &hl );

// Flip the uplo of 'hl' and move the diagonal down by one.
bli_obj_set_uplo( BLIS_LOWER, hl );
bli_obj_set_diag_offset( -2, hl );
bli_obj_set_uplo( BLIS_LOWER, &hl );
bli_obj_set_diag_offset( -2, &hl );

// Set the region strictly below the first subdiagonal (on or below
// the second subdiagonal) to zero.
Expand Down
16 changes: 8 additions & 8 deletions examples/oapi/7level2.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as symmetric and stored in the lower triangle, and
// then randomize that lower triangle.
bli_obj_set_struc( BLIS_SYMMETRIC, a )
bli_obj_set_uplo( BLIS_LOWER, a );
bli_obj_set_struc( BLIS_SYMMETRIC, &a )
bli_obj_set_uplo( BLIS_LOWER, &a );
bli_randm( &a );

bli_printm( "x: set to random values", &x, "%4.1f", "" );
Expand Down Expand Up @@ -200,8 +200,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as symmetric and stored in the upper triangle, and
// then randomize that upper triangle.
bli_obj_set_struc( BLIS_SYMMETRIC, a )
bli_obj_set_uplo( BLIS_UPPER, a );
bli_obj_set_struc( BLIS_SYMMETRIC, &a )
bli_obj_set_uplo( BLIS_UPPER, &a );
bli_randm( &a );

bli_printm( "a: randomized (zeros in lower triangle)", &a, "%4.1f", "" );
Expand Down Expand Up @@ -242,8 +242,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as triangular and stored in the lower triangle, and
// then randomize that lower triangle.
bli_obj_set_struc( BLIS_TRIANGULAR, a )
bli_obj_set_uplo( BLIS_LOWER, a );
bli_obj_set_struc( BLIS_TRIANGULAR, &a )
bli_obj_set_uplo( BLIS_LOWER, &a );
bli_randm( &a );

bli_printm( "a: randomized (zeros in upper triangle)", &a, "%4.1f", "" );
Expand Down Expand Up @@ -283,8 +283,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as triangular and stored in the lower triangle, and
// then randomize that lower triangle.
bli_obj_set_struc( BLIS_TRIANGULAR, a )
bli_obj_set_uplo( BLIS_LOWER, a );
bli_obj_set_struc( BLIS_TRIANGULAR, &a )
bli_obj_set_uplo( BLIS_LOWER, &a );
bli_randm( &a );

// Load the diagonal. By setting the diagonal to something of greater
Expand Down
18 changes: 9 additions & 9 deletions examples/oapi/8level3.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int main( int argc, char** argv )
bli_setm( &BLIS_ZERO, &cc );

// Set the transpose bit in 'aa'.
bli_obj_toggle_trans( aa );
bli_obj_toggle_trans( &aa );

bli_printm( "a: randomized", &aa, "%4.1f", "" );
bli_printm( "b: set to 1.0", &bb, "%4.1f", "" );
Expand Down Expand Up @@ -148,8 +148,8 @@ int main( int argc, char** argv )

// Mark matrix 'c' as symmetric and stored in the lower triangle, and
// then randomize that lower triangle.
bli_obj_set_struc( BLIS_SYMMETRIC, c )
bli_obj_set_uplo( BLIS_LOWER, c );
bli_obj_set_struc( BLIS_SYMMETRIC, &c )
bli_obj_set_uplo( BLIS_LOWER, &c );
bli_randm( &c );

bli_printm( "a: set to random values", &a, "%4.1f", "" );
Expand Down Expand Up @@ -194,8 +194,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as symmetric and stored in the upper triangle, and
// then randomize that upper triangle.
bli_obj_set_struc( BLIS_SYMMETRIC, a )
bli_obj_set_uplo( BLIS_UPPER, a );
bli_obj_set_struc( BLIS_SYMMETRIC, &a )
bli_obj_set_uplo( BLIS_UPPER, &a );
bli_randm( &a );

bli_printm( "a: randomized (zeros in lower triangle)", &a, "%4.1f", "" );
Expand Down Expand Up @@ -241,8 +241,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as triangular and stored in the lower triangle, and
// then randomize that lower triangle.
bli_obj_set_struc( BLIS_TRIANGULAR, a )
bli_obj_set_uplo( BLIS_LOWER, a );
bli_obj_set_struc( BLIS_TRIANGULAR, &a )
bli_obj_set_uplo( BLIS_LOWER, &a );
bli_randm( &a );

bli_printm( "a: randomized (zeros in upper triangle)", &a, "%4.1f", "" );
Expand Down Expand Up @@ -286,8 +286,8 @@ int main( int argc, char** argv )

// Mark matrix 'a' as triangular and stored in the lower triangle, and
// then randomize that lower triangle.
bli_obj_set_struc( BLIS_TRIANGULAR, a )
bli_obj_set_uplo( BLIS_LOWER, a );
bli_obj_set_struc( BLIS_TRIANGULAR, &a )
bli_obj_set_uplo( BLIS_LOWER, &a );
bli_randm( &a );

// Load the diagonal. By setting the diagonal to something of greater
Expand Down
Loading

0 comments on commit 4b36e85

Please sign in to comment.