Skip to content

Commit 3b3d609

Browse files
committed
check avx512bf15
Signed-off-by: jiqing-feng <[email protected]>
1 parent 6858a90 commit 3b3d609

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

csrc/cpu_ops.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ static inline bool has_avx512f() {
298298
return v;
299299
}
300300

301+
#if defined(__AVX512BF16__)
301302
static inline bool has_avx512bf16() {
302303
static bool v = [] {
303304
int info[4];
@@ -306,18 +307,21 @@ static inline bool has_avx512bf16() {
306307
}();
307308
return v;
308309
}
310+
#endif
309311
#else
310312
static inline bool has_avx512f() {
311313
static const bool supported_avx512f = __builtin_cpu_supports("avx512f");
312314
return supported_avx512f;
313315
}
314316

317+
#if defined(__AVX512BF16__)
315318
static inline bool has_avx512bf16() {
316319
static const bool supported_avx512bf16 = __builtin_cpu_supports("avx512bf16");
317320
return supported_avx512bf16;
318321
}
319322
#endif
320323
#endif
324+
#endif
321325

322326
#if defined(__AVX512F__) && defined(__AVX512BF16__)
323327
template <typename T, int DATA_TYPE>

csrc/pythonInterface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ void gemv_4bit_inference_cpu_nf4_bf16(
909909
#endif
910910
#if defined(__AVX512F__)
911911
bool has_avx512f_cpu() { return has_avx512f(); }
912-
912+
#if defined(__AVX512BF16__)
913913
bool has_avx512bf16_cpu() { return has_avx512bf16(); }
914914
#endif
915+
#endif
915916
}

0 commit comments

Comments
 (0)