Skip to content

Commit 1bbb543

Browse files
ikawrakowIwan Kawrakow
andauthored
Fix iqk_mul_mat on AVX512 systems that are missing BF16 support (#204)
* Fix iqk_mul_mat on AVX512 systems that are missing BF16 support * One more --------- Co-authored-by: Iwan Kawrakow <[email protected]>
1 parent e974fc9 commit 1bbb543

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ggml/src/iqk/iqk_mul_mat.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8082,6 +8082,9 @@ struct QFBase {
80828082
using Acc = __m512;
80838083
static inline Data load(const ggml_half * x) { return _mm512_cvtph_ps(_mm256_loadu_si256((const __m256i *)x)); }
80848084
static inline Data load(const float * x) { return _mm512_loadu_ps(x); }
8085+
static inline Data load(const ggml_bf16_t * x) {
8086+
return _mm512_castsi512_ps(_mm512_slli_epi32(_mm512_cvtepu16_epi32(_mm256_loadu_si256((const __m256i*)x)), 16));
8087+
}
80858088
static inline Acc acc(Acc prev, const Data& y, const Data& x) {
80868089
return _mm512_fmadd_ps(y, x, prev);
80878090
}
@@ -16079,7 +16082,7 @@ inline void iqk_flash_helper_T(KHelper& kh, ggml_type type_v,
1607916082
HelperF16<Dv, k_step> vh(v, stride_v);
1608016083
iqk_flash_helper<Dk, Dv, k_step>(kh, vh, nq1, nk1, stride_q, stride_m, stride_qkv, q, mask, scale, softcap, qkv);
1608116084
} break;
16082-
#ifdef HAVE_FANCY_SIMD
16085+
#ifdef __AVX512BF16__
1608316086
case GGML_TYPE_BF16: {
1608416087
HelperBF16<Dv, k_step> vh(v, stride_v);
1608516088
iqk_flash_helper<Dk, Dv, k_step>(kh, vh, nq1, nk1, stride_q, stride_m, stride_qkv, q, mask, scale, softcap, qkv);

0 commit comments

Comments
 (0)