@@ -139,19 +139,30 @@ static gotoblas_t *force_coretype(char *coretype) {
139
139
140
140
static gotoblas_t * get_coretype (void ) {
141
141
int implementer , variant , part , arch , revision , midr_el1 ;
142
+ char coremsg [128 ];
143
+
144
+ #if (!defined OS_LINUX && !defined OS_ANDROID )
145
+ return NULL ;
146
+ #endif
142
147
143
- #if (defined OS_LINUX || defined OS_ANDROID )
144
148
if (!(getauxval (AT_HWCAP ) & HWCAP_CPUID )) {
145
- char coremsg [128 ];
149
+ #ifdef __linux
150
+ FILE * infile ;
151
+ char buffer [512 ], * p , * cpu_part = NULL , * cpu_implementer = NULL ;
152
+ p = (char * ) NULL ;
153
+ infile = fopen ("/sys/devices/system/cpu/cpu0/regs/identification/midr_el1" ,"r" );
154
+ if (!infile ) return NULL ;
155
+ fgets (buffer , sizeof (buffer ), infile );
156
+ midr_el1 = strtoul (buffer ,NULL ,16 );
157
+ fclose (infile );
158
+ #else
146
159
snprintf (coremsg , 128 , "Kernel lacks cpuid feature support. Auto detection of core type failed !!!\n" );
147
160
openblas_warning (1 , coremsg );
148
161
return NULL ;
149
- }
150
- #else
151
- return NULL ;
152
162
#endif
153
-
154
- get_cpu_ftr (MIDR_EL1 , midr_el1 );
163
+ } else {
164
+ get_cpu_ftr (MIDR_EL1 , midr_el1 );
165
+ }
155
166
/*
156
167
* MIDR_EL1
157
168
*
@@ -219,6 +230,9 @@ static gotoblas_t *get_coretype(void) {
219
230
return & gotoblas_FALKOR ;
220
231
}
221
232
break ;
233
+ default :
234
+ snprintf (coremsg , 128 , "Unknown CPU model - implementer %x part %x\n" ,implementer ,part );
235
+ openblas_warning (1 , coremsg );
222
236
}
223
237
return NULL ;
224
238
}
0 commit comments