41
41
#include <asm/hwcap.h>
42
42
#include <sys/auxv.h>
43
43
#endif
44
+ #ifdef OS_DARWIN
45
+ #include <sys/sysctl.h>
46
+ int32_t value ;
47
+ size_t length = sizeof (value );
48
+ #endif
44
49
45
50
extern gotoblas_t gotoblas_ARMV8 ;
51
+ #ifdef DYNAMIC_LIST
52
+ #ifdef DYN_CORTEXA53
53
+ extern gotoblas_t gotoblas_CORTEXA53 ;
54
+ #else
55
+ #define gotoblas_CORTEXA53 gotoblas_ARMV8
56
+ #endif
57
+ #ifdef DYN_CORTEXA57
58
+ extern gotoblas_t gotoblas_CORTEXA57 ;
59
+ #else
60
+ #define gotoblas_CORTEXA57 gotoblas_ARMV8
61
+ #endif
62
+ #ifdef DYN_CORTEXA72
63
+ extern gotoblas_t gotoblas_CORTEXA72 ;
64
+ #else
65
+ #define gotoblas_CORTEXA72 gotoblas_ARMV8
66
+ #endif
67
+ #ifdef DYN_CORTEXA73
68
+ extern gotoblas_t gotoblas_CORTEXA73 ;
69
+ #else
70
+ #define gotoblas_CORTEXA73 gotoblas_ARMV8
71
+ #endif
72
+ #ifdef DYN_FALKOR
73
+ extern gotoblas_t gotoblas_FALKOR ;
74
+ #else
75
+ #define gotoblas_FALKOR gotoblas_ARMV8
76
+ #endif
77
+ #ifdef DYN_TSV110
78
+ extern gotoblas_t gotoblas_TSV110 ;
79
+ #else
80
+ #define gotoblas_TSV110 gotoblas_ARMV8
81
+ #endif
82
+ #ifdef DYN_THUNDERX
83
+ extern gotoblas_t gotoblas_THUNDERX ;
84
+ #else
85
+ #define gotoblas_THUNDERX gotoblas_ARMV8
86
+ #endif
87
+ #ifdef DYN_THUNDERX2T99
88
+ extern gotoblas_t gotoblas_THUNDERX2T99 ;
89
+ #else
90
+ #define gotoblas_THUNDERX2T99 gotoblas_ARMV8
91
+ #endif
92
+ #ifdef DYN_THUNDERX3T110
93
+ extern gotoblas_t gotoblas_THUNDERX3T110 ;
94
+ #else
95
+ #define gotoblas_THUNDERX3T110 gotoblas_ARMV8
96
+ #endif
97
+ #ifdef DYN_EMAG8180
98
+ extern gotoblas_t gotoblas_EMAG8180 ;
99
+ #else
100
+ #define gotoblas_EMAG8180 gotoblas_ARMV8
101
+ #endif
102
+ #ifdef DYN_NEOVERSEN1
103
+ extern gotoblas_t gotoblas_NEOVERSEN1 ;
104
+ #else
105
+ #define gotoblas_NEOVERSEN1 gotoblas_ARMV8
106
+ #endif
107
+ #ifdef DYN_VORTEX
108
+ extern gotoblas_t gotoblas_VORTEX ;
109
+ #else
110
+ #define gotoblas_VORTEX gotoblas_ARMV8
111
+ #endif
112
+ #else
46
113
extern gotoblas_t gotoblas_CORTEXA53 ;
47
114
extern gotoblas_t gotoblas_CORTEXA57 ;
48
115
extern gotoblas_t gotoblas_CORTEXA72 ;
@@ -54,10 +121,12 @@ extern gotoblas_t gotoblas_TSV110;
54
121
extern gotoblas_t gotoblas_EMAG8180 ;
55
122
extern gotoblas_t gotoblas_NEOVERSEN1 ;
56
123
extern gotoblas_t gotoblas_THUNDERX3T110 ;
124
+ extern gotoblas_t gotoblas_VORTEX ;
125
+ #endif
57
126
58
127
extern void openblas_warning (int verbose , const char * msg );
59
128
60
- #define NUM_CORETYPES 12
129
+ #define NUM_CORETYPES 13
61
130
62
131
/*
63
132
* In case asm/hwcap.h is outdated on the build system, make sure
@@ -68,7 +137,7 @@ extern void openblas_warning(int verbose, const char * msg);
68
137
#endif
69
138
70
139
#define get_cpu_ftr (id , var ) ({ \
71
- __asm__ __volatile__ ("mrs %0, "#id : "=r" (var)); \
140
+ __asm__ ("mrs %0, "#id : "=r" (var)); \
72
141
})
73
142
74
143
static char * corename [] = {
@@ -84,6 +153,7 @@ static char *corename[] = {
84
153
"emag8180" ,
85
154
"neoversen1" ,
86
155
"thunderx3t110" ,
156
+ "vortex" ,
87
157
"unknown"
88
158
};
89
159
@@ -100,6 +170,7 @@ char *gotoblas_corename(void) {
100
170
if (gotoblas == & gotoblas_EMAG8180 ) return corename [ 9 ];
101
171
if (gotoblas == & gotoblas_NEOVERSEN1 ) return corename [10 ];
102
172
if (gotoblas == & gotoblas_THUNDERX3T110 ) return corename [11 ];
173
+ if (gotoblas == & gotoblas_VORTEX ) return corename [12 ];
103
174
return corename [NUM_CORETYPES ];
104
175
}
105
176
@@ -131,6 +202,7 @@ static gotoblas_t *force_coretype(char *coretype) {
131
202
case 9 : return (& gotoblas_EMAG8180 );
132
203
case 10 : return (& gotoblas_NEOVERSEN1 );
133
204
case 11 : return (& gotoblas_THUNDERX3T110 );
205
+ case 12 : return (& gotoblas_VORTEX );
134
206
}
135
207
snprintf (message , 128 , "Core not found: %s\n" , coretype );
136
208
openblas_warning (1 , message );
@@ -142,6 +214,10 @@ static gotoblas_t *get_coretype(void) {
142
214
char coremsg [128 ];
143
215
144
216
#if (!defined OS_LINUX && !defined OS_ANDROID )
217
+ #ifdef DARWIN
218
+ sysctlbyname ("hw.cpufamily" ,& value ,& length ,NULL ,0 );
219
+ if (value == 131287967 ) return CPU_VORTEX ;
220
+ #endif
145
221
return NULL ;
146
222
#else
147
223
0 commit comments