Skip to content

Commit f5de4fa

Browse files
authored
Merge pull request #4444 from Mousius/part-mapping
Add dynamic support for Arm(R) Neoverse(TM) V2 processor
2 parents 500442c + aaf6521 commit f5de4fa

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

driver/others/dynamic_arm64.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*********************************************************************/
22
/* Copyright 2009, 2010 The University of Texas at Austin. */
3-
/* Copyright 2023 The OpenBLAS Project */
3+
/* Copyright 2023-2024 The OpenBLAS Project */
44
/* All rights reserved. */
55
/* */
66
/* Redistribution and use in source and binary forms, with or */
@@ -143,12 +143,13 @@ extern gotoblas_t gotoblas_ARMV8SVE;
143143
#endif
144144
extern gotoblas_t gotoblas_THUNDERX3T110;
145145
#endif
146+
#define gotoblas_NEOVERSEV2 gotoblas_NEOVERSEV1
146147

147148
extern void openblas_warning(int verbose, const char * msg);
148149
#define FALLBACK_VERBOSE 1
149150
#define NEOVERSEN1_FALLBACK "OpenBLAS : Your OS does not support SVE instructions. OpenBLAS is using Neoverse N1 kernels as a fallback, which may give poorer performance.\n"
150151

151-
#define NUM_CORETYPES 16
152+
#define NUM_CORETYPES 17
152153

153154
/*
154155
* In case asm/hwcap.h is outdated on the build system, make sure
@@ -178,6 +179,7 @@ static char *corename[] = {
178179
"emag8180",
179180
"neoversen1",
180181
"neoversev1",
182+
"neoversev2",
181183
"neoversen2",
182184
"thunderx3t110",
183185
"cortexa55",
@@ -198,10 +200,11 @@ char *gotoblas_corename(void) {
198200
if (gotoblas == &gotoblas_EMAG8180) return corename[ 9];
199201
if (gotoblas == &gotoblas_NEOVERSEN1) return corename[10];
200202
if (gotoblas == &gotoblas_NEOVERSEV1) return corename[11];
201-
if (gotoblas == &gotoblas_NEOVERSEN2) return corename[12];
202-
if (gotoblas == &gotoblas_THUNDERX3T110) return corename[13];
203-
if (gotoblas == &gotoblas_CORTEXA55) return corename[14];
204-
if (gotoblas == &gotoblas_ARMV8SVE) return corename[15];
203+
if (gotoblas == &gotoblas_NEOVERSEV2) return corename[12];
204+
if (gotoblas == &gotoblas_NEOVERSEN2) return corename[13];
205+
if (gotoblas == &gotoblas_THUNDERX3T110) return corename[14];
206+
if (gotoblas == &gotoblas_CORTEXA55) return corename[15];
207+
if (gotoblas == &gotoblas_ARMV8SVE) return corename[16];
205208
return corename[NUM_CORETYPES];
206209
}
207210

@@ -233,10 +236,11 @@ static gotoblas_t *force_coretype(char *coretype) {
233236
case 9: return (&gotoblas_EMAG8180);
234237
case 10: return (&gotoblas_NEOVERSEN1);
235238
case 11: return (&gotoblas_NEOVERSEV1);
236-
case 12: return (&gotoblas_NEOVERSEN2);
237-
case 13: return (&gotoblas_THUNDERX3T110);
238-
case 14: return (&gotoblas_CORTEXA55);
239-
case 15: return (&gotoblas_ARMV8SVE);
239+
case 12: return (&gotoblas_NEOVERSEV2);
240+
case 13: return (&gotoblas_NEOVERSEN2);
241+
case 14: return (&gotoblas_THUNDERX3T110);
242+
case 15: return (&gotoblas_CORTEXA55);
243+
case 16: return (&gotoblas_ARMV8SVE);
240244
}
241245
snprintf(message, 128, "Core not found: %s\n", coretype);
242246
openblas_warning(1, message);
@@ -312,6 +316,13 @@ static gotoblas_t *get_coretype(void) {
312316
return &gotoblas_NEOVERSEN1;
313317
}else
314318
return &gotoblas_NEOVERSEV1;
319+
case 0xd4f:
320+
if (!(getauxval(AT_HWCAP) & HWCAP_SVE)) {
321+
openblas_warning(FALLBACK_VERBOSE, NEOVERSEN1_FALLBACK);
322+
return &gotoblas_NEOVERSEN1;
323+
} else {
324+
return &gotoblas_NEOVERSEV2;
325+
}
315326
#endif
316327
case 0xd05: // Cortex A55
317328
return &gotoblas_CORTEXA55;

0 commit comments

Comments
 (0)