mirror of
https://github.com/amd/blis.git
synced 2026-07-07 15:46:58 +00:00
Add error message to malloc() check for NULL.
Details: - Output an error message if and when the malloc()-equivalent called by bli_fmalloc_align() ever returns NULL. Everything was already in place for this to happen, including the error return code, the error string sprintf(), the error checking function bli_check_valid_malloc_buf() definition, and its prototype. Thanks to Minh Quan Ho for pointing out the missing error message. - Increased the default block_ptrs_len for each inner pool stored in the small block allocator from 10 to 25. Under normal execution, each thread uses only 21 blocks, so this change will prevent the sba from needing to resize the block_ptrs array of any given inner pool as threads initially populate the pool with small blocks upon first execution of a level-3 operation. - Nix stray newline echo in configure.
This commit is contained in:
1
configure
vendored
1
configure
vendored
@@ -171,7 +171,6 @@ print_usage()
|
||||
echo " it no longer needs to call malloc() or free(), even"
|
||||
echo " across many separate level-3 operation invocations."
|
||||
echo " "
|
||||
echo " "
|
||||
echo " --enable-mem-tracing, --disable-mem-tracing"
|
||||
echo " "
|
||||
echo " Enable (disable by default) output to stdout that traces"
|
||||
|
||||
@@ -397,7 +397,7 @@ pool_t* bli_apool_array_elem
|
||||
// Settle on the parameters to use when initializing the pool_t for
|
||||
// the current index within the array_t.
|
||||
const siz_t num_blocks = 1;
|
||||
const siz_t block_ptrs_len = 10;
|
||||
const siz_t block_ptrs_len = 25;
|
||||
const siz_t align_size = 16;
|
||||
malloc_ft malloc_fp = BLIS_MALLOC_INTL;
|
||||
free_ft free_fp = BLIS_FREE_INTL;
|
||||
|
||||
@@ -155,8 +155,9 @@ void* bli_fmalloc_align
|
||||
// Call the allocation function.
|
||||
p_orig = f( size );
|
||||
|
||||
// If NULL was returned, something is probably very wrong.
|
||||
if ( p_orig == NULL ) bli_abort();
|
||||
// Check the pointer returned by malloc().
|
||||
if ( bli_error_checking_is_enabled() )
|
||||
bli_fmalloc_align_post_check( p_orig );
|
||||
|
||||
// Advance the pointer by one pointer element.
|
||||
p_byte = p_orig;
|
||||
@@ -254,4 +255,16 @@ void bli_fmalloc_align_check
|
||||
bli_check_error_code( e_val );
|
||||
}
|
||||
|
||||
void bli_fmalloc_align_post_check
|
||||
(
|
||||
void* p
|
||||
)
|
||||
{
|
||||
err_t e_val;
|
||||
|
||||
// Check for valid values from malloc().
|
||||
|
||||
e_val = bli_check_valid_malloc_buf( p );
|
||||
bli_check_error_code( e_val );
|
||||
}
|
||||
|
||||
|
||||
@@ -58,4 +58,5 @@ void* bli_fmalloc_noalign( malloc_ft f, size_t size );
|
||||
void bli_ffree_noalign( free_ft f, void* p );
|
||||
|
||||
void bli_fmalloc_align_check( malloc_ft f, size_t size, size_t align_size );
|
||||
void bli_fmalloc_align_post_check( void* p );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user