Skip to content

Commit fcde729

Browse files
authored
riscv: add int8 convolution winograd (#7093)
1 parent b0f97f4 commit fcde729

10 files changed

Lines changed: 1594 additions & 19 deletions

‎src/layer/arm/convolution_3x3_winograd_int8.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3432,7 +3432,7 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int& TILE_M, int& TIL
34323432
#if __aarch64__
34333433
TILE_K = std::max(8, tile_size / 8 * 8);
34343434
#elif __ARM_NEON
3435-
TILE_K = std::max(4, tile_size / 4 * 4);
3435+
TILE_K = std::max(8, tile_size / 8 * 8);
34363436
#else
34373437
TILE_K = std::max(2, tile_size / 2 * 2);
34383438
#endif
@@ -3441,7 +3441,7 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int& TILE_M, int& TIL
34413441
#if __aarch64__
34423442
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 7) / 8 * 8);
34433443
#elif __ARM_NEON
3444-
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 3) / 4 * 4);
3444+
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 7) / 8 * 8);
34453445
#else
34463446
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 1) / 2 * 2);
34473447
#endif

‎src/layer/loongarch/convolution_3x3_winograd_int8.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,7 +2551,7 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int& TILE_M, int& TIL
25512551
#if __loongarch_asx
25522552
TILE_K = std::max(8, tile_size / 8 * 8);
25532553
#elif __loongarch_sx
2554-
TILE_K = std::max(4, tile_size / 4 * 4);
2554+
TILE_K = std::max(8, tile_size / 8 * 8);
25552555
#else
25562556
TILE_K = std::max(2, tile_size / 2 * 2);
25572557
#endif
@@ -2560,7 +2560,7 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int& TILE_M, int& TIL
25602560
#if __loongarch_asx
25612561
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 7) / 8 * 8);
25622562
#elif __loongarch_sx
2563-
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 3) / 4 * 4);
2563+
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 7) / 8 * 8);
25642564
#else
25652565
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 1) / 2 * 2);
25662566
#endif

‎src/layer/mips/convolution_3x3_winograd_int8.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,14 +1901,14 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int& TILE_M, int& TIL
19011901
int tile_size = (int)(sqrt((float)l2_cache_size_int8) - TILE_M);
19021902

19031903
#if __mips_msa
1904-
TILE_K = std::max(4, tile_size / 4 * 4);
1904+
TILE_K = std::max(8, tile_size / 8 * 8);
19051905
#else
19061906
TILE_K = std::max(2, tile_size / 2 * 2);
19071907
#endif
19081908

19091909
int nn_K = (K + TILE_K - 1) / TILE_K;
19101910
#if __mips_msa
1911-
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 3) / 4 * 4);
1911+
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 7) / 8 * 8);
19121912
#else
19131913
TILE_K = std::min(TILE_K, ((K + nn_K - 1) / nn_K + 1) / 2 * 2);
19141914
#endif

0 commit comments

Comments
 (0)