mirror of
https://github.com/amd/blis.git
synced 2026-04-20 07:38:53 +00:00
Add err_t* "return" parameter to malloc functions.
Details: - Added an err_t* parameter to memory allocation functions including bli_malloc_intl(), bli_calloc_intl(), bli_malloc_user(), bli_fmalloc_align(), and bli_fmalloc_noalign(). Since these functions already use the return value to return the allocated memory address, they can't communicate errors to the caller through the return value. This commit does not employ any error checking within these functions or their callers, but this sets up BLIS for a more comprehensive commit that moves in that direction. - Moved the typedefs for malloc_ft and free_ft from bli_malloc.h to bli_type_defs.h. This was done so that what remains of bli_malloc.h can be included after the definition of the err_t enum. (This ordering was needed because bli_malloc.h now contains function prototypes that use err_t.) - Defined bli_is_success() and bli_is_failure() static functions in bli_param_macro_defs.h. These functions provide easy checks for error codes and will be used more heavily in future commits. - Unfortunately, the additional err_t* argument discussed above breaks the API for bli_malloc_user(), which is an exported symbol in the shared library. However, it's quite possible that the only application that calls bli_malloc_user()--indeed, the reason it is was marked for symbol exporting to begin with--is the BLIS testsuite. And if that's the case, this breakage won't affect anyone. Nonetheless, the "major" part of the so_version file has been updated accordingly to 4.0.0.
This commit is contained in:
@@ -45,13 +45,14 @@ cntl_t* bli_unpackm_cntl_create_node
|
||||
{
|
||||
cntl_t* cntl;
|
||||
unpackm_params_t* params;
|
||||
err_t r_val;
|
||||
|
||||
// NOTE: If this function is ever called, figure out whether the
|
||||
// bli_malloc_intl() below needs to be changed to bli_sba_acquire().
|
||||
bli_abort();
|
||||
|
||||
// Allocate an unpackm_params_t struct.
|
||||
params = bli_malloc_intl( sizeof( unpackm_params_t ) );
|
||||
params = bli_malloc_intl( sizeof( unpackm_params_t ), &r_val );
|
||||
|
||||
// Initialize the unpackm_params_t struct.
|
||||
params->size = sizeof( unpackm_params_t );
|
||||
|
||||
@@ -39,6 +39,8 @@ void bli_apool_init
|
||||
apool_t* restrict apool
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// NOTE: The apool_t is only used in one place; it is the type used to
|
||||
// define the sba. We've switched to static initialization of the mutex
|
||||
// field to remove one more thing that could possibly go wrong during
|
||||
@@ -92,7 +94,7 @@ void bli_apool_init
|
||||
// Allocate the block_ptrs array.
|
||||
array_t** restrict block_ptrs
|
||||
=
|
||||
bli_malloc_intl( block_ptrs_len * sizeof( array_t* ) );
|
||||
bli_malloc_intl( block_ptrs_len * sizeof( array_t* ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_apool_init(): allocating %d array_t.\n", ( int )num_blocks );
|
||||
@@ -141,6 +143,8 @@ void bli_apool_alloc_block
|
||||
array_t** restrict array_p
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// Since the apool_t is defined as a pool of array_t, we can hard-code
|
||||
// the block_size parameter.
|
||||
const siz_t block_size = sizeof( array_t );
|
||||
@@ -154,7 +158,7 @@ void bli_apool_alloc_block
|
||||
// be recovered when it's time to free the block.
|
||||
array_t* restrict array
|
||||
=
|
||||
bli_malloc_intl( block_size );
|
||||
bli_malloc_intl( block_size, &r_val );
|
||||
|
||||
// Initialize an array_t struct within the newly allocated memory region.
|
||||
bli_array_init( num_elem, sizeof( pool_t* ), array );
|
||||
@@ -376,6 +380,8 @@ pool_t* bli_apool_array_elem
|
||||
array_t* restrict array
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// Query the array element corresponding to index.
|
||||
// NOTE: If we knew that the array_t contained elements of size
|
||||
// sizeof( void* ) or sizeof( whatever ), we could return the *value*
|
||||
@@ -425,7 +431,7 @@ pool_t* bli_apool_array_elem
|
||||
#endif
|
||||
|
||||
// Allocate the pool_t.
|
||||
pool = bli_malloc_intl( sizeof( pool_t ) );
|
||||
pool = bli_malloc_intl( sizeof( pool_t ), &r_val );
|
||||
|
||||
// Initialize the pool_t.
|
||||
bli_pool_init
|
||||
@@ -461,6 +467,8 @@ void bli_apool_grow
|
||||
apool_t* restrict apool
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// If the requested increase is zero, return early.
|
||||
if ( num_blocks_add == 0 ) return;
|
||||
|
||||
@@ -501,7 +509,7 @@ void bli_apool_grow
|
||||
// Allocate a new block_ptrs array.
|
||||
array_t** restrict block_ptrs_new
|
||||
=
|
||||
bli_malloc_intl( block_ptrs_len_new * sizeof( array_t* ) );
|
||||
bli_malloc_intl( block_ptrs_len_new * sizeof( array_t* ), &r_val );
|
||||
|
||||
// Query the top_index of the pool.
|
||||
const siz_t top_index = bli_pool_top_index( pool );
|
||||
|
||||
@@ -43,6 +43,8 @@ void bli_array_init
|
||||
array_t* restrict array
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_array_init(): allocating array [%d * %d]: ",
|
||||
( int )num_elem, ( int )elem_size );
|
||||
@@ -52,7 +54,7 @@ void bli_array_init
|
||||
const size_t array_size = num_elem * elem_size;
|
||||
|
||||
// Allocate the array buffer.
|
||||
void* restrict buf = bli_malloc_intl( array_size );
|
||||
void* restrict buf = bli_malloc_intl( array_size, &r_val );
|
||||
|
||||
// Initialize the array elements to zero. THIS IS IMPORANT because
|
||||
// consumer threads will use the NULL-ness of the array elements to
|
||||
@@ -72,6 +74,8 @@ void bli_array_resize
|
||||
array_t* restrict array
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// Query the number of elements in the array.
|
||||
const siz_t num_elem_prev = bli_array_num_elem( array );
|
||||
|
||||
@@ -98,7 +102,7 @@ void bli_array_resize
|
||||
#endif
|
||||
|
||||
// Allocate a new array buffer.
|
||||
char* restrict buf_new = bli_malloc_intl( array_size_new );
|
||||
char* restrict buf_new = bli_malloc_intl( array_size_new, &r_val );
|
||||
|
||||
// Copy the previous array contents to the new array.
|
||||
memcpy( buf_new, buf_prev, array_size_prev );
|
||||
|
||||
@@ -42,7 +42,9 @@ blksz_t* bli_blksz_create_ed
|
||||
dim_t b_z, dim_t be_z
|
||||
)
|
||||
{
|
||||
blksz_t* b = bli_malloc_intl( sizeof( blksz_t ) );
|
||||
err_t r_val;
|
||||
|
||||
blksz_t* b = bli_malloc_intl( sizeof( blksz_t ), &r_val );
|
||||
|
||||
bli_blksz_init_ed
|
||||
(
|
||||
@@ -62,7 +64,9 @@ blksz_t* bli_blksz_create
|
||||
dim_t be_s, dim_t be_d, dim_t be_c, dim_t be_z
|
||||
)
|
||||
{
|
||||
blksz_t* b = bli_malloc_intl( sizeof( blksz_t ) );
|
||||
err_t r_val;
|
||||
|
||||
blksz_t* b = bli_malloc_intl( sizeof( blksz_t ), &r_val );
|
||||
|
||||
bli_blksz_init
|
||||
(
|
||||
|
||||
@@ -78,33 +78,34 @@ void bli_cntx_set_blkszs( ind_t method, dim_t n_bs, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
bszid_t* bszids = bli_malloc_intl( n_bs * sizeof( bszid_t ) );
|
||||
bszid_t* bszids = bli_malloc_intl( n_bs * sizeof( bszid_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
blksz_t** blkszs = bli_malloc_intl( n_bs * sizeof( blksz_t* ) );
|
||||
blksz_t** blkszs = bli_malloc_intl( n_bs * sizeof( blksz_t* ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
bszid_t* bmults = bli_malloc_intl( n_bs * sizeof( bszid_t ) );
|
||||
bszid_t* bmults = bli_malloc_intl( n_bs * sizeof( bszid_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
double* dsclrs = bli_malloc_intl( n_bs * sizeof( double ) );
|
||||
double* dsclrs = bli_malloc_intl( n_bs * sizeof( double ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
double* msclrs = bli_malloc_intl( n_bs * sizeof( double ) );
|
||||
double* msclrs = bli_malloc_intl( n_bs * sizeof( double ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -343,6 +344,7 @@ void bli_cntx_set_ind_blkszs( ind_t method, dim_t n_bs, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Return early if called with BLIS_NAT.
|
||||
if ( method == BLIS_NAT ) return;
|
||||
@@ -352,17 +354,17 @@ void bli_cntx_set_ind_blkszs( ind_t method, dim_t n_bs, ... )
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_ind_blkszs(): " );
|
||||
#endif
|
||||
bszid_t* bszids = bli_malloc_intl( n_bs * sizeof( bszid_t ) );
|
||||
bszid_t* bszids = bli_malloc_intl( n_bs * sizeof( bszid_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_ind_blkszs(): " );
|
||||
#endif
|
||||
double* dsclrs = bli_malloc_intl( n_bs * sizeof( double ) );
|
||||
double* dsclrs = bli_malloc_intl( n_bs * sizeof( double ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_ind_blkszs(): " );
|
||||
#endif
|
||||
double* msclrs = bli_malloc_intl( n_bs * sizeof( double ) );
|
||||
double* msclrs = bli_malloc_intl( n_bs * sizeof( double ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -523,28 +525,29 @@ void bli_cntx_set_l3_nat_ukrs( dim_t n_ukrs, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_nat_ukrs(): " );
|
||||
#endif
|
||||
l3ukr_t* ukr_ids = bli_malloc_intl( n_ukrs * sizeof( l3ukr_t ) );
|
||||
l3ukr_t* ukr_ids = bli_malloc_intl( n_ukrs * sizeof( l3ukr_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_nat_ukrs(): " );
|
||||
#endif
|
||||
num_t* ukr_dts = bli_malloc_intl( n_ukrs * sizeof( num_t ) );
|
||||
num_t* ukr_dts = bli_malloc_intl( n_ukrs * sizeof( num_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_nat_ukrs(): " );
|
||||
#endif
|
||||
void_fp* ukr_fps = bli_malloc_intl( n_ukrs * sizeof( void_fp ) );
|
||||
void_fp* ukr_fps = bli_malloc_intl( n_ukrs * sizeof( void_fp ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_nat_ukrs(): " );
|
||||
#endif
|
||||
bool* ukr_prefs = bli_malloc_intl( n_ukrs * sizeof( bool ) );
|
||||
bool* ukr_prefs = bli_malloc_intl( n_ukrs * sizeof( bool ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -680,23 +683,24 @@ void bli_cntx_set_l3_vir_ukrs( dim_t n_ukrs, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_vir_ukrs(): " );
|
||||
#endif
|
||||
l3ukr_t* ukr_ids = bli_malloc_intl( n_ukrs * sizeof( l3ukr_t ) );
|
||||
l3ukr_t* ukr_ids = bli_malloc_intl( n_ukrs * sizeof( l3ukr_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_vir_ukrs(): " );
|
||||
#endif
|
||||
num_t* ukr_dts = bli_malloc_intl( n_ukrs * sizeof( num_t ) );
|
||||
num_t* ukr_dts = bli_malloc_intl( n_ukrs * sizeof( num_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_vir_ukrs(): " );
|
||||
#endif
|
||||
void_fp* ukr_fps = bli_malloc_intl( n_ukrs * sizeof( void_fp ) );
|
||||
void_fp* ukr_fps = bli_malloc_intl( n_ukrs * sizeof( void_fp ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -800,20 +804,21 @@ void bli_cntx_set_l3_sup_thresh( dim_t n_thresh, ... )
|
||||
|
||||
*/
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_thresh(): " );
|
||||
#endif
|
||||
threshid_t* threshids = bli_malloc_intl( n_thresh * sizeof( threshid_t ) );
|
||||
threshid_t* threshids = bli_malloc_intl( n_thresh * sizeof( threshid_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_thresh(): " );
|
||||
#endif
|
||||
blksz_t** threshs = bli_malloc_intl( n_thresh * sizeof( blksz_t* ) );
|
||||
blksz_t** threshs = bli_malloc_intl( n_thresh * sizeof( blksz_t* ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -907,18 +912,19 @@ void bli_cntx_set_l3_sup_handlers( dim_t n_ops, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_handlers(): " );
|
||||
#endif
|
||||
opid_t* op_ids = bli_malloc_intl( n_ops * sizeof( opid_t ) );
|
||||
opid_t* op_ids = bli_malloc_intl( n_ops * sizeof( opid_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_handlers(): " );
|
||||
#endif
|
||||
void** op_fps = bli_malloc_intl( n_ops * sizeof( void* ) );
|
||||
void** op_fps = bli_malloc_intl( n_ops * sizeof( void* ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -1005,17 +1011,18 @@ void bli_cntx_set_l3_sup_blkszs( dim_t n_bs, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
bszid_t* bszids = bli_malloc_intl( n_bs * sizeof( bszid_t ) );
|
||||
bszid_t* bszids = bli_malloc_intl( n_bs * sizeof( bszid_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_blkszs(): " );
|
||||
#endif
|
||||
blksz_t** blkszs = bli_malloc_intl( n_bs * sizeof( blksz_t* ) );
|
||||
blksz_t** blkszs = bli_malloc_intl( n_bs * sizeof( blksz_t* ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -1109,28 +1116,29 @@ void bli_cntx_set_l3_sup_kers( dim_t n_ukrs, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_kers(): " );
|
||||
#endif
|
||||
stor3_t* st3_ids = bli_malloc_intl( n_ukrs * sizeof( stor3_t ) );
|
||||
stor3_t* st3_ids = bli_malloc_intl( n_ukrs * sizeof( stor3_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_kers(): " );
|
||||
#endif
|
||||
num_t* ukr_dts = bli_malloc_intl( n_ukrs * sizeof( num_t ) );
|
||||
num_t* ukr_dts = bli_malloc_intl( n_ukrs * sizeof( num_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_kers(): " );
|
||||
#endif
|
||||
void** ukr_fps = bli_malloc_intl( n_ukrs * sizeof( void* ) );
|
||||
void** ukr_fps = bli_malloc_intl( n_ukrs * sizeof( void* ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l3_sup_kers(): " );
|
||||
#endif
|
||||
bool* ukr_prefs = bli_malloc_intl( n_ukrs * sizeof( bool ) );
|
||||
bool* ukr_prefs = bli_malloc_intl( n_ukrs * sizeof( bool ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -1287,23 +1295,24 @@ void bli_cntx_set_l1f_kers( dim_t n_kers, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l1f_kers(): " );
|
||||
#endif
|
||||
l1fkr_t* ker_ids = bli_malloc_intl( n_kers * sizeof( l1fkr_t ) );
|
||||
l1fkr_t* ker_ids = bli_malloc_intl( n_kers * sizeof( l1fkr_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l1f_kers(): " );
|
||||
#endif
|
||||
num_t* ker_dts = bli_malloc_intl( n_kers * sizeof( num_t ) );
|
||||
num_t* ker_dts = bli_malloc_intl( n_kers * sizeof( num_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l1f_kers(): " );
|
||||
#endif
|
||||
void_fp* ker_fps = bli_malloc_intl( n_kers * sizeof( void_fp ) );
|
||||
void_fp* ker_fps = bli_malloc_intl( n_kers * sizeof( void_fp ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -1405,23 +1414,24 @@ void bli_cntx_set_l1v_kers( dim_t n_kers, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l1v_kers(): " );
|
||||
#endif
|
||||
l1vkr_t* ker_ids = bli_malloc_intl( n_kers * sizeof( l1vkr_t ) );
|
||||
l1vkr_t* ker_ids = bli_malloc_intl( n_kers * sizeof( l1vkr_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l1v_kers(): " );
|
||||
#endif
|
||||
num_t* ker_dts = bli_malloc_intl( n_kers * sizeof( num_t ) );
|
||||
num_t* ker_dts = bli_malloc_intl( n_kers * sizeof( num_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_l1v_kers(): " );
|
||||
#endif
|
||||
void_fp* ker_fps = bli_malloc_intl( n_kers * sizeof( void_fp ) );
|
||||
void_fp* ker_fps = bli_malloc_intl( n_kers * sizeof( void_fp ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
@@ -1523,23 +1533,24 @@ void bli_cntx_set_packm_kers( dim_t n_kers, ... )
|
||||
|
||||
va_list args;
|
||||
dim_t i;
|
||||
err_t r_val;
|
||||
|
||||
// Allocate some temporary local arrays.
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_packm_kers(): " );
|
||||
#endif
|
||||
l1mkr_t* ker_ids = bli_malloc_intl( n_kers * sizeof( l1mkr_t ) );
|
||||
l1mkr_t* ker_ids = bli_malloc_intl( n_kers * sizeof( l1mkr_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_packm_kers(): " );
|
||||
#endif
|
||||
num_t* ker_dts = bli_malloc_intl( n_kers * sizeof( num_t ) );
|
||||
num_t* ker_dts = bli_malloc_intl( n_kers * sizeof( num_t ), &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_cntx_set_packm_kers(): " );
|
||||
#endif
|
||||
void_fp* ker_fps = bli_malloc_intl( n_kers * sizeof( void_fp ) );
|
||||
void_fp* ker_fps = bli_malloc_intl( n_kers * sizeof( void_fp ), &r_val );
|
||||
|
||||
// -- Begin variable argument section --
|
||||
|
||||
|
||||
@@ -44,8 +44,9 @@ func_t* bli_func_create
|
||||
)
|
||||
{
|
||||
func_t* f;
|
||||
err_t r_val;
|
||||
|
||||
f = ( func_t* ) bli_malloc_intl( sizeof(func_t) );
|
||||
f = ( func_t* )bli_malloc_intl( sizeof( func_t ), &r_val );
|
||||
|
||||
bli_func_init
|
||||
(
|
||||
|
||||
@@ -327,6 +327,8 @@ void bli_gks_register_cntx
|
||||
void_fp ind_fp
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// This function is called by bli_gks_init() for each architecture that
|
||||
// will be supported by BLIS. It takes an architecture id and three
|
||||
// function pointers, one to a function that initializes a native context
|
||||
@@ -375,7 +377,7 @@ void bli_gks_register_cntx
|
||||
// needs to be allocated. Allocate the memory and initialize it to
|
||||
// zeros/NULL, storing the address of the alloacted memory at the element
|
||||
// for the current architecture id.
|
||||
gks[ id ] = bli_calloc_intl( sizeof( cntx_t* ) * BLIS_NUM_IND_METHODS );
|
||||
gks[ id ] = bli_calloc_intl( sizeof( cntx_t* ) * BLIS_NUM_IND_METHODS, &r_val );
|
||||
|
||||
// Alias the allocated array for readability.
|
||||
cntx_t** restrict gks_id = gks[ id ];
|
||||
@@ -387,7 +389,7 @@ void bli_gks_register_cntx
|
||||
// Allocate memory for a single context and store the address at
|
||||
// the element in the gks[ id ] array that is reserved for native
|
||||
// execution.
|
||||
gks_id[ BLIS_NAT ] = bli_calloc_intl( sizeof( cntx_t ) );
|
||||
gks_id[ BLIS_NAT ] = bli_calloc_intl( sizeof( cntx_t ), &r_val );
|
||||
|
||||
// Alias the allocated context address for readability.
|
||||
cntx_t* restrict gks_id_nat = gks_id[ BLIS_NAT ];
|
||||
@@ -484,6 +486,7 @@ cntx_t* bli_gks_query_ind_cntx
|
||||
bli_init_once();
|
||||
|
||||
cntx_t* gks_id_ind;
|
||||
err_t r_val;
|
||||
|
||||
// Return the address of a context that will be suited for executing a
|
||||
// level-3 operation via the requested induced method (and datatype) for
|
||||
@@ -542,7 +545,7 @@ cntx_t* bli_gks_query_ind_cntx
|
||||
// If gks_id_ind is NULL, then we know we must allocate and then
|
||||
// initialize the context, storing its address back to
|
||||
// gks_id[ ind ].
|
||||
gks_id_ind = bli_calloc_intl( sizeof( cntx_t ) );
|
||||
gks_id_ind = bli_calloc_intl( sizeof( cntx_t ), &r_val );
|
||||
gks_id[ ind ] = gks_id_ind;
|
||||
|
||||
// Before we can call the induced method context initialization
|
||||
|
||||
@@ -71,7 +71,7 @@ void bli_free_pool( void* p )
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void* bli_malloc_user( size_t size )
|
||||
void* bli_malloc_user( size_t size, err_t* r_val )
|
||||
{
|
||||
const malloc_ft malloc_fp = BLIS_MALLOC_USER;
|
||||
const size_t align_size = BLIS_HEAP_ADDR_ALIGN_SIZE;
|
||||
@@ -82,7 +82,9 @@ void* bli_malloc_user( size_t size )
|
||||
fflush( stdout );
|
||||
#endif
|
||||
|
||||
return bli_fmalloc_align( malloc_fp, size, align_size );
|
||||
void* p = bli_fmalloc_align( malloc_fp, size, align_size, r_val );
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void bli_free_user( void* p )
|
||||
@@ -97,7 +99,7 @@ void bli_free_user( void* p )
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void* bli_malloc_intl( size_t size )
|
||||
void* bli_malloc_intl( size_t size, err_t* r_val )
|
||||
{
|
||||
const malloc_ft malloc_fp = BLIS_MALLOC_INTL;
|
||||
|
||||
@@ -106,18 +108,21 @@ void* bli_malloc_intl( size_t size )
|
||||
fflush( stdout );
|
||||
#endif
|
||||
|
||||
return bli_fmalloc_noalign( malloc_fp, size );
|
||||
void* p = bli_fmalloc_noalign( malloc_fp, size, r_val );
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void* bli_calloc_intl( size_t size )
|
||||
void* bli_calloc_intl( size_t size, err_t* r_val )
|
||||
{
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_calloc_intl(): " );
|
||||
#endif
|
||||
|
||||
void* p = bli_malloc_intl( size );
|
||||
void* p = bli_malloc_intl( size, r_val );
|
||||
|
||||
memset( p, 0, size );
|
||||
if ( bli_is_success( *r_val ) )
|
||||
memset( p, 0, size );
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -138,7 +143,8 @@ void* bli_fmalloc_align
|
||||
(
|
||||
malloc_ft f,
|
||||
size_t size,
|
||||
size_t align_size
|
||||
size_t align_size,
|
||||
err_t* r_val
|
||||
)
|
||||
{
|
||||
const size_t ptr_size = sizeof( void* );
|
||||
@@ -165,6 +171,9 @@ void* bli_fmalloc_align
|
||||
if ( bli_error_checking_is_enabled() )
|
||||
bli_fmalloc_post_check( p_orig );
|
||||
|
||||
// The pseudo-return value isn't used yet.
|
||||
*r_val = BLIS_SUCCESS;
|
||||
|
||||
// Advance the pointer by one pointer element.
|
||||
p_byte = p_orig;
|
||||
p_byte += ptr_size;
|
||||
@@ -226,7 +235,8 @@ void bli_ffree_align
|
||||
void* bli_fmalloc_noalign
|
||||
(
|
||||
malloc_ft f,
|
||||
size_t size
|
||||
size_t size,
|
||||
err_t* r_val
|
||||
)
|
||||
{
|
||||
void* p = f( size );
|
||||
@@ -235,6 +245,9 @@ void* bli_fmalloc_noalign
|
||||
if ( bli_error_checking_is_enabled() )
|
||||
bli_fmalloc_post_check( p );
|
||||
|
||||
// The pseudo-return value isn't used yet.
|
||||
*r_val = BLIS_SUCCESS;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
*/
|
||||
|
||||
// Typedef function pointer types for malloc() and free() substitutes.
|
||||
typedef void* (*malloc_ft) ( size_t size );
|
||||
typedef void (*free_ft) ( void* p );
|
||||
//typedef void* (*malloc_ft) ( size_t size );
|
||||
//typedef void (*free_ft) ( void* p );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -44,19 +44,19 @@ BLIS_EXPORT_BLIS void* bli_malloc_pool( size_t size );
|
||||
BLIS_EXPORT_BLIS void bli_free_pool( void* p );
|
||||
#endif
|
||||
|
||||
void* bli_malloc_intl( size_t size );
|
||||
void* bli_calloc_intl( size_t size );
|
||||
void* bli_malloc_intl( size_t size, err_t* r_val );
|
||||
void* bli_calloc_intl( size_t size, err_t* r_val );
|
||||
void bli_free_intl( void* p );
|
||||
|
||||
BLIS_EXPORT_BLIS void* bli_malloc_user( size_t size );
|
||||
BLIS_EXPORT_BLIS void* bli_malloc_user( size_t size, err_t* r_val );
|
||||
BLIS_EXPORT_BLIS void bli_free_user( void* p );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void* bli_fmalloc_align( malloc_ft f, size_t size, size_t align_size );
|
||||
void* bli_fmalloc_align( malloc_ft f, size_t size, size_t align_size, err_t* r_val );
|
||||
void bli_ffree_align( free_ft f, void* p );
|
||||
|
||||
void* bli_fmalloc_noalign( malloc_ft f, size_t size );
|
||||
void* bli_fmalloc_noalign( malloc_ft f, size_t size, err_t* r_val );
|
||||
void bli_ffree_noalign( free_ft f, void* p );
|
||||
|
||||
void bli_fmalloc_align_check( malloc_ft f, size_t size, size_t align_size );
|
||||
|
||||
@@ -44,8 +44,9 @@ mbool_t* bli_mbool_create
|
||||
)
|
||||
{
|
||||
mbool_t* b;
|
||||
err_t r_val;
|
||||
|
||||
b = ( mbool_t* ) bli_malloc_intl( sizeof(mbool_t) );
|
||||
b = ( mbool_t* ) bli_malloc_intl( sizeof( mbool_t ), &r_val );
|
||||
|
||||
bli_mbool_init
|
||||
(
|
||||
|
||||
@@ -147,6 +147,7 @@ void bli_obj_alloc_buffer
|
||||
siz_t elem_size;
|
||||
siz_t buffer_size;
|
||||
void* p;
|
||||
err_t r_val;
|
||||
|
||||
bli_init_once();
|
||||
|
||||
@@ -195,7 +196,7 @@ void bli_obj_alloc_buffer
|
||||
buffer_size = ( siz_t )n_elem * elem_size;
|
||||
|
||||
// Allocate the buffer.
|
||||
p = bli_malloc_user( buffer_size );
|
||||
p = bli_malloc_user( buffer_size, &r_val );
|
||||
|
||||
// Set individual fields.
|
||||
bli_obj_set_buffer( p, obj );
|
||||
|
||||
@@ -101,6 +101,7 @@ void bli_pba_acquire_m
|
||||
pool_t* pool;
|
||||
pblk_t* pblk;
|
||||
dim_t pi;
|
||||
err_t r_val;
|
||||
|
||||
// If the internal memory pools for packing block allocator are disabled,
|
||||
// we spoof the buffer type as BLIS_BUFFER_FOR_GEN_USE to induce the
|
||||
@@ -125,7 +126,7 @@ void bli_pba_acquire_m
|
||||
|
||||
// For general-use buffer requests, dynamically allocating memory
|
||||
// is assumed to be sufficient.
|
||||
void* buf = bli_fmalloc_align( malloc_fp, req_size, align_size );
|
||||
void* buf = bli_fmalloc_align( malloc_fp, req_size, align_size, &r_val );
|
||||
|
||||
// Initialize the mem_t object with:
|
||||
// - the address of the memory block,
|
||||
|
||||
@@ -49,6 +49,8 @@ void bli_pool_init
|
||||
pool_t* restrict pool
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// Make sure that block_ptrs_len is at least num_blocks.
|
||||
block_ptrs_len = bli_max( block_ptrs_len, num_blocks );
|
||||
|
||||
@@ -62,7 +64,7 @@ void bli_pool_init
|
||||
// well as pool blocks? If so, don't forget to s/bli_free_intl/free_fp/g.
|
||||
pblk_t* restrict block_ptrs
|
||||
=
|
||||
bli_malloc_intl( block_ptrs_len * sizeof( pblk_t ) );
|
||||
bli_malloc_intl( block_ptrs_len * sizeof( pblk_t ), &r_val );
|
||||
|
||||
// Allocate and initialize each entry in the block_ptrs array.
|
||||
for ( dim_t i = 0; i < num_blocks; ++i )
|
||||
@@ -343,6 +345,8 @@ void bli_pool_grow
|
||||
pool_t* restrict pool
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// If the requested increase is zero, return early.
|
||||
if ( num_blocks_add == 0 ) return;
|
||||
|
||||
@@ -377,7 +381,7 @@ void bli_pool_grow
|
||||
// well as pool blocks? If so, don't forget to s/bli_free_intl/free_fp/g.
|
||||
pblk_t* restrict block_ptrs_new
|
||||
=
|
||||
bli_malloc_intl( block_ptrs_len_new * sizeof( pblk_t ) );
|
||||
bli_malloc_intl( block_ptrs_len_new * sizeof( pblk_t ), &r_val );
|
||||
|
||||
// Query the top_index of the pool.
|
||||
const siz_t top_index = bli_pool_top_index( pool );
|
||||
@@ -503,6 +507,8 @@ void bli_pool_alloc_block
|
||||
pblk_t* restrict block
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_pool_alloc_block(): calling fmalloc_align(): size %d (align %d, offset %d)\n",
|
||||
( int )block_size, ( int )align_size, ( int )offset_size );
|
||||
@@ -516,7 +522,7 @@ void bli_pool_alloc_block
|
||||
// that many bytes at the beginning of the allocated memory.
|
||||
void* restrict buf
|
||||
=
|
||||
bli_fmalloc_align( malloc_fp, block_size + offset_size, align_size );
|
||||
bli_fmalloc_align( malloc_fp, block_size + offset_size, align_size, &r_val );
|
||||
|
||||
#if 0
|
||||
// NOTE: This code is disabled because it is not needed, since
|
||||
|
||||
@@ -62,11 +62,12 @@ void* bli_sba_acquire
|
||||
)
|
||||
{
|
||||
void* block;
|
||||
err_t r_val;
|
||||
|
||||
#ifdef BLIS_ENABLE_SBA_POOLS
|
||||
if ( rntm == NULL )
|
||||
{
|
||||
block = bli_malloc_intl( req_size );
|
||||
block = bli_malloc_intl( req_size, &r_val );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -96,7 +97,7 @@ void* bli_sba_acquire
|
||||
}
|
||||
#else
|
||||
|
||||
block = bli_malloc_intl( req_size );
|
||||
block = bli_malloc_intl( req_size, &r_val );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -421,6 +421,21 @@ BLIS_INLINE bool bli_is_unit_diag( diag_t diag )
|
||||
}
|
||||
|
||||
|
||||
// err_t-related
|
||||
|
||||
BLIS_INLINE bool bli_is_success( err_t err )
|
||||
{
|
||||
return ( bool )
|
||||
( err == BLIS_SUCCESS );
|
||||
}
|
||||
|
||||
BLIS_INLINE bool bli_is_failure( err_t err )
|
||||
{
|
||||
return ( bool )
|
||||
( err != BLIS_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
// dimension-related
|
||||
|
||||
BLIS_INLINE bool bli_zero_dim1( dim_t m )
|
||||
|
||||
@@ -198,16 +198,19 @@ typedef double f77_double;
|
||||
typedef scomplex f77_scomplex;
|
||||
typedef dcomplex f77_dcomplex;
|
||||
|
||||
// -- Void function pointer types --
|
||||
// -- Misc. function pointer types --
|
||||
|
||||
// Note: This type should be used in any situation where the address of a
|
||||
// *function* will be conveyed or stored prior to it being typecast back
|
||||
// to the correct function type. It does not need to be used when conveying
|
||||
// or storing the address of *data* (such as an array of float or double).
|
||||
|
||||
//typedef void (*void_fp)( void );
|
||||
typedef void* void_fp;
|
||||
|
||||
// Typedef function pointer types for malloc() and free() substitutes.
|
||||
typedef void* (*malloc_ft)( size_t size );
|
||||
typedef void (*free_ft) ( void* p );
|
||||
|
||||
|
||||
//
|
||||
// -- BLIS info bit field offsets ----------------------------------------------
|
||||
@@ -1036,10 +1039,9 @@ typedef enum
|
||||
// -- BLIS misc. structure types -----------------------------------------------
|
||||
//
|
||||
|
||||
// These headers must be included here (or earlier) because definitions they
|
||||
// provide are needed in the pool_t and related structs.
|
||||
// This header must be included here (or earlier) because definitions it
|
||||
// provides are needed in the pool_t and related structs.
|
||||
#include "bli_pthread.h"
|
||||
#include "bli_malloc.h"
|
||||
|
||||
// -- Pool block type --
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ extern "C" {
|
||||
// -- Base operation prototypes --
|
||||
|
||||
#include "bli_init.h"
|
||||
#include "bli_malloc.h"
|
||||
#include "bli_const.h"
|
||||
#include "bli_obj.h"
|
||||
#include "bli_obj_scalar.h"
|
||||
|
||||
@@ -73,7 +73,8 @@ void bli_l3_thread_decorator
|
||||
const dim_t n_threads = bli_rntm_num_threads( rntm );
|
||||
|
||||
#ifdef PRINT_THRINFO
|
||||
thrinfo_t** threads = bli_malloc_intl( n_threads * sizeof( thrinfo_t* ) );
|
||||
err_t r_val;
|
||||
thrinfo_t** threads = bli_malloc_intl( n_threads * sizeof( thrinfo_t* ), &r_val );
|
||||
#endif
|
||||
|
||||
// NOTE: The sba was initialized in bli_init().
|
||||
|
||||
@@ -146,6 +146,8 @@ void bli_l3_thread_decorator
|
||||
cntl_t* cntl
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// This is part of a hack to support mixed domain in bli_gemm_front().
|
||||
// Sometimes we need to specify a non-standard schema for A and B, and
|
||||
// we decided to transmit them via the schema field in the obj_t's
|
||||
@@ -187,12 +189,12 @@ void bli_l3_thread_decorator
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_l3_thread_decorator().pth: " );
|
||||
#endif
|
||||
bli_pthread_t* pthreads = bli_malloc_intl( sizeof( bli_pthread_t ) * n_threads );
|
||||
bli_pthread_t* pthreads = bli_malloc_intl( sizeof( bli_pthread_t ) * n_threads, &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_l3_thread_decorator().pth: " );
|
||||
#endif
|
||||
thread_data_t* datas = bli_malloc_intl( sizeof( thread_data_t ) * n_threads );
|
||||
thread_data_t* datas = bli_malloc_intl( sizeof( thread_data_t ) * n_threads, &r_val );
|
||||
|
||||
// NOTE: We must iterate backwards so that the chief thread (thread id 0)
|
||||
// can spawn all other threads before proceeding with its own computation.
|
||||
|
||||
@@ -122,6 +122,8 @@ err_t bli_l3_sup_thread_decorator
|
||||
rntm_t* rntm
|
||||
)
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// Query the total number of threads from the context.
|
||||
const dim_t n_threads = bli_rntm_num_threads( rntm );
|
||||
|
||||
@@ -152,12 +154,12 @@ err_t bli_l3_sup_thread_decorator
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_l3_thread_decorator().pth: " );
|
||||
#endif
|
||||
bli_pthread_t* pthreads = bli_malloc_intl( sizeof( bli_pthread_t ) * n_threads );
|
||||
bli_pthread_t* pthreads = bli_malloc_intl( sizeof( bli_pthread_t ) * n_threads, &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "bli_l3_thread_decorator().pth: " );
|
||||
#endif
|
||||
thread_data_t* datas = bli_malloc_intl( sizeof( thread_data_t ) * n_threads );
|
||||
thread_data_t* datas = bli_malloc_intl( sizeof( thread_data_t ) * n_threads, &r_val );
|
||||
|
||||
// NOTE: We must iterate backwards so that the chief thread (thread id 0)
|
||||
// can spawn all other threads before proceeding with its own computation.
|
||||
|
||||
@@ -111,17 +111,21 @@ void bli_thrcomm_barrier( dim_t t_id, thrcomm_t* comm )
|
||||
|
||||
void bli_thrcomm_init( dim_t n_threads, thrcomm_t* comm )
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
if ( comm == NULL ) return;
|
||||
comm->sent_object = NULL;
|
||||
comm->n_threads = n_threads;
|
||||
comm->barriers = bli_malloc_intl( sizeof( barrier_t* ) * n_threads );
|
||||
comm->barriers = bli_malloc_intl( sizeof( barrier_t* ) * n_threads, &r_val );
|
||||
bli_thrcomm_tree_barrier_create( n_threads, BLIS_TREE_BARRIER_ARITY, comm->barriers, 0 );
|
||||
}
|
||||
|
||||
//Tree barrier used for Intel Xeon Phi
|
||||
barrier_t* bli_thrcomm_tree_barrier_create( int num_threads, int arity, barrier_t** leaves, int leaf_index )
|
||||
{
|
||||
barrier_t* me = bli_malloc_intl( sizeof(barrier_t) );
|
||||
err_t r_val;
|
||||
|
||||
barrier_t* me = bli_malloc_intl( sizeof( barrier_t ), &r_val );
|
||||
|
||||
me->dad = NULL;
|
||||
me->signal = 0;
|
||||
|
||||
@@ -332,8 +332,10 @@ thrinfo_t* bli_thrinfo_create_for_cntl
|
||||
// pointers.
|
||||
if ( bli_thread_am_ochief( thread_par ) )
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
if ( parent_n_way > BLIS_NUM_STATIC_COMMS )
|
||||
new_comms = bli_malloc_intl( parent_n_way * sizeof( thrcomm_t* ) );
|
||||
new_comms = bli_malloc_intl( parent_n_way * sizeof( thrcomm_t* ), &r_val );
|
||||
else
|
||||
new_comms = static_comms;
|
||||
}
|
||||
|
||||
@@ -197,8 +197,10 @@ thrinfo_t* bli_thrinfo_sup_create_for_cntl
|
||||
// pointers.
|
||||
if ( bli_thread_am_ochief( thread_par ) )
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
if ( parent_n_way > BLIS_NUM_STATIC_COMMS )
|
||||
new_comms = bli_malloc_intl( parent_n_way * sizeof( thrcomm_t* ) );
|
||||
new_comms = bli_malloc_intl( parent_n_way * sizeof( thrcomm_t* ), &r_val );
|
||||
else
|
||||
new_comms = static_comms;
|
||||
}
|
||||
|
||||
@@ -10773,10 +10773,11 @@ static err_t bli_dtrsm_small_XAltB_unitDiag(
|
||||
k_iter = j / D_NR; //number of GEMM operations to be performed(in block of 4x4)
|
||||
|
||||
dim_t iter;
|
||||
err_t r_val;
|
||||
|
||||
if((j+n_remainder) == n)
|
||||
{
|
||||
f_temp = bli_malloc_user(4 * sizeof(double));
|
||||
f_temp = bli_malloc_user(4 * sizeof(double), &r_val);
|
||||
for(iter = 0; iter < m_remainder; iter++)
|
||||
f_temp[iter] = (b11 + cs_b * (n_remainder-1))[iter];
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
3
|
||||
4
|
||||
0.0
|
||||
|
||||
@@ -121,6 +121,8 @@ void* libblis_test_thread_entry( void* tdata_void )
|
||||
|
||||
void libblis_test_thread_decorator( test_params_t* params, test_ops_t* ops )
|
||||
{
|
||||
err_t r_val;
|
||||
|
||||
// Query the total number of threads to simulate.
|
||||
size_t nt = ( size_t )params->n_app_threads;
|
||||
|
||||
@@ -130,12 +132,12 @@ void libblis_test_thread_decorator( test_params_t* params, test_ops_t* ops )
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "libblis_test_thread_decorator(): " );
|
||||
#endif
|
||||
bli_pthread_t* pthread = bli_malloc_user( sizeof( bli_pthread_t ) * nt );
|
||||
bli_pthread_t* pthread = bli_malloc_user( sizeof( bli_pthread_t ) * nt, &r_val );
|
||||
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "libblis_test_thread_decorator(): " );
|
||||
#endif
|
||||
thread_data_t* tdata = bli_malloc_user( sizeof( thread_data_t ) * nt );
|
||||
thread_data_t* tdata = bli_malloc_user( sizeof( thread_data_t ) * nt, &r_val );
|
||||
|
||||
// Allocate a mutex for the threads to share.
|
||||
//bli_pthread_mutex_t* mutex = bli_malloc_user( sizeof( bli_pthread_mutex_t ) );
|
||||
@@ -145,7 +147,7 @@ void libblis_test_thread_decorator( test_params_t* params, test_ops_t* ops )
|
||||
#ifdef BLIS_ENABLE_MEM_TRACING
|
||||
printf( "libblis_test_thread_decorator(): " );
|
||||
#endif
|
||||
bli_pthread_barrier_t* barrier = bli_malloc_user( sizeof( bli_pthread_barrier_t ) );
|
||||
bli_pthread_barrier_t* barrier = bli_malloc_user( sizeof( bli_pthread_barrier_t ), &r_val );
|
||||
|
||||
// Initialize the mutex.
|
||||
//bli_pthread_mutex_init( mutex, NULL );
|
||||
|
||||
Reference in New Issue
Block a user