Skip to content

Commit

Permalink
opt arm64 tiles, fix asimdhp dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Oct 12, 2024
1 parent b8421f7 commit 4f24312
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 54 deletions.
16 changes: 16 additions & 0 deletions src/layer/arm/gemm_int8.h
Original file line number Diff line number Diff line change
Expand Up @@ -14617,7 +14617,11 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int constant_TILE_M,
int tile_size = (int)sqrtf((float)l2_cache_size / (2 * sizeof(signed char) + sizeof(int)));

TILE_M = std::max(8, tile_size / 8 * 8);
#if __aarch64__
TILE_N = std::max(8, tile_size / 8 * 8);
#else
TILE_N = std::max(4, tile_size / 4 * 4);
#endif
TILE_K = std::max(8, tile_size / 8 * 8);

if (K > 0)
Expand All @@ -14630,7 +14634,11 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int constant_TILE_M,
tile_size = (int)((float)l2_cache_size / 2 / sizeof(signed char) / TILE_K);

TILE_M = std::max(8, tile_size / 8 * 8);
#if __aarch64__
TILE_N = std::max(8, tile_size / 8 * 8);
#else
TILE_N = std::max(4, tile_size / 4 * 4);
#endif
}
}

Expand All @@ -14645,7 +14653,11 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int constant_TILE_M,
if (N > 0)
{
int nn_N = (N + TILE_N - 1) / TILE_N;
#if __aarch64__
TILE_N = std::min(TILE_N, ((N + nn_N - 1) / nn_N + 7) / 8 * 8);
#else
TILE_N = std::min(TILE_N, ((N + nn_N - 1) / nn_N + 3) / 4 * 4);
#endif
}

if (nT > 1)
Expand All @@ -14661,7 +14673,11 @@ static void get_optimal_tile_mnk_int8(int M, int N, int K, int constant_TILE_M,

if (constant_TILE_N > 0)
{
#if __aarch64__
TILE_N = (constant_TILE_N + 7) / 8 * 8;
#else
TILE_N = (constant_TILE_N + 3) / 4 * 4;
#endif
}

if (constant_TILE_K > 0)
Expand Down
Loading

0 comments on commit 4f24312

Please sign in to comment.