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:
Field G. Van Zee
2014-04-10 17:18:36 -05:00
parent 58671597d3
commit 7c61959955
6 changed files with 66 additions and 4 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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;
}

View File

@@ -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 );

View File

@@ -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 --