|
|
|
@@ -97,6 +97,8 @@ struct riscv_hwprobe { |
|
|
|
|
|
|
|
#define RISCV_HWPROBE_KEY_IMA_EXT_0 4 |
|
|
|
#define RISCV_HWPROBE_IMA_V (1 << 2) |
|
|
|
#define RISCV_HWPROBE_EXT_ZFH (1 << 27) |
|
|
|
#define RISCV_HWPROBE_EXT_ZVFH (1 << 30) |
|
|
|
|
|
|
|
#ifndef NR_riscv_hwprobe |
|
|
|
#ifndef NR_arch_specific_syscall |
|
|
|
@@ -147,6 +149,7 @@ char* gotoblas_corename(void) { |
|
|
|
} |
|
|
|
|
|
|
|
static gotoblas_t* get_coretype(void) { |
|
|
|
uint64_t vector_mask; |
|
|
|
unsigned vlenb = 0; |
|
|
|
|
|
|
|
#if !defined(OS_LINUX) |
|
|
|
@@ -165,14 +168,23 @@ static gotoblas_t* get_coretype(void) { |
|
|
|
}; |
|
|
|
int ret = syscall(NR_riscv_hwprobe, pairs, 1, 0, NULL, 0); |
|
|
|
if (ret == 0) { |
|
|
|
if (!(pairs[0].value & RISCV_HWPROBE_IMA_V)) |
|
|
|
#if defined(BUILD_HFLOAT16) |
|
|
|
vector_mask = (RISCV_HWPROBE_IMA_V | RISCV_HWPROBE_EXT_ZFH | RISCV_HWPROBE_EXT_ZVFH); |
|
|
|
#else |
|
|
|
vector_mask = RISCV_HWPROBE_IMA_V; |
|
|
|
#endif |
|
|
|
if ((pairs[0].value & vector_mask) != vector_mask) |
|
|
|
return NULL; |
|
|
|
} else { |
|
|
|
#if defined(BUILD_HFLOAT16) |
|
|
|
return NULL; |
|
|
|
#else |
|
|
|
if (!(getauxval(AT_HWCAP) & DETECT_RISCV64_HWCAP_ISA_V)) |
|
|
|
return NULL; |
|
|
|
|
|
|
|
if (!detect_riscv64_rvv100()) |
|
|
|
return NULL; |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
|