From 2f8d1d4f9e4711af155ac340814ecb73bf6bc388 Mon Sep 17 00:00:00 2001 From: nihui Date: Sat, 10 Dec 2022 21:27:42 +0800 Subject: [PATCH] fix gemm x86 transpose b pack4 mis-alignment --- src/layer/x86/gemm_x86.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layer/x86/gemm_x86.cpp b/src/layer/x86/gemm_x86.cpp index e18848ce2..5fb8d7771 100644 --- a/src/layer/x86/gemm_x86.cpp +++ b/src/layer/x86/gemm_x86.cpp @@ -1577,7 +1577,7 @@ static void transpose_pack_B_tile(const Mat& B, Mat& BT, int j, int max_jj, int #endif // __AVX__ if (elempack == 4) { - const float* p0 = (const float*)B + k * B_hstep + (j + jj) * 4; + const float* p0 = (const float*)B + k / 4 * 4 * B_hstep + (j + jj) * 4; int kk = 0; for (; kk + 3 < max_kk; kk += 4) @@ -1692,7 +1692,7 @@ static void transpose_pack_B_tile(const Mat& B, Mat& BT, int j, int max_jj, int #endif // __AVX__ if (elempack == 4) { - const float* p0 = (const float*)B + k * B_hstep + (j + jj) * 4; + const float* p0 = (const float*)B + k / 4 * 4 * B_hstep + (j + jj) * 4; int kk = 0; for (; kk + 3 < max_kk; kk += 4) @@ -1781,7 +1781,7 @@ static void transpose_pack_B_tile(const Mat& B, Mat& BT, int j, int max_jj, int #endif // __AVX__ if (elempack == 4) { - const float* p0 = (const float*)B + k * B_hstep + (j + jj) * 4; + const float* p0 = (const float*)B + k / 4 * 4 * B_hstep + (j + jj) * 4; int kk = 0; for (; kk + 3 < max_kk; kk += 4) @@ -1854,7 +1854,7 @@ static void transpose_pack_B_tile(const Mat& B, Mat& BT, int j, int max_jj, int #endif // __AVX__ if (elempack == 4) { - const float* p0 = (const float*)B + k * B_hstep + (j + jj) * 4; + const float* p0 = (const float*)B + k / 4 * 4 * B_hstep + (j + jj) * 4; int kk = 0; for (; kk + 3 < max_kk; kk += 4) @@ -1917,7 +1917,7 @@ static void transpose_pack_B_tile(const Mat& B, Mat& BT, int j, int max_jj, int #endif // __AVX__ if (elempack == 4) { - const float* p0 = (const float*)B + k * B_hstep + (j + jj) * 4; + const float* p0 = (const float*)B + k / 4 * 4 * B_hstep + (j + jj) * 4; int kk = 0; for (; kk + 3 < max_kk; kk += 4)