Skip to content

Commit cf234a0

Browse files
authored
Merge pull request #1589 from fenrus75/skylakex
Initial support for SkylakeX / AVX512
2 parents ae2a331 + f6021c7 commit cf234a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+12253
-50
lines changed

Makefile.system

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ ifeq ($(BINARY), 32)
6262
ifeq ($(TARGET), HASWELL)
6363
GETARCH_FLAGS := -DFORCE_NEHALEM
6464
endif
65+
ifeq ($(TARGET), SKYLAKEX)
66+
GETARCH_FLAGS := -DFORCE_NEHALEM
67+
endif
6568
ifeq ($(TARGET), SANDYBRIDGE)
6669
GETARCH_FLAGS := -DFORCE_NEHALEM
6770
endif
@@ -95,6 +98,9 @@ ifeq ($(BINARY), 32)
9598
ifeq ($(TARGET_CORE), HASWELL)
9699
GETARCH_FLAGS := -DFORCE_NEHALEM
97100
endif
101+
ifeq ($(TARGET_CORE), SKYLAKEX)
102+
GETARCH_FLAGS := -DFORCE_NEHALEM
103+
endif
98104
ifeq ($(TARGET_CORE), SANDYBRIDGE)
99105
GETARCH_FLAGS := -DFORCE_NEHALEM
100106
endif
@@ -141,6 +147,10 @@ ifeq ($(NO_AVX2), 1)
141147
GETARCH_FLAGS += -DNO_AVX2
142148
endif
143149

150+
ifeq ($(NO_AVX512), 1)
151+
GETARCH_FLAGS += -DNO_AVX512
152+
endif
153+
144154
ifeq ($(DEBUG), 1)
145155
GETARCH_FLAGS += -g
146156
endif
@@ -469,6 +479,11 @@ endif
469479
ifneq ($(NO_AVX2), 1)
470480
DYNAMIC_CORE += HASWELL ZEN
471481
endif
482+
ifneq ($(NO_AVX512), 1)
483+
ifneq ($(NO_AVX2), 1)
484+
DYNAMIC_CORE += SKYLAKEX
485+
endif
486+
endif
472487
endif
473488

474489
# If DYNAMIC_CORE is not set, DYNAMIC_ARCH cannot do anything, so force it to empty
@@ -924,6 +939,10 @@ ifeq ($(NO_AVX2), 1)
924939
CCOMMON_OPT += -DNO_AVX2
925940
endif
926941

942+
ifeq ($(NO_AVX512), 1)
943+
CCOMMON_OPT += -DNO_AVX512
944+
endif
945+
927946
ifdef SMP
928947
CCOMMON_OPT += -DSMP_SERVER
929948

@@ -1230,6 +1249,7 @@ export MSA_FLAGS
12301249
export KERNELDIR
12311250
export FUNCTION_PROFILE
12321251
export TARGET_CORE
1252+
export NO_AVX512
12331253

12341254
export SGEMM_UNROLL_M
12351255
export SGEMM_UNROLL_N

TargetList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DUNNINGTON
2020
NEHALEM
2121
SANDYBRIDGE
2222
HASWELL
23+
SKYLAKEX
2324
ATOM
2425

2526
b)AMD CPU:

cmake/arch.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ if (DYNAMIC_ARCH)
5656
if (NOT NO_AVX2)
5757
set(DYNAMIC_CORE ${DYNAMIC_CORE} HASWELL ZEN)
5858
endif ()
59+
if (NOT NO_AVX512)
60+
set(DYNAMIC_CORE ${DYNAMIC_CORE} SKYLAKEX)
61+
endif ()
5962
endif ()
6063

6164
if (NOT DYNAMIC_CORE)

cmake/system.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ endif ()
3333
if (DEFINED BINARY AND DEFINED TARGET AND BINARY EQUAL 32)
3434
message(STATUS "Compiling a ${BINARY}-bit binary.")
3535
set(NO_AVX 1)
36-
if (${TARGET} STREQUAL "HASWELL" OR ${TARGET} STREQUAL "SANDYBRIDGE")
36+
if (${TARGET} STREQUAL "HASWELL" OR ${TARGET} STREQUAL "SANDYBRIDGE" OR ${TARGET} STREQUAL "SKYLAKEX")
3737
set(TARGET "NEHALEM")
3838
endif ()
3939
if (${TARGET} STREQUAL "BULLDOZER" OR ${TARGET} STREQUAL "PILEDRIVER" OR ${TARGET} STREQUAL "ZEN")

cpuid.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
#define CORE_STEAMROLLER 25
116116
#define CORE_EXCAVATOR 26
117117
#define CORE_ZEN 27
118+
#define CORE_SKYLAKEX 28
118119

119120
#define HAVE_SSE (1 << 0)
120121
#define HAVE_SSE2 (1 << 1)
@@ -137,6 +138,7 @@
137138
#define HAVE_AVX (1 << 18)
138139
#define HAVE_FMA4 (1 << 19)
139140
#define HAVE_FMA3 (1 << 20)
141+
#define HAVE_AVX512VL (1 << 21)
140142

141143
#define CACHE_INFO_L1_I 1
142144
#define CACHE_INFO_L1_D 2
@@ -211,5 +213,6 @@ typedef struct {
211213
#define CPUTYPE_STEAMROLLER 49
212214
#define CPUTYPE_EXCAVATOR 50
213215
#define CPUTYPE_ZEN 51
216+
#define CPUTYPE_SKYLAKEX 52
214217

215218
#endif

cpuid_x86.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#ifdef NO_AVX
5151
#define CPUTYPE_HASWELL CPUTYPE_NEHALEM
5252
#define CORE_HASWELL CORE_NEHALEM
53+
#define CPUTYPE_SKYLAKEX CPUTYPE_NEHALEM
54+
#define CORE_SKYLAKEX CORE_NEHALEM
5355
#define CPUTYPE_SANDYBRIDGE CPUTYPE_NEHALEM
5456
#define CORE_SANDYBRIDGE CORE_NEHALEM
5557
#define CPUTYPE_BULLDOZER CPUTYPE_BARCELONA
@@ -1299,6 +1301,19 @@ int get_cpuname(void){
12991301
else
13001302
return CPUTYPE_NEHALEM;
13011303
case 5:
1304+
// Skylake X
1305+
#ifndef NO_AVX512
1306+
return CPUTYPE_SKYLAKEX;
1307+
#else
1308+
if(support_avx())
1309+
#ifndef NO_AVX2
1310+
return CPUTYPE_HASWELL;
1311+
#else
1312+
return CPUTYPE_SANDYBRIDGE;
1313+
#endif
1314+
else
1315+
return CPUTYPE_NEHALEM;
1316+
#endif
13021317
case 14:
13031318
// Skylake
13041319
if(support_avx())
@@ -1556,6 +1571,7 @@ static char *cpuname[] = {
15561571
"STEAMROLLER",
15571572
"EXCAVATOR",
15581573
"ZEN",
1574+
"SKYLAKEX"
15591575
};
15601576

15611577
static char *lowercpuname[] = {
@@ -1610,6 +1626,7 @@ static char *lowercpuname[] = {
16101626
"steamroller",
16111627
"excavator",
16121628
"zen",
1629+
"skylakex"
16131630
};
16141631

16151632
static char *corename[] = {
@@ -1641,6 +1658,7 @@ static char *corename[] = {
16411658
"STEAMROLLER",
16421659
"EXCAVATOR",
16431660
"ZEN",
1661+
"SKYLAKEX"
16441662
};
16451663

16461664
static char *corename_lower[] = {
@@ -1672,6 +1690,7 @@ static char *corename_lower[] = {
16721690
"steamroller",
16731691
"excavator",
16741692
"zen",
1693+
"skylakex"
16751694
};
16761695

16771696

@@ -1860,6 +1879,19 @@ int get_coretype(void){
18601879
else
18611880
return CORE_NEHALEM;
18621881
case 5:
1882+
// Skylake X
1883+
#ifndef NO_AVX512
1884+
return CORE_SKYLAKEX;
1885+
#else
1886+
if(support_avx())
1887+
#ifndef NO_AVX2
1888+
return CORE_HASWELL;
1889+
#else
1890+
return CORE_SANDYBRIDGE;
1891+
#endif
1892+
else
1893+
return CORE_NEHALEM;
1894+
#endif
18631895
case 14:
18641896
// Skylake
18651897
if(support_avx())

driver/others/dynamic.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,22 @@ extern gotoblas_t gotoblas_STEAMROLLER;
7474
extern gotoblas_t gotoblas_EXCAVATOR;
7575
#ifdef NO_AVX2
7676
#define gotoblas_HASWELL gotoblas_SANDYBRIDGE
77+
#define gotoblas_SKYLAKEX gotoblas_SANDYBRIDGE
7778
#define gotoblas_ZEN gotoblas_SANDYBRIDGE
7879
#else
7980
extern gotoblas_t gotoblas_HASWELL;
8081
extern gotoblas_t gotoblas_ZEN;
82+
#ifndef NO_AVX512
83+
extern gotoblas_t gotoblas_SKYLAKEX;
84+
#else
85+
#define gotoblas_SKYLAKEX gotoblas_HASWELL
86+
#endif
8187
#endif
8288
#else
8389
//Use NEHALEM kernels for sandy bridge
8490
#define gotoblas_SANDYBRIDGE gotoblas_NEHALEM
8591
#define gotoblas_HASWELL gotoblas_NEHALEM
92+
#define gotoblas_SKYLAKEX gotoblas_NEHALEM
8693
#define gotoblas_BULLDOZER gotoblas_BARCELONA
8794
#define gotoblas_PILEDRIVER gotoblas_BARCELONA
8895
#define gotoblas_STEAMROLLER gotoblas_BARCELONA
@@ -284,8 +291,21 @@ static gotoblas_t *get_coretype(void){
284291
return &gotoblas_NEHALEM; //OS doesn't support AVX. Use old kernels.
285292
}
286293
}
294+
if (model == 5) {
295+
// Intel Skylake X
296+
#ifndef NO_AVX512
297+
return &gotoblas_SKYLAKEX;
298+
#else
299+
if(support_avx())
300+
return &gotoblas_HASWELL;
301+
else {
302+
openblas_warning(FALLBACK_VERBOSE, NEHALEM_FALLBACK);
303+
return &gotoblas_NEHALEM;
304+
}
305+
#endif
306+
}
287307
//Intel Skylake
288-
if (model == 14 || model == 5) {
308+
if (model == 14) {
289309
if(support_avx())
290310
return &gotoblas_HASWELL;
291311
else{
@@ -445,7 +465,8 @@ static char *corename[] = {
445465
"Haswell",
446466
"Steamroller",
447467
"Excavator",
448-
"Zen"
468+
"Zen",
469+
"SkylakeX"
449470
};
450471

451472
char *gotoblas_corename(void) {
@@ -473,7 +494,7 @@ char *gotoblas_corename(void) {
473494
if (gotoblas == &gotoblas_STEAMROLLER) return corename[21];
474495
if (gotoblas == &gotoblas_EXCAVATOR) return corename[22];
475496
if (gotoblas == &gotoblas_ZEN) return corename[23];
476-
497+
if (gotoblas == &gotoblas_SKYLAKEX) return corename[24];
477498
return corename[0];
478499
}
479500

@@ -485,7 +506,7 @@ static gotoblas_t *force_coretype(char *coretype){
485506
char message[128];
486507
//char mname[20];
487508

488-
for ( i=1 ; i <= 23; i++)
509+
for ( i=1 ; i <= 24; i++)
489510
{
490511
if (!strncasecmp(coretype,corename[i],20))
491512
{
@@ -503,6 +524,7 @@ static gotoblas_t *force_coretype(char *coretype){
503524

504525
switch (found)
505526
{
527+
case 24: return (&gotoblas_SKYLAKEX);
506528
case 23: return (&gotoblas_ZEN);
507529
case 22: return (&gotoblas_EXCAVATOR);
508530
case 21: return (&gotoblas_STEAMROLLER);

driver/others/parameter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ int get_L2_size(void){
167167
#if defined(ATHLON) || defined(OPTERON) || defined(BARCELONA) || defined(BOBCAT) || defined(BULLDOZER) || \
168168
defined(CORE_PRESCOTT) || defined(CORE_CORE2) || defined(PENRYN) || defined(DUNNINGTON) || \
169169
defined(CORE_NEHALEM) || defined(CORE_SANDYBRIDGE) || defined(ATOM) || defined(GENERIC) || \
170-
defined(PILEDRIVER) || defined(HASWELL) || defined(STEAMROLLER) || defined(EXCAVATOR) || defined(ZEN)
170+
defined(PILEDRIVER) || defined(HASWELL) || defined(STEAMROLLER) || defined(EXCAVATOR) || defined(ZEN) || defined(SKYLAKEX)
171171

172172
cpuid(0x80000006, &eax, &ebx, &ecx, &edx);
173173

@@ -251,7 +251,7 @@ int get_L2_size(void){
251251
void blas_set_parameter(void){
252252

253253
int factor;
254-
#if defined(BULLDOZER) || defined(PILEDRIVER) || defined(SANDYBRIDGE) || defined(NEHALEM) || defined(HASWELL) || defined(STEAMROLLER) || defined(EXCAVATOR) || defined(ZEN)
254+
#if defined(BULLDOZER) || defined(PILEDRIVER) || defined(SANDYBRIDGE) || defined(NEHALEM) || defined(HASWELL) || defined(STEAMROLLER) || defined(EXCAVATOR) || defined(ZEN) || defined(SKYLAKEX)
255255
int size = 16;
256256
#else
257257
int size = get_L2_size();

getarch.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,21 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
326326
#define CORENAME "HASWELL"
327327
#endif
328328

329+
#ifdef FORCE_SKYLAKEX
330+
#define FORCE
331+
#define FORCE_INTEL
332+
#define ARCHITECTURE "X86"
333+
#define SUBARCHITECTURE "SKYLAKEX"
334+
#define ARCHCONFIG "-DSKYLAKEX " \
335+
"-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
336+
"-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
337+
"-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
338+
"-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX " \
339+
"-DFMA3 -DHAVE_AVX512VL -march=skylake-avx512"
340+
#define LIBNAME "skylakex"
341+
#define CORENAME "SKYLAKEX"
342+
#endif
343+
329344
#ifdef FORCE_ATOM
330345
#define FORCE
331346
#define FORCE_INTEL

kernel/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function (build_core TARGET_CORE KDIR TSUFFIX KERNEL_DEFINITIONS)
121121
# Makefile.L3
122122
set(USE_TRMM false)
123123

124-
if (ARM OR ARM64 OR "${TARGET_CORE}" STREQUAL "LONGSOON3B" OR "${TARGET_CORE}" STREQUAL "GENERIC" OR "${CORE}" STREQUAL "generic" OR "${TARGET_CORE}" STREQUAL "HASWELL" OR "${CORE}" STREQUAL "haswell" OR "${CORE}" STREQUAL "zen")
124+
if (ARM OR ARM64 OR "${TARGET_CORE}" STREQUAL "LONGSOON3B" OR "${TARGET_CORE}" STREQUAL "GENERIC" OR "${CORE}" STREQUAL "generic" OR "${TARGET_CORE}" STREQUAL "HASWELL" OR "${CORE}" STREQUAL "haswell" OR "${CORE}" STREQUAL "zen" OR "${TARGET_CORE}" STREQUAL "SKYLAKEX" OR "${CORE}" STREQUAL "skylakex")
125125
set(USE_TRMM true)
126126
endif ()
127127

0 commit comments

Comments
 (0)