Skip to content

Commit 65c626e

Browse files
authored
Merge pull request #5456 from ChipKerchner/riscv-bf16-fix
Disable bf16 flags on RISC-V unless BUILD_BFLOAT16=1
2 parents f2304af + fc7d6e6 commit 65c626e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Makefile.riscv64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ifeq ($(BUILD_HFLOAT16), 1)
1111
RISCV64_OPT := $(RISCV64_OPT)_zvfh_zfh
1212
endif
1313
ifeq ($(BUILD_BFLOAT16), 1)
14-
RISCV64_OPT := $(RISCV64_OPT)_zfbfmin_zvfbfmin_zvfbfwma
14+
RISCV64_OPT := $(RISCV64_OPT)_zvfbfwma
1515
endif
1616
ifeq ($(CORE), RISCV64_ZVL256B)
1717
CCOMMON_OPT += -march=$(RISCV64_OPT)_zvl256b -mabi=lp64d

driver/others/dynamic_riscv64.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ 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_ZVFBFWMA (1 << 54)
102103

103104
#ifndef NR_riscv_hwprobe
104105
#ifndef NR_arch_specific_syscall
@@ -170,6 +171,8 @@ static gotoblas_t* get_coretype(void) {
170171
if (ret == 0) {
171172
#if defined(BUILD_HFLOAT16)
172173
vector_mask = (RISCV_HWPROBE_IMA_V | RISCV_HWPROBE_EXT_ZFH | RISCV_HWPROBE_EXT_ZVFH);
174+
#elif defined(BUILD_BFLOAT16)
175+
vector_mask = (RISCV_HWPROBE_IMA_V | RISCV_HWPROBE_EXT_ZVFBFWMA);
173176
#else
174177
vector_mask = RISCV_HWPROBE_IMA_V;
175178
#endif
@@ -180,6 +183,10 @@ static gotoblas_t* get_coretype(void) {
180183
snprintf(coremsg, sizeof(coremsg), "Cpu support for Zfh+Zvfh extensions required due to BUILD_HFLOAT16=1\n");
181184
openblas_warning(1, coremsg);
182185
return NULL;
186+
#elif defined(BUILD_BFLOAT16)
187+
snprintf(coremsg, sizeof(coremsg), "Cpu support for Zvfbfwma extensions required due to BUILD_BFLOAT16=1\n");
188+
openblas_warning(1, coremsg);
189+
return NULL;
183190
#else
184191
if (!(getauxval(AT_HWCAP) & DETECT_RISCV64_HWCAP_ISA_V))
185192
return NULL;

0 commit comments

Comments
 (0)