Ejemplo n.º 1
0
void bli_cntx_3mh_stage( dim_t stage, cntx_t* cntx )
{
	// Set the pack_t schemas as a function of the stage of execution.
	if ( stage == 0 )
	{
		bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_RO, cntx );
		bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_RO, cntx );
	}
	else if ( stage == 1 )
	{
		bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_IO, cntx );
		bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_IO, cntx );
	}
	else // if ( stage == 2 )
	{
		bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_RPI, cntx );
		bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_RPI, cntx );
	}
}
Ejemplo n.º 2
0
void GENBAINAME(cntx_init)
     (
       ind_t   method,
       num_t   dt,
       cntx_t* cntx
     )
{
	func_t* funcs;
	dim_t   i;

	// This function is designed to modify a copy of an existing native
	// context to enable computation via an induced method for complex
	// domain level-3 operations. It is called by bli_gks_query_ind_cntx()
	// on a context after its contexts are set by copying from the
	// architecture's native context.

	// -- Set induced method level-3 virtual micro-kernels ---------------------

	funcs = bli_cntx_l3_vir_ukrs_buf( cntx );

	// 3mh, 4mh, and 4mb do not not support trsm.
	bli_func_init_null( &funcs[ BLIS_GEMMTRSM_L_UKR ] );
	bli_func_init_null( &funcs[ BLIS_GEMMTRSM_U_UKR ] );
	bli_func_init_null( &funcs[ BLIS_TRSM_L_UKR ] );
	bli_func_init_null( &funcs[ BLIS_TRSM_U_UKR ] );

	if      ( method == BLIS_3MH )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm3mh_ukr_name       );
	}
	else if ( method == BLIS_3M1 )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm3m1_ukr_name       );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_L_UKR ], gemmtrsm3m1_l_ukr_name );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_U_UKR ], gemmtrsm3m1_u_ukr_name );
		gen_func_init_co( &funcs[ BLIS_TRSM_L_UKR ],     trsm3m1_l_ukr_name     );
		gen_func_init_co( &funcs[ BLIS_TRSM_U_UKR ],     trsm3m1_u_ukr_name     );
	}
	else if ( method == BLIS_4MH )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm4mh_ukr_name       );
	}
	else if ( method == BLIS_4M1B )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm4mb_ukr_name       );
	}
	else if ( method == BLIS_4M1A )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm4m1_ukr_name       );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_L_UKR ], gemmtrsm4m1_l_ukr_name );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_U_UKR ], gemmtrsm4m1_u_ukr_name );
		gen_func_init_co( &funcs[ BLIS_TRSM_L_UKR ],     trsm4m1_l_ukr_name     );
		gen_func_init_co( &funcs[ BLIS_TRSM_U_UKR ],     trsm4m1_u_ukr_name     );
	}
	else if ( method == BLIS_1M )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm1m_ukr_name       );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_L_UKR ], gemmtrsm1m_l_ukr_name );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_U_UKR ], gemmtrsm1m_u_ukr_name );
		gen_func_init_co( &funcs[ BLIS_TRSM_L_UKR ],     trsm1m_l_ukr_name     );
		gen_func_init_co( &funcs[ BLIS_TRSM_U_UKR ],     trsm1m_u_ukr_name     );
	}
	else // if ( method == BLIS_NAT )
	{
		gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm_ukr_name       );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_L_UKR ], gemmtrsm_l_ukr_name );
		gen_func_init_co( &funcs[ BLIS_GEMMTRSM_U_UKR ], gemmtrsm_u_ukr_name );
		gen_func_init_co( &funcs[ BLIS_TRSM_L_UKR ],     trsm_l_ukr_name     );
		gen_func_init_co( &funcs[ BLIS_TRSM_U_UKR ],     trsm_u_ukr_name     );
	}

	// For 1m, we employ an optimization which requires that we copy the native
	// real domain gemm ukernel function pointers to the corresponding slots in
	// the virtual gemm ukernel func_t.
	if ( method == BLIS_1M )
	{
		func_t* gemm_nat_ukrs = bli_cntx_get_l3_nat_ukrs( BLIS_GEMM_UKR, cntx );
		func_t* gemm_vir_ukrs = bli_cntx_get_l3_vir_ukrs( BLIS_GEMM_UKR, cntx );

		bli_func_copy_dt( BLIS_FLOAT,  gemm_nat_ukrs, BLIS_FLOAT,  gemm_vir_ukrs );
		bli_func_copy_dt( BLIS_DOUBLE, gemm_nat_ukrs, BLIS_DOUBLE, gemm_vir_ukrs );
	}


	// -- Set induced method packm kernels -------------------------------------

	funcs = bli_cntx_packm_kers_buf( cntx );

	// Initialize all packm kernel func_t entries to NULL.
	for ( i = BLIS_PACKM_0XK_KER; i <= BLIS_PACKM_31XK_KER; ++i )
	{
		bli_func_init_null( &funcs[ i ] );
	}

	if ( method == BLIS_3MH || method == BLIS_4MH )
	{
		gen_func_init_co( &funcs[ BLIS_PACKM_2XK_KER ],  packm_2xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_4XK_KER ],  packm_4xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_6XK_KER ],  packm_6xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_8XK_KER ],  packm_8xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_10XK_KER ], packm_10xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_12XK_KER ], packm_12xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_14XK_KER ], packm_14xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_16XK_KER ], packm_16xk_rih_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_30XK_KER ], packm_30xk_rih_ker_name );
	}
	else if ( method == BLIS_3M1 )
	{
		gen_func_init_co( &funcs[ BLIS_PACKM_2XK_KER ],  packm_2xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_4XK_KER ],  packm_4xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_6XK_KER ],  packm_6xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_8XK_KER ],  packm_8xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_10XK_KER ], packm_10xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_12XK_KER ], packm_12xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_14XK_KER ], packm_14xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_16XK_KER ], packm_16xk_3mis_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_30XK_KER ], packm_30xk_3mis_ker_name );
	}
	else if ( method == BLIS_4M1A || method == BLIS_4M1B )
	{
		gen_func_init_co( &funcs[ BLIS_PACKM_2XK_KER ],  packm_2xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_4XK_KER ],  packm_4xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_6XK_KER ],  packm_6xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_8XK_KER ],  packm_8xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_10XK_KER ], packm_10xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_12XK_KER ], packm_12xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_14XK_KER ], packm_14xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_16XK_KER ], packm_16xk_4mi_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_30XK_KER ], packm_30xk_4mi_ker_name );
	}
	else if ( method == BLIS_1M )
	{
		gen_func_init_co( &funcs[ BLIS_PACKM_2XK_KER ],  packm_2xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_4XK_KER ],  packm_4xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_6XK_KER ],  packm_6xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_8XK_KER ],  packm_8xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_10XK_KER ], packm_10xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_12XK_KER ], packm_12xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_14XK_KER ], packm_14xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_16XK_KER ], packm_16xk_1er_ker_name );
		gen_func_init_co( &funcs[ BLIS_PACKM_30XK_KER ], packm_30xk_1er_ker_name );
	}
	else // if ( method == BLIS_NAT )
	{
		gen_func_init( &funcs[ BLIS_PACKM_2XK_KER ],  packm_2xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_3XK_KER ],  packm_3xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_4XK_KER ],  packm_4xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_6XK_KER ],  packm_6xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_8XK_KER ],  packm_8xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_10XK_KER ], packm_10xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_12XK_KER ], packm_12xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_14XK_KER ], packm_14xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_16XK_KER ], packm_16xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_24XK_KER ], packm_24xk_ker_name );
		gen_func_init( &funcs[ BLIS_PACKM_30XK_KER ], packm_30xk_ker_name );
	}


	// -- Set induced method cache and register blocksizes ---------------------

	// Modify the context with cache and register blocksizes (and multiples)
	// appropriate for the current induced method.
	if      ( method == BLIS_3MH )
	{
		bli_cntx_set_ind_blkszs
		(
		  method, 6,
		  BLIS_NC, 1.0, 1.0,
		  BLIS_KC, 1.0, 1.0,
		  BLIS_MC, 1.0, 1.0,
		  BLIS_NR, 1.0, 1.0,
		  BLIS_MR, 1.0, 1.0,
		  BLIS_KR, 1.0, 1.0,
		  cntx
		);
	}
	else if ( method == BLIS_3M1 )
	{
		bli_cntx_set_ind_blkszs
		(
		  method, 6,
		  BLIS_NC, 1.0, 1.0,
		  BLIS_KC, 3.0, 3.0,
		  BLIS_MC, 1.0, 1.0,
		  BLIS_NR, 1.0, 1.0,
		  BLIS_MR, 1.0, 1.0,
		  BLIS_KR, 1.0, 1.0,
		  cntx
		);
	}
	else if ( method == BLIS_4MH )
	{
		bli_cntx_set_ind_blkszs
		(
		  method, 6,
		  BLIS_NC, 1.0, 1.0,
		  BLIS_KC, 1.0, 1.0,
		  BLIS_MC, 1.0, 1.0,
		  BLIS_NR, 1.0, 1.0,
		  BLIS_MR, 1.0, 1.0,
		  BLIS_KR, 1.0, 1.0,
		  cntx
		);
	}
	else if ( method == BLIS_4M1B )
	{
		bli_cntx_set_ind_blkszs
		(
		  method, 6,
		  BLIS_NC, 2.0, 2.0,
		  BLIS_KC, 1.0, 1.0,
		  BLIS_MC, 2.0, 2.0,
		  BLIS_NR, 1.0, 1.0,
		  BLIS_MR, 1.0, 1.0,
		  BLIS_KR, 1.0, 1.0,
		  cntx
		);
	}
	else if ( method == BLIS_4M1A )
	{
		bli_cntx_set_ind_blkszs
		(
		  method, 6,
		  BLIS_NC, 1.0, 1.0,
		  BLIS_KC, 2.0, 2.0,
		  BLIS_MC, 1.0, 1.0,
		  BLIS_NR, 1.0, 1.0,
		  BLIS_MR, 1.0, 1.0,
		  BLIS_KR, 1.0, 1.0,
		  cntx
		);
	}
	else if ( method == BLIS_1M )
	{
		const bool_t is_pb = FALSE;

		// We MUST set the induced method in the context prior to calling
		// bli_cntx_l3_ukr_prefers_cols_dt() because that function queries
		// the induced method. It needs the induced method value in order
		// to determine whether to evaluate the "prefers column storage"
		// predicate using the storage preference of the kernel for dt, or
		// the storage preference of the kernel for the real projection of
		// dt. Failing to set the induced method here can lead to strange
		// undefined behavior at runtime if the native complex kernel's
		// storage preference happens to not equal that of the native real
		// kernel.
		bli_cntx_set_method( method, cntx );

		// Initialize the blocksizes according to the micro-kernel preference as
		// well as the algorithm.
		if ( bli_cntx_l3_ukr_prefers_cols_dt( dt, BLIS_GEMM_UKR, cntx ) )
		{
			// This branch is used for algorithms 1m_c_bp, 1m_r_pb.

			// Set the pack_t schemas for the c_bp or r_pb algorithms.
			if ( !is_pb )
			{
				bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_1E, cntx );
				bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_1R, cntx );
			}
			else // if ( is_pb )
			{
				bli_cntx_set_schema_b_panel( BLIS_PACKED_ROW_PANELS_1R, cntx );
				bli_cntx_set_schema_a_block( BLIS_PACKED_COL_PANELS_1E, cntx );
			}

			bli_cntx_set_ind_blkszs
			(
			  method, 6,
			  BLIS_NC, 1.0, 1.0,
			  BLIS_KC, 2.0, 2.0, // halve kc...
			  BLIS_MC, 2.0, 2.0, // halve mc...
			  BLIS_NR, 1.0, 1.0,
			  BLIS_MR, 2.0, 1.0, // ...and mr (but NOT packmr)
			  BLIS_KR, 1.0, 1.0,
			  cntx
			);
		}
		else // if ( bli_cntx_l3_ukr_prefers_rows_dt( dt, BLIS_GEMM_UKR, cntx ) )
		{
			// This branch is used for algorithms 1m_r_bp, 1m_c_pb.

			// Set the pack_t schemas for the r_bp or c_pb algorithms.
			if ( !is_pb )
			{
			    bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_1R, cntx );
			    bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_1E, cntx );
			}
			else // if ( is_pb )
			{
			    bli_cntx_set_schema_b_panel( BLIS_PACKED_ROW_PANELS_1E, cntx );
			    bli_cntx_set_schema_a_block( BLIS_PACKED_COL_PANELS_1R, cntx );
			}

			bli_cntx_set_ind_blkszs
			(
			  method, 6,
			  BLIS_NC, 2.0, 2.0, // halve nc...
			  BLIS_KC, 2.0, 2.0, // halve kc...
			  BLIS_MC, 1.0, 1.0,
			  BLIS_NR, 2.0, 1.0, // ...and nr (but NOT packnr)
			  BLIS_MR, 1.0, 1.0,
			  BLIS_KR, 1.0, 1.0,
			  cntx
			);
		}
	}
	else // if ( method == BLIS_NAT )
	{
		// No change in blocksizes needed for native execution.
	}


	// -- Set misc. other fields -----------------------------------------------

	if      ( method == BLIS_3MH )
	{
		// Schemas vary with _stage().
	}
	else if ( method == BLIS_3M1 )
	{
		bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_3MI, cntx );
		bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_3MI, cntx );
	}
	else if ( method == BLIS_4MH )
	{
		// Schemas vary with _stage().
	}
	else if ( method == BLIS_4M1A || method == BLIS_4M1B )
	{
		bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS_4MI, cntx );
		bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS_4MI, cntx );
	}
	else if ( method == BLIS_1M )
	{
		const bool_t is_pb = FALSE;

		// Set the anti-preference field to TRUE when executing a panel-block
		// algorithm, and FALSE otherwise. This will cause higher-level generic
		// code to establish (if needed) disagreement between the storage of C and
		// the micro-kernel output preference so that the two will come back into
		// agreement in the panel-block macro-kernel (which implemented in terms
		// of the block-panel macro-kernel with some induced transpositions).
		bli_cntx_set_anti_pref( is_pb, cntx );
	}
	else // if ( method == BLIS_NAT )
	{
	}
}
Ejemplo n.º 3
0
void GENBARNAME(cntx_init)
     (
       cntx_t* cntx
     )
{
	blksz_t  blkszs[ BLIS_NUM_BLKSZS ];
	func_t*  funcs;
	mbool_t* mbools;
	dim_t    i;


	// -- Clear the context ----------------------------------------------------

	bli_cntx_clear( cntx );


	// -- Set blocksizes -------------------------------------------------------

	//                                          s     d     c     z
	bli_blksz_init_easy( &blkszs[ BLIS_KR ],    1,    1,    1,    1 );
	bli_blksz_init_easy( &blkszs[ BLIS_MR ],    8,    4,    4,    2 );
	bli_blksz_init_easy( &blkszs[ BLIS_NR ],    4,    4,    2,    2 );
	bli_blksz_init_easy( &blkszs[ BLIS_MC ],  512,  256,  256,  128 );
	bli_blksz_init_easy( &blkszs[ BLIS_KC ],  256,  256,  256,  256 );
	bli_blksz_init_easy( &blkszs[ BLIS_NC ], 4096, 4096, 4096, 4096 );
	bli_blksz_init_easy( &blkszs[ BLIS_M2 ], 1000, 1000, 1000, 1000 );
	bli_blksz_init_easy( &blkszs[ BLIS_N2 ], 1000, 1000, 1000, 1000 );
	bli_blksz_init_easy( &blkszs[ BLIS_AF ],    8,    4,    4,    2 );
	bli_blksz_init_easy( &blkszs[ BLIS_DF ],    8,    4,    4,    2 );
	bli_blksz_init_easy( &blkszs[ BLIS_XF ],    8,    4,    4,    2 );

	// Initialize the context with the default blocksize objects and their
	// multiples.
	bli_cntx_set_blkszs
	(
	  BLIS_NAT, 11,
	  BLIS_NC, &blkszs[ BLIS_NC ], BLIS_NR,
	  BLIS_KC, &blkszs[ BLIS_KC ], BLIS_KR,
	  BLIS_MC, &blkszs[ BLIS_MC ], BLIS_MR,
	  BLIS_NR, &blkszs[ BLIS_NR ], BLIS_NR,
	  BLIS_MR, &blkszs[ BLIS_MR ], BLIS_MR,
	  BLIS_KR, &blkszs[ BLIS_KR ], BLIS_KR,
	  BLIS_M2, &blkszs[ BLIS_M2 ], BLIS_M2,
	  BLIS_N2, &blkszs[ BLIS_N2 ], BLIS_N2,
	  BLIS_AF, &blkszs[ BLIS_AF ], BLIS_AF,
	  BLIS_DF, &blkszs[ BLIS_DF ], BLIS_DF,
	  BLIS_XF, &blkszs[ BLIS_XF ], BLIS_XF,
	  cntx
	);


	// -- Set level-3 virtual micro-kernels ------------------------------------

	funcs = bli_cntx_l3_vir_ukrs_buf( cntx );

	gen_func_init_co( &funcs[ BLIS_GEMM_UKR ],       gemm1m_ukr_name       );
	gen_func_init_co( &funcs[ BLIS_GEMMTRSM_L_UKR ], gemmtrsm1m_l_ukr_name );
	gen_func_init_co( &funcs[ BLIS_GEMMTRSM_U_UKR ], gemmtrsm1m_u_ukr_name );
	gen_func_init_co( &funcs[ BLIS_TRSM_L_UKR ],     trsm1m_l_ukr_name     );
	gen_func_init_co( &funcs[ BLIS_TRSM_U_UKR ],     trsm1m_u_ukr_name     );


	// -- Set level-3 native micro-kernels and preferences ---------------------

	funcs  = bli_cntx_l3_nat_ukrs_buf( cntx );
	mbools = bli_cntx_l3_nat_ukrs_prefs_buf( cntx );

	gen_func_init( &funcs[ BLIS_GEMM_UKR ],       gemm_ukr_name       );
	gen_func_init( &funcs[ BLIS_GEMMTRSM_L_UKR ], gemmtrsm_l_ukr_name );
	gen_func_init( &funcs[ BLIS_GEMMTRSM_U_UKR ], gemmtrsm_u_ukr_name );
	gen_func_init( &funcs[ BLIS_TRSM_L_UKR ],     trsm_l_ukr_name     );
	gen_func_init( &funcs[ BLIS_TRSM_U_UKR ],     trsm_u_ukr_name     );

	bli_mbool_init( &mbools[ BLIS_GEMM_UKR ],       FALSE, FALSE, FALSE, FALSE );
	bli_mbool_init( &mbools[ BLIS_GEMMTRSM_L_UKR ], FALSE, FALSE, FALSE, FALSE );
	bli_mbool_init( &mbools[ BLIS_GEMMTRSM_U_UKR ], FALSE, FALSE, FALSE, FALSE );
	bli_mbool_init( &mbools[ BLIS_TRSM_L_UKR ],     FALSE, FALSE, FALSE, FALSE );
	bli_mbool_init( &mbools[ BLIS_TRSM_U_UKR ],     FALSE, FALSE, FALSE, FALSE );


	// -- Set level-1f kernels -------------------------------------------------

	funcs = bli_cntx_l1f_kers_buf( cntx );

	gen_func_init( &funcs[ BLIS_AXPY2V_KER ],    axpy2v_ker_name    );
	gen_func_init( &funcs[ BLIS_DOTAXPYV_KER ],  dotaxpyv_ker_name  );
	gen_func_init( &funcs[ BLIS_AXPYF_KER ],     axpyf_ker_name     );
	gen_func_init( &funcs[ BLIS_DOTXF_KER ],     dotxf_ker_name     );
	gen_func_init( &funcs[ BLIS_DOTXAXPYF_KER ], dotxaxpyf_ker_name );


	// -- Set level-1v kernels -------------------------------------------------

	funcs = bli_cntx_l1v_kers_buf( cntx );

	gen_func_init( &funcs[ BLIS_ADDV_KER ],    addv_ker_name    );
	gen_func_init( &funcs[ BLIS_AMAXV_KER ],   amaxv_ker_name   );
	gen_func_init( &funcs[ BLIS_AXPBYV_KER ],  axpbyv_ker_name  );
	gen_func_init( &funcs[ BLIS_AXPYV_KER ],   axpyv_ker_name   );
	gen_func_init( &funcs[ BLIS_COPYV_KER ],   copyv_ker_name   );
	gen_func_init( &funcs[ BLIS_DOTV_KER ],    dotv_ker_name    );
	gen_func_init( &funcs[ BLIS_DOTXV_KER ],   dotxv_ker_name   );
	gen_func_init( &funcs[ BLIS_INVERTV_KER ], invertv_ker_name );
	gen_func_init( &funcs[ BLIS_SCALV_KER ],   scalv_ker_name   );
	gen_func_init( &funcs[ BLIS_SCAL2V_KER ],  scal2v_ker_name  );
	gen_func_init( &funcs[ BLIS_SETV_KER ],    setv_ker_name    );
	gen_func_init( &funcs[ BLIS_SUBV_KER ],    subv_ker_name    );
	gen_func_init( &funcs[ BLIS_SWAPV_KER ],   swapv_ker_name   );
	gen_func_init( &funcs[ BLIS_XPBYV_KER ],   xpbyv_ker_name   );


	// -- Set level-1m (packm/unpackm) kernels ---------------------------------

	funcs = bli_cntx_packm_kers_buf( cntx );

	// Initialize all packm kernel func_t entries to NULL.
	for ( i = BLIS_PACKM_0XK_KER; i <= BLIS_PACKM_31XK_KER; ++i )
	{
		bli_func_init_null( &funcs[ i ] );
	}

	gen_func_init( &funcs[ BLIS_PACKM_2XK_KER ],  packm_2xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_3XK_KER ],  packm_3xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_4XK_KER ],  packm_4xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_6XK_KER ],  packm_6xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_8XK_KER ],  packm_8xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_10XK_KER ], packm_10xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_12XK_KER ], packm_12xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_14XK_KER ], packm_14xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_16XK_KER ], packm_16xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_24XK_KER ], packm_24xk_ker_name );
	gen_func_init( &funcs[ BLIS_PACKM_30XK_KER ], packm_30xk_ker_name );

	funcs = bli_cntx_unpackm_kers_buf( cntx );

	// Initialize all packm kernel func_t entries to NULL.
	for ( i = BLIS_UNPACKM_0XK_KER; i <= BLIS_UNPACKM_31XK_KER; ++i )
	{
		bli_func_init_null( &funcs[ i ] );
	}

	gen_func_init( &funcs[ BLIS_UNPACKM_2XK_KER ],  unpackm_2xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_4XK_KER ],  unpackm_4xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_6XK_KER ],  unpackm_6xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_8XK_KER ],  unpackm_8xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_10XK_KER ], unpackm_10xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_12XK_KER ], unpackm_12xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_14XK_KER ], unpackm_14xk_ker_name );
	gen_func_init( &funcs[ BLIS_UNPACKM_16XK_KER ], unpackm_16xk_ker_name );


	// -- Set miscellaneous fields ---------------------------------------------

	bli_cntx_set_method( BLIS_NAT, cntx );

	bli_cntx_set_schema_a_block( BLIS_PACKED_ROW_PANELS, cntx );
	bli_cntx_set_schema_b_panel( BLIS_PACKED_COL_PANELS, cntx );
	bli_cntx_set_schema_c_panel( BLIS_NOT_PACKED,        cntx );

	bli_cntx_set_anti_pref( FALSE, cntx );

	bli_cntx_set_thrloop( 1, 1, 1, 1, 1, cntx );

	bli_cntx_set_membrk( bli_memsys_global_membrk(), cntx );
}