From 54ae37b6911e916e65abe47407cf8cd4679c22fa Mon Sep 17 00:00:00 2001 From: zp7 <9678873+ForceDaryl@users.noreply.github.com> Date: Thu, 26 Sep 2019 18:36:52 +0800 Subject: [PATCH] fix crash (#2139) --- mobile/src/operators/math/gemm/gemm1x1s1.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mobile/src/operators/math/gemm/gemm1x1s1.cpp b/mobile/src/operators/math/gemm/gemm1x1s1.cpp index fd997dc48d..2fd78fa189 100644 --- a/mobile/src/operators/math/gemm/gemm1x1s1.cpp +++ b/mobile/src/operators/math/gemm/gemm1x1s1.cpp @@ -1518,10 +1518,12 @@ void sgemm_conv_6x8(const float* A_packed, const float* B, const float* bias, (l2_cache - (MBLOCK_OTH * K)) / (sizeof(float) * (K + MBLOCK_OTH)); x_block /= NBLOCK; x_block *= NBLOCK; - int x_num = (N + (x_block - 1)) / x_block; - x_block = (N + x_num - 1) / x_num; - x_block = (x_block + NBLOCK - 1) / NBLOCK; - x_block *= NBLOCK; + if (x_block != 0) { + int x_num = (N + (x_block - 1)) / x_block; + x_block = (N + x_num - 1) / x_num; + x_block = (x_block + NBLOCK - 1) / NBLOCK; + x_block *= NBLOCK; + } x_block = x_block < NBLOCK ? NBLOCK : x_block; int k_pre = ((K + KBLOCK - 1) / KBLOCK) - 1; int tail_pre = (K & (KBLOCK - 1)); -- GitLab