11/*********************************************************************/
22/* Copyright 2009, 2010 The University of Texas at Austin. */
3+ /* Copyright 2023 The OpenBLAS Project */
34/* All rights reserved. */
45/* */
56/* Redistribution and use in source and binary forms, with or */
@@ -109,6 +110,11 @@ extern gotoblas_t gotoblas_NEOVERSEN2;
109110#else
110111#define gotoblas_NEOVERSEN2 gotoblas_ARMV8
111112#endif
113+ #ifdef DYN_ARMV8SVE
114+ extern gotoblas_t gotoblas_ARMV8SVE ;
115+ #else
116+ #define gotoblas_ARMV8SVE gotoblas_ARMV8
117+ #endif
112118#ifdef DYN_CORTEX_A55
113119extern gotoblas_t gotoblas_CORTEXA55 ;
114120#else
@@ -128,9 +134,11 @@ extern gotoblas_t gotoblas_NEOVERSEN1;
128134#ifndef NO_SVE
129135extern gotoblas_t gotoblas_NEOVERSEV1 ;
130136extern gotoblas_t gotoblas_NEOVERSEN2 ;
137+ extern gotoblas_t gotoblas_ARMV8SVE ;
131138#else
132139#define gotoblas_NEOVERSEV1 gotoblas_ARMV8
133140#define gotoblas_NEOVERSEN2 gotoblas_ARMV8
141+ #define gotoblas_ARMV8SVE gotoblas_ARMV8
134142#endif
135143extern gotoblas_t gotoblas_THUNDERX3T110 ;
136144extern gotoblas_t gotoblas_CORTEXA55 ;
@@ -140,7 +148,7 @@ extern void openblas_warning(int verbose, const char * msg);
140148#define FALLBACK_VERBOSE 1
141149#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"
142150
143- #define NUM_CORETYPES 13
151+ #define NUM_CORETYPES 16
144152
145153/*
146154 * In case asm/hwcap.h is outdated on the build system, make sure
@@ -173,6 +181,7 @@ static char *corename[] = {
173181 "neoversen2" ,
174182 "thunderx3t110" ,
175183 "cortexa55" ,
184+ "armv8sve" ,
176185 "unknown"
177186};
178187
@@ -192,6 +201,7 @@ char *gotoblas_corename(void) {
192201 if (gotoblas == & gotoblas_NEOVERSEN2 ) return corename [12 ];
193202 if (gotoblas == & gotoblas_THUNDERX3T110 ) return corename [13 ];
194203 if (gotoblas == & gotoblas_CORTEXA55 ) return corename [14 ];
204+ if (gotoblas == & gotoblas_ARMV8SVE ) return corename [15 ];
195205 return corename [NUM_CORETYPES ];
196206}
197207
@@ -226,6 +236,7 @@ static gotoblas_t *force_coretype(char *coretype) {
226236 case 12 : return (& gotoblas_NEOVERSEN2 );
227237 case 13 : return (& gotoblas_THUNDERX3T110 );
228238 case 14 : return (& gotoblas_CORTEXA55 );
239+ case 15 : return (& gotoblas_ARMV8SVE );
229240 }
230241 snprintf (message , 128 , "Core not found: %s\n" , coretype );
231242 openblas_warning (1 , message );
@@ -345,6 +356,12 @@ static gotoblas_t *get_coretype(void) {
345356 snprintf (coremsg , 128 , "Unknown CPU model - implementer %x part %x\n" ,implementer ,part );
346357 openblas_warning (1 , coremsg );
347358 }
359+ #ifndef NO_SVE
360+ if ((getauxval (AT_HWCAP ) & HWCAP_SVE )) {
361+ return & gotoblas_ARMV8SVE ;
362+ }
363+ #endif
364+
348365 return NULL ;
349366#endif
350367}
0 commit comments