iqk_mul_mat: add ability to disable it

This commit is contained in:
Kawrakow
2024-06-10 18:30:33 +03:00
parent 154f56a8de
commit d41aef5418
5 changed files with 34 additions and 23 deletions

View File

@@ -51,7 +51,9 @@
#include "sgemm.h"
#include "ggml-impl.h"
#include "ggml-quants.h"
#if GGML_USE_IQK_MULMAT
#include "iqk_mul_mat.h"
#endif
#ifdef _MSC_VER
#define NOINLINE __declspec(noinline)
@@ -866,8 +868,8 @@ bool llamafile_sgemm(int64_t m, int64_t n, int64_t k, const void *A, int64_t lda
if (Ctype != GGML_TYPE_F32)
return false;
#if GGML_USE_IQK_MULMAT
#if defined __AVX2__ && defined __FMA__
//bool is_accepted_float_type = k >= 32 && Atype == GGML_TYPE_F16 && Btype == GGML_TYPE_F32;
bool is_accepted_float_type = k >= 32 &&
((Atype == GGML_TYPE_F16 && Btype == GGML_TYPE_F32) || (Atype == GGML_TYPE_F32 && Btype == GGML_TYPE_F16));
#elif defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC && defined __ARM_FEATURE_FMA
@@ -884,22 +886,7 @@ bool llamafile_sgemm(int64_t m, int64_t n, int64_t k, const void *A, int64_t lda
return true;
}
}
// if (task == GGML_TASK_TYPE_COMPUTE && k >= 32 && Atype == GGML_TYPE_F16) {
//#if defined __AVX2__ && defined __FMA__
// if (Btype == GGML_TYPE_F32) {
// if (iqk_mul_mat(m, n, k, Atype, A, B, (float *)C, ldc, ith, nth)) {
// return true;
// }
// }
//#elif defined __ARM_FEATURE_FP16_VECTOR_ARITHMETIC && defined __ARM_FEATURE_FMA
// if (Btype == GGML_TYPE_F16) {
// if (iqk_mul_mat(m, n, k, Atype, A, B, (float *)C, ldc, ith, nth)) {
// return true;
// }
// }
//#endif
// }
#endif
switch (Atype) {