Merge branch 'amd'

This commit is contained in:
Field G. Van Zee
2019-01-02 13:37:37 -06:00
2 changed files with 37 additions and 2 deletions

View File

@@ -34,6 +34,8 @@
#include "blis.h"
//#define ENABLE_DEBUG
// -----------------------------------------------------------------------------
void* bli_malloc_pool( size_t size )
@@ -41,11 +43,19 @@ void* bli_malloc_pool( size_t size )
const malloc_ft malloc_fp = BLIS_MALLOC_POOL;
const size_t align_size = BLIS_POOL_ADDR_ALIGN_SIZE;
#ifdef ENABLE_DEBUG
printf( "bli_malloc_pool(): allocating block (size %ld, align size %ld)\n",
( long )size, ( long )align_size );
#endif
return bli_malloc_align( malloc_fp, size, align_size );
}
void bli_free_pool( void* p )
{
#ifdef ENABLE_DEBUG
printf( "bli_free_pool(): freeing block\n" );
#endif
bli_free_align( BLIS_FREE_POOL, p );
}
@@ -56,11 +66,19 @@ void* bli_malloc_user( size_t size )
const malloc_ft malloc_fp = BLIS_MALLOC_USER;
const size_t align_size = BLIS_HEAP_ADDR_ALIGN_SIZE;
#ifdef ENABLE_DEBUG
printf( "bli_malloc_user(): allocating block (size %ld, align size %ld)\n",
( long )size, ( long )align_size );
#endif
return bli_malloc_align( malloc_fp, size, align_size );
}
void bli_free_user( void* p )
{
#ifdef ENABLE_DEBUG
printf( "bli_free_user(): freeing block\n" );
#endif
bli_free_align( BLIS_FREE_USER, p );
}
@@ -70,11 +88,21 @@ void* bli_malloc_intl( size_t size )
{
const malloc_ft malloc_fp = BLIS_MALLOC_INTL;
#ifdef ENABLE_DEBUG
printf( "bli_malloc_intl(): allocating block (size %ld)\n",
( long )size );
#endif
return bli_malloc_noalign( malloc_fp, size );
}
void* bli_calloc_intl( size_t size )
{
#ifdef ENABLE_DEBUG
printf( "bli_calloc_intl(): allocating block (size %ld)\n",
( long )size );
#endif
void* p = bli_malloc_intl( size );
memset( p, 0, size );
@@ -84,6 +112,9 @@ void* bli_calloc_intl( size_t size )
void bli_free_intl( void* p )
{
#ifdef ENABLE_DEBUG
printf( "bli_free_intl(): freeing block\n" );
#endif
bli_free_noalign( BLIS_FREE_INTL, p );
}

View File

@@ -209,8 +209,10 @@ void bli_membrk_release
// section.)
block_size_prev = bli_mem_size( mem );
// BEGIN CRITICAL SECTION
// Acquire the mutex associated with the membrk object.
bli_membrk_lock( membrk );
// BEGIN CRITICAL SECTION
{
// Query the size of the blocks currently in the pool.
@@ -235,8 +237,10 @@ void bli_membrk_release
}
}
bli_membrk_unlock( membrk );
// END CRITICAL SECTION
// Release the mutex associated with the membrk object.
bli_membrk_unlock( membrk );
}
// Clear the mem_t object so that it appears unallocated. This clears: