mirror of
https://github.com/amd/blis.git
synced 2026-05-11 09:39:59 +00:00
Can now query register blocksizes from blk algs.
Details: - Added a new field to blksz_t objects that allows one to attach a sub-object. Doing this allows us to associate a register blocksize with any given cache blocksize. That way, the register blocksize can be queried wherever the cache blocksize would normally be accessible (e.g. a blocked algorithm). - Modified bli_gemm_cntl.c (and 4m/3m variants) so that the register blocksizes are attached to the cache blocksizes after they are created.
This commit is contained in:
@@ -97,6 +97,12 @@ void bli_gemm3m_cntl_init()
|
||||
BLIS_DEFAULT_3M_KR_Z, BLIS_EXTEND_3M_KR_Z );
|
||||
|
||||
|
||||
// Attach the register blksz_t objects as sub-blocksizes to the cache
|
||||
// blksz_t objects.
|
||||
bli_blksz_obj_attach_to( gemm3m_mr, gemm3m_mc );
|
||||
bli_blksz_obj_attach_to( gemm3m_nr, gemm3m_nc );
|
||||
bli_blksz_obj_attach_to( gemm3m_kr, gemm3m_kc );
|
||||
|
||||
|
||||
// Create function pointer object for each datatype-specific gemm
|
||||
// micro-kernel.
|
||||
|
||||
@@ -97,6 +97,12 @@ void bli_gemm4m_cntl_init()
|
||||
BLIS_DEFAULT_4M_KR_Z, BLIS_EXTEND_4M_KR_Z );
|
||||
|
||||
|
||||
// Attach the register blksz_t objects as sub-blocksizes to the cache
|
||||
// blksz_t objects.
|
||||
bli_blksz_obj_attach_to( gemm4m_mr, gemm4m_mc );
|
||||
bli_blksz_obj_attach_to( gemm4m_nr, gemm4m_nc );
|
||||
bli_blksz_obj_attach_to( gemm4m_kr, gemm4m_kc );
|
||||
|
||||
|
||||
// Create function pointer object for each datatype-specific gemm
|
||||
// micro-kernel.
|
||||
|
||||
@@ -97,6 +97,12 @@ void bli_gemm_cntl_init()
|
||||
BLIS_DEFAULT_KR_Z, 0 );
|
||||
|
||||
|
||||
// Attach the register blksz_t objects as sub-blocksizes to the cache
|
||||
// blksz_t objects.
|
||||
bli_blksz_obj_attach_to( gemm_mr, gemm_mc );
|
||||
bli_blksz_obj_attach_to( gemm_nr, gemm_nc );
|
||||
bli_blksz_obj_attach_to( gemm_kr, gemm_kc );
|
||||
|
||||
|
||||
// Create function pointer object for each datatype-specific gemm
|
||||
// micro-kernel.
|
||||
|
||||
@@ -68,6 +68,16 @@ void bli_blksz_obj_init( blksz_t* b,
|
||||
b->e[BLIS_BITVAL_DOUBLE_TYPE] = be_d;
|
||||
b->e[BLIS_BITVAL_SCOMPLEX_TYPE] = be_c;
|
||||
b->e[BLIS_BITVAL_DCOMPLEX_TYPE] = be_z;
|
||||
|
||||
// By default, set the sub-blocksize field to NULL.
|
||||
b->sub = NULL;
|
||||
}
|
||||
|
||||
|
||||
void bli_blksz_obj_attach_to( blksz_t* br,
|
||||
blksz_t* bc )
|
||||
{
|
||||
bc->sub = br;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +129,12 @@ dim_t bli_blksz_total_for_obj( obj_t* obj,
|
||||
}
|
||||
|
||||
|
||||
blksz_t* bli_blksz_sub( blksz_t* b )
|
||||
{
|
||||
return b->sub;
|
||||
}
|
||||
|
||||
|
||||
dim_t bli_determine_blocksize_f( dim_t i,
|
||||
dim_t dim,
|
||||
obj_t* obj,
|
||||
@@ -133,7 +149,7 @@ dim_t bli_determine_blocksize_f( dim_t i,
|
||||
// to bottom-right).
|
||||
|
||||
// Extract the execution datatype and use it to query the corresponding
|
||||
// blocksize and blocksize extension values rom the blksz_t object.
|
||||
// blocksize and blocksize extension values from the blksz_t object.
|
||||
dt = bli_obj_execution_datatype( *obj );
|
||||
b_alg = bli_blksz_for_type( dt, b );
|
||||
b_ext = bli_blksz_ext_for_type( dt, b );
|
||||
@@ -173,7 +189,7 @@ dim_t bli_determine_blocksize_b( dim_t i,
|
||||
// to top-left).
|
||||
|
||||
// Extract the execution datatype and use it to query the corresponding
|
||||
// blocksize and blocksize extension values rom the blksz_t object.
|
||||
// blocksize and blocksize extension values from the blksz_t object.
|
||||
dt = bli_obj_execution_datatype( *obj );
|
||||
b_alg = bli_blksz_for_type( dt, b );
|
||||
b_ext = bli_blksz_ext_for_type( dt, b );
|
||||
@@ -215,3 +231,20 @@ dim_t bli_determine_blocksize_b( dim_t i,
|
||||
return b_now;
|
||||
}
|
||||
|
||||
|
||||
dim_t bli_determine_reg_blocksize( obj_t* obj,
|
||||
blksz_t* b )
|
||||
{
|
||||
num_t dt;
|
||||
blksz_t* b_sub_obj;
|
||||
dim_t b_sub;
|
||||
|
||||
// Extract the execution datatype and sub-blocksize and use them to
|
||||
// query the the register blocksize from the blksz_t object.
|
||||
dt = bli_obj_execution_datatype( *obj );
|
||||
b_sub_obj = bli_blksz_sub( b );
|
||||
b_sub = bli_blksz_for_type( dt, b_sub_obj );
|
||||
|
||||
return b_sub;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ void bli_blksz_obj_init( blksz_t* b,
|
||||
dim_t b_c, dim_t be_c,
|
||||
dim_t b_z, dim_t be_z );
|
||||
|
||||
void bli_blksz_obj_attach_to( blksz_t* br,
|
||||
blksz_t* bc );
|
||||
|
||||
void bli_blksz_obj_free( blksz_t* b );
|
||||
|
||||
dim_t bli_blksz_for_type( num_t dt,
|
||||
@@ -64,6 +67,8 @@ dim_t bli_blksz_ext_for_obj( obj_t* obj,
|
||||
dim_t bli_blksz_total_for_obj( obj_t* obj,
|
||||
blksz_t* b );
|
||||
|
||||
blksz_t* bli_blksz_sub( blksz_t* b );
|
||||
|
||||
dim_t bli_determine_blocksize_f( dim_t i,
|
||||
dim_t dim,
|
||||
obj_t* obj,
|
||||
@@ -73,3 +78,5 @@ dim_t bli_determine_blocksize_b( dim_t i,
|
||||
obj_t* obj,
|
||||
blksz_t* b );
|
||||
|
||||
dim_t bli_determine_reg_blocksize( obj_t* obj,
|
||||
blksz_t* b );
|
||||
|
||||
@@ -416,10 +416,14 @@ typedef struct mem_s
|
||||
typedef struct blksz_s
|
||||
{
|
||||
// Primary blocksize values.
|
||||
dim_t v[BLIS_NUM_FP_TYPES];
|
||||
dim_t v[BLIS_NUM_FP_TYPES];
|
||||
|
||||
// Blocksize Extensions.
|
||||
dim_t e[BLIS_NUM_FP_TYPES];
|
||||
dim_t e[BLIS_NUM_FP_TYPES];
|
||||
|
||||
// Sub-blocksize pointer.
|
||||
struct blksz_s* sub;
|
||||
|
||||
} blksz_t;
|
||||
|
||||
// -- Function pointer object type --
|
||||
|
||||
Reference in New Issue
Block a user