diff --git a/modules/dnn/src/int8layers/conv2_int8_kernels.simd.hpp b/modules/dnn/src/int8layers/conv2_int8_kernels.simd.hpp index 93c652aca8..58fee00b73 100644 --- a/modules/dnn/src/int8layers/conv2_int8_kernels.simd.hpp +++ b/modules/dnn/src/int8layers/conv2_int8_kernels.simd.hpp @@ -1163,6 +1163,9 @@ static void convInt8BlockDepthwise(const void* inp_, const void* residual_, ((planeblocks_ + nthreads * 4 - 1) / (nthreads * 4) + SB_TILE - 1) & ~(SB_TILE - 1)); int ntiles = (planeblocks_ + TILE - 1) / TILE; int total_tasks = N * K1 * ntiles; +#if CV_AVX2 && (defined(__x86_64__) || defined(_M_X64)) + constexpr int WBUF_SIZE = 128 * 8; // 128 * K0, K0=8; named for MSVC +#endif parallel_for_(Range(0, total_tasks), [&](const Range& range) { int H = H_, W = W_; @@ -1193,9 +1196,8 @@ static void convInt8BlockDepthwise(const void* inp_, const void* residual_, if (ksize <= 128) { int n_g = g_end - g_start; constexpr int SB = 8; - // Pre-gather weights for this group block into wbuf[ksize * K0]. - alignas(32) int8_t wbuf[128 * K0]; + alignas(32) int8_t wbuf[WBUF_SIZE]; for (int i = 0; i < ksize; i++) { for (int j = 0; j < n_g; j++) { int g = g_start + j; @@ -1584,13 +1586,16 @@ void convInt8Block(const void* inp_, const void* residual_, } int total_blocks = N * ngroups * Kblk; +#if CV_AVX2 + constexpr int SUMBUF_SIZE = 8 * 8; // SPAT_BLOCK_SIZE * K0, both=8; named for MSVC +#endif parallel_for_(Range(0, total_blocks), [&](const Range& range) { constexpr int C0 = 8, K0 = 8; constexpr int C0shift = 3; #if CV_AVX2 constexpr int SPAT_BLOCK_SIZE = 8; - alignas(32) int32_t sumbuf[SPAT_BLOCK_SIZE * K0]; + alignas(32) int32_t sumbuf[SUMBUF_SIZE]; #endif const uint8_t xor_val = inputIsU8 ? 0x80 : 0;