From f965b95d8b73a30a1caa29acfcfaf0edac11c7ec Mon Sep 17 00:00:00 2001 From: dzambare Date: Fri, 24 Jan 2020 10:25:14 +0530 Subject: [PATCH] CPUPL-587: Corrected condition for A packing in sgemm_small Change-Id: I1e5dc4a1dbe2f1d17f9c72e8dd0c6728ac1fd750 --- kernels/zen/3/bli_gemm_small.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/kernels/zen/3/bli_gemm_small.c b/kernels/zen/3/bli_gemm_small.c index b0d234759..aced37b75 100644 --- a/kernels/zen/3/bli_gemm_small.c +++ b/kernels/zen/3/bli_gemm_small.c @@ -261,7 +261,18 @@ static err_t bli_sgemm_small // Based on the available memory in the buffer we will decide if // we want to do packing or not. - if (((MR * K) << 2) > buffer_size) + // + // This kernel assumes that "A" will be unpackged if N <= 3. + // Usually this range (N <= 3) is handled by SUP, however, + // if SUP is disabled or for any other condition if we do + // enter this kernel with N <= 3, we want to make sure that + // "A" remains unpacked. + // + // If this check is removed it will result in the crash as + // reported in CPUPL-587. + // + + if ((N <= 3) || (((MR * K) << 2) > buffer_size)) { required_packing_A = 0; } @@ -1726,12 +1737,21 @@ static err_t bli_dgemm_small bli_membrk_pool(bli_packbuf_index(BLIS_BITVAL_BUFFER_FOR_A_BLOCK), bli_rntm_membrk(&rntm))); -#ifndef BLIS_ENABLE_SMALL_MATRIX_ROME - if (((D_MR * K) << 3) > buffer_size) + // + // This kernel assumes that "A" will be unpackged if N <= 3. + // Usually this range (N <= 3) is handled by SUP, however, + // if SUP is disabled or for any other condition if we do + // enter this kernel with N <= 3, we want to make sure that + // "A" remains unpacked. + // + // If this check is removed it will result in the crash as + // reported in CPUPL-587. + // + + if ((N <= 3) || ((D_MR * K) << 3) > buffer_size) { required_packing_A = 0; } -#endif if (required_packing_A == 1) {