fattn-vec-f16.cuh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. /**
  2. * llama.cpp - commit 8962422b1c6f9b8b15f5aeaea42600bcc2d44177 - do not edit this file
  3. *
  4. * MIT License
  5. *
  6. * Copyright (c) 2023-2024 The ggml authors
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in all
  16. * copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  24. * SOFTWARE.
  25. */
  26. #include "common.cuh"
  27. #include "fattn-common.cuh"
  28. template<int D, int ncols, int parallel_blocks, ggml_type type_K, ggml_type type_V, bool use_logit_softcap> // D == head size
  29. #if !(defined(GGML_USE_HIPBLAS) && defined(__HIP_PLATFORM_AMD__))
  30. __launch_bounds__(D, 1)
  31. #endif // !(defined(GGML_USE_HIPBLAS) && defined(__HIP_PLATFORM_AMD__))
  32. static __global__ void flash_attn_vec_ext_f16(
  33. const char * __restrict__ Q,
  34. const char * __restrict__ K,
  35. const char * __restrict__ V,
  36. const char * __restrict__ mask,
  37. float * __restrict__ dst,
  38. float2 * __restrict__ dst_meta,
  39. const float scale,
  40. const float max_bias,
  41. const float m0,
  42. const float m1,
  43. const uint32_t n_head_log2,
  44. const float logit_softcap,
  45. const int ne00,
  46. const int ne01,
  47. const int ne02,
  48. const int ne03,
  49. const int ne10,
  50. const int ne11,
  51. const int ne12,
  52. const int ne13,
  53. const int ne31,
  54. const int nb31,
  55. const int nb01,
  56. const int nb02,
  57. const int nb03,
  58. const int nb11,
  59. const int nb12,
  60. const int nb13,
  61. const int nb21,
  62. const int nb22,
  63. const int nb23,
  64. const int ne0,
  65. const int ne1,
  66. const int ne2,
  67. const int ne3) {
  68. #ifdef FP16_AVAILABLE
  69. // Skip unused kernel variants for faster compilation:
  70. if (use_logit_softcap && !(D == 128 || D == 256)) {
  71. NO_DEVICE_CODE;
  72. return;
  73. }
  74. //In this kernel Q, K, V are matrices while i, j, k are matrix indices.
  75. constexpr vec_dot_KQ_f16_t vec_dot_KQ = get_vec_dot_KQ_f16<D>(type_K);
  76. constexpr bool Q_q8_1 = type_K != GGML_TYPE_F16;
  77. constexpr dequantize_1_f16_t dequantize_1_v = get_dequantize_1_f16(type_V);
  78. const int ic0 = (blockIdx.x / parallel_blocks) * ncols; // Index of the Q/QKV column to work on.
  79. const int ip = blockIdx.x % parallel_blocks; // Index in group of blocks running for the same column in parallel.
  80. const int gqa_ratio = ne02 / ne12; // With grouped query attention there are > 1 Q matrices per K, V matrix.
  81. Q += nb02* blockIdx.y + nb01*ic0;
  82. K += nb12*(blockIdx.y / gqa_ratio);
  83. V += nb22*(blockIdx.y / gqa_ratio);
  84. const half * maskh = (const half *) mask + ne11*ic0;
  85. const float slopef = get_alibi_slope(max_bias, blockIdx.y, n_head_log2, m0, m1);
  86. const half slopeh = __float2half(slopef);
  87. static_assert(D % (2*WARP_SIZE) == 0, "D not divisible by 2*WARP_SIZE == 64.");
  88. constexpr int nwarps = D / WARP_SIZE;
  89. const int tid = WARP_SIZE*threadIdx.y + threadIdx.x;
  90. __builtin_assume(tid < D);
  91. __shared__ half KQ[ncols*D];
  92. half2 * KQ2 = (half2 *) KQ;
  93. half kqmax[ncols];
  94. #pragma unroll
  95. for (int j = 0; j < ncols; ++j) {
  96. kqmax[j] = -HALF_MAX_HALF;
  97. }
  98. half kqsum[ncols] = {0.0f};
  99. __shared__ half kqmax_shared[ncols][WARP_SIZE];
  100. __shared__ half kqsum_shared[ncols][WARP_SIZE];
  101. #pragma unroll
  102. for (int j = 0; j < ncols; ++j) {
  103. if (threadIdx.y == 0) {
  104. kqmax_shared[j][threadIdx.x] = -HALF_MAX_HALF;
  105. kqsum_shared[j][threadIdx.x] = 0.0f;
  106. }
  107. }
  108. __syncthreads();
  109. // Convert Q to half2 (f16 K) or q8_1 (quantized K) and store in registers:
  110. half2 Q_h2[ncols][D/(2*WARP_SIZE)];
  111. int Q_i32[ncols][D/(sizeof(int)*QK8_1) == 0 ? 1 : D/(sizeof(int)*QK8_1)];
  112. half2 Q_ds[ncols][D/QK8_1 == 0 ? 1 : D/QK8_1];
  113. if (Q_q8_1) {
  114. #pragma unroll
  115. for (int j0 = 0; j0 < ncols; j0 += nwarps) {
  116. const int j = j0 + threadIdx.y;
  117. if (j0 + nwarps > ncols && j >= ncols) {
  118. break;
  119. }
  120. // Reuse KQ as temporary storage for converting Q to q8_1:
  121. int * tmp_q_i32 = (int *) &KQ[j*D];
  122. half2 * tmp_q_ds = (half2 *) (tmp_q_i32 + D/sizeof(int));
  123. // Set memory to zero if out of bounds:
  124. if (ncols > 2 && ic0 + j >= ne01) {
  125. #pragma unroll
  126. for (int i0 = 0; i0 < D/sizeof(int); i0 += WARP_SIZE) {
  127. const int i = i0 + threadIdx.x;
  128. tmp_q_i32[i] = 0;
  129. }
  130. if (threadIdx.x < D/QK8_1) {
  131. tmp_q_ds[threadIdx.x] = make_half2(0.0f, 0.0f);
  132. }
  133. continue;
  134. }
  135. const float * Q_f = (const float *) (Q + j*nb01);
  136. #pragma unroll
  137. for (int i0 = 0; i0 < D/sizeof(int); i0 += WARP_SIZE) {
  138. quantize_q8_1_to_shared<half2>(Q_f + 4*i0, scale, tmp_q_i32, tmp_q_ds);
  139. }
  140. }
  141. __syncthreads();
  142. #pragma unroll
  143. for (int j = 0; j < ncols; ++j) {
  144. int * tmp_q_i32 = (int *) &KQ[j*D];
  145. half2 * tmp_q_ds = (half2 *) (tmp_q_i32 + D/sizeof(int));
  146. #pragma unroll
  147. for (int i0 = 0; i0 < D/sizeof(int); i0 += WARP_SIZE) {
  148. const int i = i0 + threadIdx.x;
  149. Q_i32[j][i0/WARP_SIZE] = tmp_q_i32[i];
  150. Q_ds[j][i0/WARP_SIZE] = tmp_q_ds[i/QI8_1];
  151. }
  152. }
  153. __syncthreads();
  154. } else {
  155. #pragma unroll
  156. for (int j = 0; j < ncols; ++j) {
  157. const float2 * Q_f2_j = (const float2 *) (Q + j*nb01);
  158. #pragma unroll
  159. for (int i0 = 0; i0 < D/2; i0 += WARP_SIZE) {
  160. const int i = i0 + threadIdx.x;
  161. const float2 tmp = ncols <= 2 || ic0 + j < ne01 ? Q_f2_j[i] : make_float2(0.0f, 0.0f);
  162. Q_h2[j][i0/WARP_SIZE] = make_half2(scale, scale) * make_half2(tmp.x, tmp.y);
  163. }
  164. }
  165. }
  166. #pragma unroll
  167. for (int j = 0; j < ncols; ++j) {
  168. KQ[j*D + tid] = -HALF_MAX_HALF;
  169. }
  170. half2 VKQ[ncols] = {{0.0f, 0.0f}};
  171. const int k_start = parallel_blocks == 1 ? 0 : ip*D;
  172. for (int k_VKQ_0 = k_start; k_VKQ_0 < ne11; k_VKQ_0 += parallel_blocks*D) {
  173. // Calculate KQ tile and keep track of new maximum KQ values:
  174. // For unknown reasons using a half array of size 1 for kqmax_new causes a performance regression,
  175. // see https://github.com/ggerganov/llama.cpp/pull/7061 .
  176. // Therefore this variable is defined twice but only used once (so that the compiler can optimize out the unused variable).
  177. half kqmax_new = kqmax[0];
  178. half kqmax_new_arr[ncols];
  179. #pragma unroll
  180. for (int j = 0; j < ncols; ++j) {
  181. kqmax_new_arr[j] = kqmax[j];
  182. }
  183. #pragma unroll
  184. for (int i_KQ_0 = 0; i_KQ_0 < D; i_KQ_0 += nwarps) {
  185. const int i_KQ = i_KQ_0 + threadIdx.y;
  186. if ((i_KQ_0 + nwarps > D && i_KQ >= D) || (FATTN_KQ_STRIDE % D != 0 && k_VKQ_0 + i_KQ >= ne11)) {
  187. break;
  188. }
  189. #pragma unroll
  190. for (int j = 0; j < ncols; ++j) {
  191. half sum = vec_dot_KQ(K + (k_VKQ_0 + i_KQ)*nb11, Q_h2[j], Q_i32[j], Q_ds[j]);
  192. sum = warp_reduce_sum(sum);
  193. if (use_logit_softcap) {
  194. sum = logit_softcap*tanhf(sum);
  195. }
  196. sum += mask ? slopeh*maskh[j*ne11 + k_VKQ_0 + i_KQ] : __float2half(0.0f);
  197. if (ncols == 1) {
  198. kqmax_new = ggml_cuda_hmax(kqmax_new, sum);
  199. } else {
  200. kqmax_new_arr[j] = ggml_cuda_hmax(kqmax_new_arr[j], sum);
  201. }
  202. if (threadIdx.x == 0) {
  203. KQ[j*D + i_KQ] = sum;
  204. }
  205. }
  206. }
  207. #pragma unroll
  208. for (int j = 0; j < ncols; ++j) {
  209. half kqmax_new_j = ncols == 1 ? kqmax_new : kqmax_new_arr[j];
  210. kqmax_new_j = warp_reduce_max(kqmax_new_j);
  211. if (threadIdx.x == 0) {
  212. kqmax_shared[j][threadIdx.y] = kqmax_new_j;
  213. }
  214. }
  215. __syncthreads();
  216. #pragma unroll
  217. for (int j = 0; j < ncols; ++j) {
  218. half kqmax_new_j = kqmax_shared[j][threadIdx.x];
  219. kqmax_new_j = warp_reduce_max(kqmax_new_j);
  220. const half KQ_max_scale = hexp(kqmax[j] - kqmax_new_j);
  221. kqmax[j] = kqmax_new_j;
  222. const half val = hexp(KQ[j*D + tid] - kqmax[j]);
  223. kqsum[j] = kqsum[j]*KQ_max_scale + val;
  224. KQ[j*D + tid] = val;
  225. VKQ[j] *= __half2half2(KQ_max_scale);
  226. }
  227. __syncthreads();
  228. #pragma unroll
  229. for (int k0 = 0; k0 < D; k0 += 2) {
  230. if (FATTN_KQ_STRIDE % D != 0 && k_VKQ_0 + k0 >= ne11) {
  231. break;
  232. }
  233. half2 V_k;
  234. reinterpret_cast<half&>(V_k.x) = dequantize_1_v(V + (k_VKQ_0 + k0 + 0)*nb21, tid);
  235. reinterpret_cast<half&>(V_k.y) = dequantize_1_v(V + (k_VKQ_0 + k0 + 1)*nb21, tid);
  236. #pragma unroll
  237. for (int j = 0; j < ncols; ++j) {
  238. VKQ[j] += V_k*KQ2[j*(D/2) + k0/2];
  239. }
  240. }
  241. __syncthreads();
  242. }
  243. #pragma unroll
  244. for (int j = 0; j < ncols; ++j) {
  245. kqsum[j] = warp_reduce_sum(kqsum[j]);
  246. if (threadIdx.x == 0) {
  247. kqsum_shared[j][threadIdx.y] = kqsum[j];
  248. }
  249. }
  250. __syncthreads();
  251. #pragma unroll
  252. for (int j_VKQ = 0; j_VKQ < ncols; ++j_VKQ) {
  253. if (ncols > 2 && ic0 + j_VKQ >= ne01) {
  254. break;
  255. }
  256. kqsum[j_VKQ] = kqsum_shared[j_VKQ][threadIdx.x];
  257. kqsum[j_VKQ] = warp_reduce_sum(kqsum[j_VKQ]);
  258. half dst_val = (__low2half(VKQ[j_VKQ]) + __high2half(VKQ[j_VKQ]));
  259. if (parallel_blocks == 1) {
  260. dst_val /= kqsum[j_VKQ];
  261. }
  262. const int j_dst = (ic0 + j_VKQ)*parallel_blocks + ip;
  263. dst[j_dst*D*gridDim.y + D*blockIdx.y + tid] = dst_val;
  264. }
  265. if (parallel_blocks != 1 && tid < ncols && (ncols <= 2 || ic0 + tid < ne01)) {
  266. dst_meta[(ic0 + tid)*gridDim.y*parallel_blocks + blockIdx.y*parallel_blocks + ip] = make_float2(kqmax[tid], kqsum[tid]);
  267. }
  268. #else
  269. NO_DEVICE_CODE;
  270. #endif // FP16_AVAILABLE
  271. }
  272. template <int D, int cols_per_block, int parallel_blocks, ggml_type type_K, ggml_type type_V, bool use_logit_softcap>
  273. void ggml_cuda_flash_attn_ext_vec_f16_case_impl(ggml_backend_cuda_context & ctx, ggml_tensor * dst) {
  274. constexpr int nwarps = D/WARP_SIZE;
  275. fattn_kernel_t fattn_kernel = flash_attn_vec_ext_f16<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>;
  276. constexpr bool need_f16_K = D != 128;
  277. constexpr bool need_f16_V = D != 128 && D != 64;
  278. launch_fattn<D, parallel_blocks>(ctx, dst, fattn_kernel, nwarps, cols_per_block, need_f16_K, need_f16_V);
  279. }
  280. template <int D, ggml_type type_K, ggml_type type_V>
  281. void ggml_cuda_flash_attn_ext_vec_f16_case(ggml_backend_cuda_context & ctx, ggml_tensor * dst) {
  282. const ggml_tensor * KQV = dst;
  283. const ggml_tensor * Q = dst->src[0];
  284. const ggml_tensor * K = dst->src[1];
  285. const ggml_tensor * V = dst->src[2];
  286. const int32_t precision = KQV->op_params[3];
  287. GGML_ASSERT(precision == GGML_PREC_DEFAULT);
  288. GGML_ASSERT(K->type == type_K);
  289. GGML_ASSERT(V->type == type_V);
  290. float logit_softcap;
  291. memcpy(&logit_softcap, (const float *) KQV->op_params + 2, sizeof(float));
  292. if (Q->ne[1] == 1) {
  293. constexpr int cols_per_block = 1;
  294. constexpr int parallel_blocks = 4;
  295. if (logit_softcap == 0.0f) {
  296. constexpr bool use_logit_softcap = false;
  297. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  298. } else {
  299. constexpr bool use_logit_softcap = true;
  300. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  301. }
  302. return;
  303. }
  304. if (Q->ne[1] == 2) {
  305. constexpr int cols_per_block = 2;
  306. constexpr int parallel_blocks = 4;
  307. if (logit_softcap == 0.0f) {
  308. constexpr bool use_logit_softcap = false;
  309. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  310. } else {
  311. constexpr bool use_logit_softcap = true;
  312. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  313. }
  314. return;
  315. }
  316. if (Q->ne[1] <= 4) {
  317. constexpr int cols_per_block = 4;
  318. constexpr int parallel_blocks = 4;
  319. if (logit_softcap == 0.0f) {
  320. constexpr bool use_logit_softcap = false;
  321. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  322. } else {
  323. constexpr bool use_logit_softcap = true;
  324. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  325. }
  326. return;
  327. }
  328. if (Q->ne[1] <= 8) {
  329. constexpr int cols_per_block = 8;
  330. constexpr int parallel_blocks = 4;
  331. if (logit_softcap == 0.0f) {
  332. constexpr bool use_logit_softcap = false;
  333. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  334. } else {
  335. constexpr bool use_logit_softcap = true;
  336. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  337. }
  338. return;
  339. }
  340. constexpr int cols_per_block = 8;
  341. constexpr int parallel_blocks = 1;
  342. if (logit_softcap == 0.0f) {
  343. constexpr bool use_logit_softcap = false;
  344. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  345. } else {
  346. constexpr bool use_logit_softcap = true;
  347. ggml_cuda_flash_attn_ext_vec_f16_case_impl<D, cols_per_block, parallel_blocks, type_K, type_V, use_logit_softcap>(ctx, dst);
  348. }
  349. }
  350. #define DECL_FATTN_VEC_F16_CASE(D, type_K, type_V) \
  351. template void ggml_cuda_flash_attn_ext_vec_f16_case \
  352. <D, type_K, type_V>(ggml_backend_cuda_context & ctx, ggml_tensor * dst) \
  353. extern DECL_FATTN_VEC_F16_CASE( 64, GGML_TYPE_F16, GGML_TYPE_Q4_0);
  354. extern DECL_FATTN_VEC_F16_CASE( 64, GGML_TYPE_F16, GGML_TYPE_Q4_1);
  355. extern DECL_FATTN_VEC_F16_CASE( 64, GGML_TYPE_F16, GGML_TYPE_Q5_0);
  356. extern DECL_FATTN_VEC_F16_CASE( 64, GGML_TYPE_F16, GGML_TYPE_Q5_1);
  357. extern DECL_FATTN_VEC_F16_CASE( 64, GGML_TYPE_F16, GGML_TYPE_Q8_0);
  358. extern DECL_FATTN_VEC_F16_CASE( 64, GGML_TYPE_F16, GGML_TYPE_F16);
  359. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_0, GGML_TYPE_Q4_0);
  360. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_1, GGML_TYPE_Q4_0);
  361. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_0, GGML_TYPE_Q4_0);
  362. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_1, GGML_TYPE_Q4_0);
  363. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q8_0, GGML_TYPE_Q4_0);
  364. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_F16, GGML_TYPE_Q4_0);
  365. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_0, GGML_TYPE_Q4_1);
  366. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_1, GGML_TYPE_Q4_1);
  367. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_0, GGML_TYPE_Q4_1);
  368. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_1, GGML_TYPE_Q4_1);
  369. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q8_0, GGML_TYPE_Q4_1);
  370. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_F16, GGML_TYPE_Q4_1);
  371. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_0, GGML_TYPE_Q5_0);
  372. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_1, GGML_TYPE_Q5_0);
  373. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_0, GGML_TYPE_Q5_0);
  374. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_1, GGML_TYPE_Q5_0);
  375. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q8_0, GGML_TYPE_Q5_0);
  376. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_F16, GGML_TYPE_Q5_0);
  377. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_0, GGML_TYPE_Q5_1);
  378. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_1, GGML_TYPE_Q5_1);
  379. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_0, GGML_TYPE_Q5_1);
  380. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_1, GGML_TYPE_Q5_1);
  381. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q8_0, GGML_TYPE_Q5_1);
  382. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_F16, GGML_TYPE_Q5_1);
  383. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_0, GGML_TYPE_Q8_0);
  384. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_1, GGML_TYPE_Q8_0);
  385. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_0, GGML_TYPE_Q8_0);
  386. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_1, GGML_TYPE_Q8_0);
  387. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q8_0, GGML_TYPE_Q8_0);
  388. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_F16, GGML_TYPE_Q8_0);
  389. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_0, GGML_TYPE_F16);
  390. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q4_1, GGML_TYPE_F16);
  391. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_0, GGML_TYPE_F16);
  392. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q5_1, GGML_TYPE_F16);
  393. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_Q8_0, GGML_TYPE_F16);
  394. extern DECL_FATTN_VEC_F16_CASE(128, GGML_TYPE_F16, GGML_TYPE_F16);
  395. extern DECL_FATTN_VEC_F16_CASE(256, GGML_TYPE_F16, GGML_TYPE_F16);