mirror of
https://github.com/amd/blis.git
synced 2026-05-26 23:44:18 +00:00
Freeing thread info paths.
Also made herk IC and JC loops do weighted partitioning
This commit is contained in:
@@ -34,13 +34,20 @@
|
||||
|
||||
#include "blis.h"
|
||||
|
||||
void bli_packm_thrinfo_free( packm_thrinfo_t* thread )
|
||||
{
|
||||
//Assume that the ocomm and the icomm are freed by something else and don't need to be freed.
|
||||
bli_free(thread);
|
||||
}
|
||||
|
||||
packm_thrinfo_t* bli_create_packm_thread_info( thread_comm_t* ocomm, dim_t ocomm_id, thread_comm_t* icomm, dim_t icomm_id,
|
||||
dim_t n_way, dim_t work_id )
|
||||
{
|
||||
return (packm_thrinfo_t*) bli_create_thread_info( ocomm, ocomm_id, icomm, icomm_id, n_way, work_id );
|
||||
}
|
||||
|
||||
void bli_setup_packm_thread_info( packm_thrinfo_t* thread, thread_comm_t* ocomm, dim_t ocomm_id, thread_comm_t* icomm, dim_t icomm_id,
|
||||
void bli_setup_packm_thread_info( packm_thrinfo_t* thread, thread_comm_t* ocomm, dim_t ocomm_id,
|
||||
thread_comm_t* icomm, dim_t icomm_id,
|
||||
dim_t n_way, dim_t work_id )
|
||||
{
|
||||
bli_setup_thread_info( (thrinfo_t*) thread, ocomm, ocomm_id, icomm, icomm_id, n_way, work_id );
|
||||
|
||||
@@ -46,6 +46,7 @@ typedef struct packm_thrinfo_s packm_thrinfo_t;
|
||||
|
||||
#define packm_thread_my_iter( index, thread ) ( index % thread->n_way == thread->work_id % thread->n_way )
|
||||
|
||||
void bli_packm_thrinfo_free( packm_thrinfo_t* thread );
|
||||
packm_thrinfo_t* bli_create_packm_thread_info( thread_comm_t* ocomm, dim_t ocomm_id, thread_comm_t* icomm, dim_t icomm_id,
|
||||
dim_t n_way, dim_t work_id );
|
||||
void bli_setup_packm_thread_info( packm_thrinfo_t* thread, thread_comm_t* ocomm, dim_t ocomm_id, thread_comm_t* icomm, dim_t icomm_id,
|
||||
|
||||
@@ -88,6 +88,6 @@ void bli_gemm_front( obj_t* alpha,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_gemm_thrinfo_free_paths( infos );
|
||||
bli_gemm_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,29 @@ gemm_thrinfo_t* bli_create_gemm_thrinfo_node( thread_comm_t* ocomm, dim_t ocomm_
|
||||
return thread;
|
||||
}
|
||||
|
||||
void bli_gemm_thrinfo_free_paths( gemm_thrinfo_t** threads )
|
||||
void bli_gemm_thrinfo_free( gemm_thrinfo_t* thread)
|
||||
{
|
||||
if( thread == NULL ) return;
|
||||
|
||||
// Free Communicators
|
||||
if( thread_am_ochief( thread ) )
|
||||
bli_free_communicator( thread->ocomm );
|
||||
// if( thread_am_ichief( thread ) )
|
||||
// bli_cleanup_communicator( thread->icomm );
|
||||
|
||||
// Free Sub Thrinfos
|
||||
bli_packm_thrinfo_free( opackm );
|
||||
bli_packm_thrinfo_free( ipackm );
|
||||
bli_gemm_thrinfo_free( sub_gemm );
|
||||
bli_free( thread );
|
||||
|
||||
return;
|
||||
}
|
||||
void bli_gemm_thrinfo_free_paths( gemm_thrinfo_t** threads, dim_t num )
|
||||
{
|
||||
for( int i = 0; i < num; i++)
|
||||
bli_gemm_thrinfo_free( threads[i] );
|
||||
bli_free( threads );
|
||||
}
|
||||
|
||||
gemm_thrinfo_t** bli_create_gemm_thrinfo_paths( )
|
||||
|
||||
@@ -94,6 +94,6 @@ void bli_hemm_front( side_t side,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_gemm_thrinfo_free_paths( infos );
|
||||
bli_gemm_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ void bli_her2k_front( obj_t* alpha,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_herk_thrinfo_free_paths( infos );
|
||||
bli_herk_thrinfo_free_paths( infos, n_threads );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void bli_herk_blk_var1f( obj_t* a,
|
||||
// Query dimension in partitioning direction.
|
||||
m_trans = bli_obj_length_after_trans( *c );
|
||||
dim_t start, end;
|
||||
bli_get_range( thread, 0, m_trans, 8, &start, &end );
|
||||
bli_get_range_weighted( thread, 0, m_trans, 8, bli_obj_is_upper( *c ), &start, &end );
|
||||
|
||||
// Partition along the m dimension.
|
||||
for ( i = start; i < end; i += b_alg )
|
||||
|
||||
@@ -91,7 +91,7 @@ void bli_herk_blk_var2f( obj_t* a,
|
||||
|
||||
// Needs to be replaced with a weighted range because triangle
|
||||
//bli_get_range( thread, 0, n_trans, 8, &start, &end );
|
||||
bli_get_range_weighted( thread, 0, n_trans, 8, 1, &start, &end );
|
||||
bli_get_range_weighted( thread, 0, n_trans, 8, bli_obj_is_lower( *c ), &start, &end );
|
||||
|
||||
// Partition along the n dimension.
|
||||
for ( i = start; i < end; i += b_alg )
|
||||
|
||||
@@ -91,6 +91,6 @@ void bli_herk_front( obj_t* alpha,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_herk_thrinfo_free_paths( infos );
|
||||
bli_herk_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,27 @@ herk_thrinfo_t* bli_create_herk_thrinfo_node( thread_comm_t* ocomm, dim_t ocomm_
|
||||
return thread;
|
||||
}
|
||||
|
||||
void bli_herk_thrinfo_free_paths( herk_thrinfo_t** threads )
|
||||
void bli_herk_thrinfo_free( herk_thrinfo_t* thread)
|
||||
{
|
||||
if( thread == NULL ) return;
|
||||
|
||||
// Free Communicators
|
||||
if( thread_am_ochief( thread ) )
|
||||
bli_free_communicator( thread->ocomm );
|
||||
|
||||
// Free Sub Thrinfos
|
||||
bli_packm_thrinfo_free( opackm );
|
||||
bli_packm_thrinfo_free( ipackm );
|
||||
bli_herk_thrinfo_free( sub_herk );
|
||||
bli_free( thread );
|
||||
|
||||
return;
|
||||
}
|
||||
void bli_herk_thrinfo_free_paths( herk_thrinfo_t** threads, dim_t num )
|
||||
{
|
||||
for( int i = 0; i < num; i++)
|
||||
bli_herk_thrinfo_free( threads[i] );
|
||||
bli_free( threads );
|
||||
}
|
||||
|
||||
herk_thrinfo_t** bli_create_herk_thrinfo_paths( )
|
||||
|
||||
@@ -93,6 +93,6 @@ void bli_symm_front( side_t side,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_gemm_thrinfo_free_paths( infos );
|
||||
bli_gemm_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void bli_syr2k_front( obj_t* alpha,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_herk_thrinfo_free_paths( infos );
|
||||
bli_herk_thrinfo_free_paths( infos, n_threads );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,6 @@ void bli_syrk_front( obj_t* alpha,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_herk_thrinfo_free_paths( infos );
|
||||
bli_herk_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,6 @@ void bli_trmm_front( side_t side,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_trmm_thrinfo_free_paths( infos );
|
||||
bli_trmm_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,28 @@ trmm_thrinfo_t* bli_create_trmm_thrinfo_node( thread_comm_t* ocomm, dim_t ocomm_
|
||||
return thread;
|
||||
}
|
||||
|
||||
void bli_trmm_thrinfo_free_paths( trmm_thrinfo_t** threads )
|
||||
void bli_trmm_thrinfo_free( trmm_thrinfo_t* thread)
|
||||
{
|
||||
if( thread == NULL ) return;
|
||||
|
||||
// Free Communicators
|
||||
if( thread_am_ochief( thread ) )
|
||||
bli_free_communicator( thread->ocomm );
|
||||
|
||||
// Free Sub Thrinfos
|
||||
bli_packm_thrinfo_free( opackm );
|
||||
bli_packm_thrinfo_free( ipackm );
|
||||
bli_trmm_thrinfo_free( sub_trmm );
|
||||
bli_free( thread );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void bli_trmm_thrinfo_free_paths( trmm_thrinfo_t** threads, dim_t num )
|
||||
{
|
||||
for( int i = 0; i < num; i++)
|
||||
bli_trmm_thrinfo_free( threads[i] );
|
||||
bli_free( threads );
|
||||
}
|
||||
|
||||
trmm_thrinfo_t** bli_create_trmm_thrinfo_paths( )
|
||||
|
||||
@@ -141,6 +141,6 @@ void bli_trmm3_front( side_t side,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_trmm_thrinfo_free_paths( infos );
|
||||
bli_trmm_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,6 @@ void bli_trsm_front( side_t side,
|
||||
(void*) cntl,
|
||||
(void**) infos );
|
||||
|
||||
bli_trsm_thrinfo_free_paths( infos );
|
||||
bli_trsm_thrinfo_free_paths( infos, n_threads );
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,27 @@ trsm_thrinfo_t* bli_create_trsm_thrinfo_node( thread_comm_t* ocomm, dim_t ocomm_
|
||||
return thread;
|
||||
}
|
||||
|
||||
void bli_trsm_thrinfo_free_paths( trsm_thrinfo_t** threads )
|
||||
void bli_trsm_thrinfo_free( trsm_thrinfo_t* thread)
|
||||
{
|
||||
if( thread == NULL ) return;
|
||||
|
||||
// Free Communicators
|
||||
if( thread_am_ochief( thread ) )
|
||||
bli_free_communicator( thread->ocomm );
|
||||
|
||||
// Free Sub Thrinfos
|
||||
bli_packm_thrinfo_free( opackm );
|
||||
bli_packm_thrinfo_free( ipackm );
|
||||
bli_trsm_thrinfo_free( sub_trsm );
|
||||
bli_free( thread );
|
||||
|
||||
return;
|
||||
}
|
||||
void bli_trsm_thrinfo_free_paths( trsm_thrinfo_t** threads, dim_t num )
|
||||
{
|
||||
for( int i = 0; i < num; i++)
|
||||
bli_trsm_thrinfo_free( threads[i] );
|
||||
bli_free( threads );
|
||||
}
|
||||
|
||||
trsm_thrinfo_t** bli_create_trsm_thrinfo_paths( )
|
||||
|
||||
@@ -39,6 +39,12 @@ void bli_cleanup_communicator( thread_comm_t* communicator )
|
||||
if( communicator == NULL ) return;
|
||||
bli_destroy_lock( &communicator->barrier_lock );
|
||||
}
|
||||
void bli_free_communicator( thread_comm_t* communicator )
|
||||
{
|
||||
if( communicator == NULL ) return;
|
||||
bli_cleanup_communicator( communicator );
|
||||
bli_free( communicator );
|
||||
}
|
||||
|
||||
void bli_setup_communicator( thread_comm_t* communicator, dim_t n_threads)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,9 @@ struct thread_comm_s
|
||||
typedef struct thread_comm_s thread_comm_t;
|
||||
|
||||
void bli_setup_communicator( thread_comm_t* communicator, dim_t n_threads );
|
||||
void bli_cleanup_communicator( thread_comm_t* communicator );
|
||||
thread_comm_t* bli_create_communicator( dim_t n_threads );
|
||||
void bli_free_communicator( thread_comm_t* communicator );
|
||||
|
||||
void* bli_broadcast_structure( thread_comm_t* communicator, dim_t inside_id, void* to_send );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user