Skip to content

Commit ca7199f

Browse files
authored
Treat newer Neoverse as N1 if SVE unavailable (may be disabled in container/cloud env)
1 parent 9e81a3a commit ca7199f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

driver/others/dynamic_arm64.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ extern void openblas_warning(int verbose, const char * msg);
147147
#ifndef HWCAP_CPUID
148148
#define HWCAP_CPUID (1 << 11)
149149
#endif
150+
#ifndef HWCAP_SVE
151+
#define HWCAP_SVE (1 << 22)
152+
#endif
150153

151154
#define get_cpu_ftr(id, var) ({ \
152155
__asm__ __volatile__ ("mrs %0, "#id : "=r" (var)); \
@@ -281,9 +284,15 @@ static gotoblas_t *get_coretype(void) {
281284
return &gotoblas_NEOVERSEN1;
282285
#ifndef NO_SVE
283286
case 0xd49:
284-
return &gotoblas_NEOVERSEN2;
287+
if (!(getauxval(AT_HWCAP) & HWCAP_SVE))
288+
return &gotoblas_NEOVERSEN1;
289+
else
290+
return &gotoblas_NEOVERSEN2;
285291
case 0xd40:
286-
return &gotoblas_NEOVERSEV1;
292+
if (!(getauxval(AT_HWCAP) & HWCAP_SVE))
293+
return &gotoblas_NEOVERSEN1;
294+
else
295+
return &gotoblas_NEOVERSEV1;
287296
#endif
288297
case 0xd05: // Cortex A55
289298
return &gotoblas_CORTEXA55;

0 commit comments

Comments
 (0)