From 0cef09aa92208441a656bf097f197ea8e22b533b Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Fri, 4 Dec 2020 16:40:59 -0600 Subject: [PATCH] Consolidated code in level-3 _front() functions. Details: - Reduced a code segment that appears in all of the bli_*_front() functions except for bli_gemm_front(). Previously, the code looked like this (taken from bli_herk_front()): if ( bli_cntx_method( cntx ) == BLIS_NAT ) { bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &ah_local ); } else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) { pack_t schema_a = bli_cntx_schema_a_block( cntx ); pack_t schema_b = bli_cntx_schema_b_panel( cntx ); bli_obj_set_pack_schema( schema_a, &a_local ); bli_obj_set_pack_schema( schema_b, &ah_local ); } This code segment is part of a sort-of-hack that allows us to communicate the pack schemas into the level-3 thread decorator, which needs them so that they can be passed into bli_l3_cntl_create_if(), where the control tree is created. However, the first conditional case above is unnecessary because the second case is fully generalized. That is, even in the native case, the context contains correct, queryable schemas. Thus, these code segments were reduced to something like: pack_t schema_a = bli_cntx_schema_a_block( cntx ); pack_t schema_b = bli_cntx_schema_b_panel( cntx ); bli_obj_set_pack_schema( schema_a, &a_local ); bli_obj_set_pack_schema( schema_b, &ah_local ); There's always a small chance that the seemingly unnecessary code in the first branch case has some special use that is not apparent to me, but the testsuite's default input parameters seem to think this commit will be fine. --- frame/1m/packm/bli_packm_cxk.c | 5 +++-- frame/3/gemmt/bli_gemmt_front.c | 16 ++++------------ frame/3/hemm/bli_hemm_front.c | 16 ++++------------ frame/3/her2k/bli_her2k_front.c | 22 ++++++---------------- frame/3/herk/bli_herk_front.c | 16 ++++------------ frame/3/symm/bli_symm_front.c | 16 ++++------------ frame/3/syr2k/bli_syr2k_front.c | 22 ++++++---------------- frame/3/syrk/bli_syrk_front.c | 16 ++++------------ frame/3/trmm/bli_trmm_front.c | 16 ++++------------ frame/3/trmm3/bli_trmm3_front.c | 16 ++++------------ frame/3/trsm/bli_trsm_front.c | 16 ++++------------ 11 files changed, 47 insertions(+), 130 deletions(-) diff --git a/frame/1m/packm/bli_packm_cxk.c b/frame/1m/packm/bli_packm_cxk.c index cc47f4a83..ea0418cae 100644 --- a/frame/1m/packm/bli_packm_cxk.c +++ b/frame/1m/packm/bli_packm_cxk.c @@ -74,8 +74,9 @@ void PASTEMAC(ch,opname) \ the outer (panel_dim_max - panel_dim) rows or columns of the micropanel. (Note that these rows/columns correspond to values beyond the edge of matrix A.) The kernel intrinsically knows its - own panel_dim_max, since that corresponds to the packm kernel's - leading dimension. However, we *do* need to pass in panel_len_max + own panel_dim_max, since that corresponds to the packm micropanel's + normal width (corresponding to the gemm microkernel's register + blocksize (mr or nr). However, we *do* need to pass in panel_len_max because the bottom-right edge case of trsm_lu will need all elements above the extended diagonal and beyond (to the right of) the bottom-right element to be initialized to zero so the trsm diff --git a/frame/3/gemmt/bli_gemmt_front.c b/frame/3/gemmt/bli_gemmt_front.c index 8c1089a0f..d652618cb 100644 --- a/frame/3/gemmt/bli_gemmt_front.c +++ b/frame/3/gemmt/bli_gemmt_front.c @@ -110,19 +110,11 @@ void bli_gemmt_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &b_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &b_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &b_local ); // Invoke the internal back-end via the thread handler. bli_l3_thread_decorator diff --git a/frame/3/hemm/bli_hemm_front.c b/frame/3/hemm/bli_hemm_front.c index 14759e515..d1746eb4e 100644 --- a/frame/3/hemm/bli_hemm_front.c +++ b/frame/3/hemm/bli_hemm_front.c @@ -155,19 +155,11 @@ void bli_hemm_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &b_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &b_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &b_local ); // Invoke the internal back-end. bli_l3_thread_decorator diff --git a/frame/3/her2k/bli_her2k_front.c b/frame/3/her2k/bli_her2k_front.c index a99aa05c8..096ea463b 100644 --- a/frame/3/her2k/bli_her2k_front.c +++ b/frame/3/her2k/bli_her2k_front.c @@ -124,23 +124,13 @@ void bli_her2k_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &bh_local ); - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &b_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &ah_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &bh_local ); - bli_obj_set_pack_schema( schema_a, &b_local ); - bli_obj_set_pack_schema( schema_b, &ah_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &bh_local ); + bli_obj_set_pack_schema( schema_a, &b_local ); + bli_obj_set_pack_schema( schema_b, &ah_local ); // Invoke herk twice, using beta only the first time. diff --git a/frame/3/herk/bli_herk_front.c b/frame/3/herk/bli_herk_front.c index be0118f18..a88d23e90 100644 --- a/frame/3/herk/bli_herk_front.c +++ b/frame/3/herk/bli_herk_front.c @@ -104,19 +104,11 @@ void bli_herk_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &ah_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &ah_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &ah_local ); // Invoke the internal back-end. bli_l3_thread_decorator diff --git a/frame/3/symm/bli_symm_front.c b/frame/3/symm/bli_symm_front.c index 4d0727202..61238fb15 100644 --- a/frame/3/symm/bli_symm_front.c +++ b/frame/3/symm/bli_symm_front.c @@ -154,19 +154,11 @@ void bli_symm_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &b_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &b_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &b_local ); // Invoke the internal back-end. bli_l3_thread_decorator diff --git a/frame/3/syr2k/bli_syr2k_front.c b/frame/3/syr2k/bli_syr2k_front.c index 3ccd28c5c..c1532b92d 100644 --- a/frame/3/syr2k/bli_syr2k_front.c +++ b/frame/3/syr2k/bli_syr2k_front.c @@ -105,23 +105,13 @@ void bli_syr2k_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &bt_local ); - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &b_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &at_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &bt_local ); - bli_obj_set_pack_schema( schema_a, &b_local ); - bli_obj_set_pack_schema( schema_b, &at_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &bt_local ); + bli_obj_set_pack_schema( schema_a, &b_local ); + bli_obj_set_pack_schema( schema_b, &at_local ); // Invoke herk twice, using beta only the first time. diff --git a/frame/3/syrk/bli_syrk_front.c b/frame/3/syrk/bli_syrk_front.c index 4c3f98136..14c5d4a3d 100644 --- a/frame/3/syrk/bli_syrk_front.c +++ b/frame/3/syrk/bli_syrk_front.c @@ -107,19 +107,11 @@ void bli_syrk_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &at_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &at_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &at_local ); // Invoke the internal back-end. bli_l3_thread_decorator diff --git a/frame/3/trmm/bli_trmm_front.c b/frame/3/trmm/bli_trmm_front.c index 6b71a4998..63fc8053f 100644 --- a/frame/3/trmm/bli_trmm_front.c +++ b/frame/3/trmm/bli_trmm_front.c @@ -173,19 +173,11 @@ void bli_trmm_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &b_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &b_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &b_local ); // Invoke the internal back-end. bli_l3_thread_decorator diff --git a/frame/3/trmm3/bli_trmm3_front.c b/frame/3/trmm3/bli_trmm3_front.c index e49d2366a..ba7d3a91f 100644 --- a/frame/3/trmm3/bli_trmm3_front.c +++ b/frame/3/trmm3/bli_trmm3_front.c @@ -165,19 +165,11 @@ void bli_trmm3_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &b_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &b_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &b_local ); // Invoke the internal back-end. bli_l3_thread_decorator diff --git a/frame/3/trsm/bli_trsm_front.c b/frame/3/trsm/bli_trsm_front.c index c6c6234f0..77c177d8a 100644 --- a/frame/3/trsm/bli_trsm_front.c +++ b/frame/3/trsm/bli_trsm_front.c @@ -147,19 +147,11 @@ void bli_trsm_front // bli_l3_cntl_create_if()). This allows us to access the schemas from // the control tree, which hopefully reduces some confusion, particularly // in bli_packm_init(). - if ( bli_cntx_method( cntx ) == BLIS_NAT ) - { - bli_obj_set_pack_schema( BLIS_PACKED_ROW_PANELS, &a_local ); - bli_obj_set_pack_schema( BLIS_PACKED_COL_PANELS, &b_local ); - } - else // if ( bli_cntx_method( cntx ) != BLIS_NAT ) - { - pack_t schema_a = bli_cntx_schema_a_block( cntx ); - pack_t schema_b = bli_cntx_schema_b_panel( cntx ); + pack_t schema_a = bli_cntx_schema_a_block( cntx ); + pack_t schema_b = bli_cntx_schema_b_panel( cntx ); - bli_obj_set_pack_schema( schema_a, &a_local ); - bli_obj_set_pack_schema( schema_b, &b_local ); - } + bli_obj_set_pack_schema( schema_a, &a_local ); + bli_obj_set_pack_schema( schema_b, &b_local ); // Invoke the internal back-end. bli_l3_thread_decorator