Skip to content

Commit 3116749

Browse files
committed
Disable bf16 flags on RISC-V unless BUILD_BFLOAT16=1
1 parent fe5402d commit 3116749

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

driver/others/dynamic_riscv64.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ struct riscv_hwprobe {
9999
#define RISCV_HWPROBE_IMA_V (1 << 2)
100100
#define RISCV_HWPROBE_EXT_ZFH (1 << 27)
101101
#define RISCV_HWPROBE_EXT_ZVFH (1 << 30)
102+
#define RISCV_HWPROBE_EXT_ZFBFMIN (1 << 52)
103+
#define RISCV_HWPROBE_EXT_ZVFBFMIN (1 << 53)
104+
#define RISCV_HWPROBE_EXT_ZVFBFWMA (1 << 54)
102105

103106
#ifndef NR_riscv_hwprobe
104107
#ifndef NR_arch_specific_syscall
@@ -170,6 +173,8 @@ static gotoblas_t* get_coretype(void) {
170173
if (ret == 0) {
171174
#if defined(BUILD_HFLOAT16)
172175
vector_mask = (RISCV_HWPROBE_IMA_V | RISCV_HWPROBE_EXT_ZFH | RISCV_HWPROBE_EXT_ZVFH);
176+
#elif defined(BUILD_BFLOAT16)
177+
vector_mask = (RISCV_HWPROBE_IMA_V | RISCV_HWPROBE_EXT_ZFBFMIN | RISCV_HWPROBE_EXT_ZVFBFMIN | RISCV_HWPROBE_EXT_ZVFBFWMA);
173178
#else
174179
vector_mask = RISCV_HWPROBE_IMA_V;
175180
#endif
@@ -180,6 +185,10 @@ static gotoblas_t* get_coretype(void) {
180185
snprintf(coremsg, sizeof(coremsg), "Cpu support for Zfh+Zvfh extensions required due to BUILD_HFLOAT16=1\n");
181186
openblas_warning(1, coremsg);
182187
return NULL;
188+
#elif defined(BUILD_BFLOAT16)
189+
snprintf(coremsg, sizeof(coremsg), "Cpu support for Zfbfmin+Zvfbfmin+Zvfbfwma extensions required due to BUILD_BFLOAT16=1\n");
190+
openblas_warning(1, coremsg);
191+
return NULL;
183192
#else
184193
if (!(getauxval(AT_HWCAP) & DETECT_RISCV64_HWCAP_ISA_V))
185194
return NULL;

0 commit comments

Comments
 (0)