mirror of
https://github.com/amd/blis.git
synced 2026-05-11 09:39:59 +00:00
Fixed a packing bug that manifested in trsm_r.
Details: - Fixed a bug that caused a memory leak in the contiguous memory allocator. Because packm_init() was using simple aliasing when a subpartition object was marked as zeros by bli_acquire_mpart_*(), the "destination" pack object's mem_t entry was being overwritten by the corresponding field of the "source" object (which was likely NULL). This prevented the block from being released back to the memory allocator. But this bug only manifested when changing the location of packing B from outside the var1 loop to inside the var3 loop, and only for trsm with triangular B (side = right). The bug was fixed by changing the type of alias used in packm_init() when handling zero partition cases. Specifically, we now use bli_obj_alias_for_packing(), which does not clobber the destination (pack) object's mem_t field. Thanks to Devangi Parikh for this bug report.
This commit is contained in:
@@ -95,10 +95,15 @@ void bli_packm_init( obj_t* a,
|
||||
}
|
||||
|
||||
// If the object is marked as being filled with zeros, then we can skip
|
||||
// the packm operation entirely and alias.
|
||||
// the packm operation entirely and alias. Notice that we use pack-aware
|
||||
// aliasing. This is needed because the object may have been packed in
|
||||
// a previous iteration, which means the object currently contains the
|
||||
// mem_t entry of an already-allocated block. bli_obj_alias_for_packing()
|
||||
// will avoid overwriting that mem_t entry, which means it can be
|
||||
// properly released later on.
|
||||
if ( bli_obj_is_zeros( *a ) )
|
||||
{
|
||||
bli_obj_alias_to( *a, *p );
|
||||
bli_obj_alias_for_packing( *a, *p );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user