Allow packm_init() to reacquire a too-small mem_t.

Details:
- Changed bli_packm_init() to react differently to a situation where a pack
  obj_t has an already-allocated mem_t entry that has a buffer that is smaller
  than what will be needed to hold the block/panel that now needs to be
  packed. Previously, this situation was treated with an abort() since I
  assumed something was horribly wrong. I have changed the code so that it now
  reacts by releasing the previous mem_t and re-acquires a new mem_t with the
  new information. (This change was done at the request of Bryan Marker to
  facilitate code generation via DxT.)
This commit is contained in:
Field G. Van Zee
2013-04-18 18:33:03 -05:00
parent a699043417
commit 83e45de23e

View File

@@ -384,11 +384,17 @@ void bli_packm_init_pack( bool_t densify,
else
{
// If the mem_t object is currently allocated and smaller than is
// needed, then something is very wrong, since the cache blocksizes
// that drive the level-3 blocked algorithms are the same ones that
// determine the sizes of the blocks within our memory allocator's
// memory pools. This branch should never be executed.
if ( bli_mem_size( mem_p ) < size_p ) bli_abort();
// needed, then it must have been allocated for a different type
// of object (a different pack_buf_type value), so we must first
// release it and then re-acquire it using the new size and new
// pack_buf_type value.
if ( bli_mem_size( mem_p ) < size_p )
{
bli_mem_release( mem_p );
bli_mem_acquire_m( size_p,
pack_buf_type,
mem_p );
}
}
// Grab the buffer address from the mem_t object and copy it to the