Skip to content

Commit

Permalink
add Tiger Lake and Ice Lake Xeon (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffhammond committed Apr 6, 2021
1 parent b8e7e42 commit 9926be9
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ CFLAGS = -Wall -g3 -O3 -fopenmp -std=c99
INTEL_STATIC = -static-intel -no-intel-extensions

CFLAGS += -DDEBUG
CFLAGS += -DSUPPORT_XEON_PHI
CFLAGS += -DSUPPORT_TIGERLAKE
CFLAGS += -DSUPPORT_ICELAKE
CFLAGS += -DSUPPORT_ICELAKE_SERVER
CFLAGS += -DSUPPORT_CANNONLAKE
CFLAGS += -DSUPPORT_XEON_PHI
CFLAGS += -DSUPPORT_PRE_AVX512

all: test.x time.x empirical.x
Expand Down
86 changes: 85 additions & 1 deletion vpu-count.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,50 @@ bool is_icelake_server(void)
PDEBUG("ext model: %#04x=%d\n", xmodel, xmodel);
//PDEBUG("ext family: %#08x=%d\n", xfamily, xfamily);

bool icelake = (model == 0x86); /* 134 in binary */
bool icelake = ( (model == 0x8c) || /* 140 in binary */
(model == 0x8d) ); /* 141 in binary */
PDEBUG("Ice Lake server? %s\n", icelake ? "yes" : "no");

return (icelake);
}

bool is_tigerlake_client(void)
{
/* leaf 1 - Model, Family, etc. */
uint32_t leaf1[4]={0x1,0x0,0x0,0x0};

__cpuid(leaf1[0], leaf1[0], leaf1[1], leaf1[2], leaf1[3]);
PDEBUG("0x1: %x,%x,%x,%x\n", leaf1[0], leaf1[1], leaf1[2], leaf1[3]);

//uint32_t stepping = (leaf1[0] ) & 0x0f;
uint32_t model = (leaf1[0] >> 4) & 0x0f;
uint32_t family = (leaf1[0] >> 8) & 0x0f;
//uint32_t proctype = (leaf1[0] >> 12) & 0x03;
uint32_t xmodel = (leaf1[0] >> 16) & 0x0f;
//uint32_t xfamily = (leaf1[0] >> 20) & 0xff;

if (family == 0x06) {
model += (xmodel << 4);
}
else if (family == 0x0f) {
model += (xmodel << 4);
//family += xfamily;
}

PDEBUG("signature: %#08x\n", (leaf1[0]) );
//PDEBUG("stepping: %#04x=%d\n", stepping, stepping);
PDEBUG("model: %#04x=%d\n", model, model);
PDEBUG("family: %#04x=%d\n", family, family);
//PDEBUG("proc type: %#04x=%d\n", proctype, proctype);
PDEBUG("ext model: %#04x=%d\n", xmodel, xmodel);
//PDEBUG("ext family: %#08x=%d\n", xfamily, xfamily);

bool tigerlake = (model == 0x8f);
PDEBUG("Tiger Lake client? %s\n", tigerlake ? "yes" : "no");

return (icelake);
}

bool is_knl(void)
{
/* leaf 7 - AVX-512 features */
Expand Down Expand Up @@ -565,6 +603,29 @@ int vpu_count(void)
return 2;
}
}
#ifdef SUPPORT_TIGERLAKE
else if ( is_tigerlake_client() ) {
PDEBUG("Tiger Lake client detected\n");

#ifdef DEBUG
char cpu_name[32] = {0};
get_cpu_name32(cpu_name);
PDEBUG("cpu_name = %s\n", cpu_name);

if ( has_avx512_skx() ) {
PDEBUG("AVX-512 F,CD,DQ,BW,VL detected\n");
}
if ( has_avx512_vpopcntdq() ) {
PDEBUG("AVX-512 VPOPCNTDQ detected\n");
}
if ( has_avx512_snc() ) {
PDEBUG("AVX-512 VBMI2,GFNI,VAES,VPCLMULQDQ,BITALG detected\n");
}
#endif

return 1;
}
#endif /* SUPPORT_TIGERLAKE */
#ifdef SUPPORT_ICELAKE
else if ( is_icelake_client() ) {
PDEBUG("Ice Lake client detected\n");
Expand All @@ -591,6 +652,29 @@ int vpu_count(void)
return 1;
}
#endif /* SUPPORT_ICELAKE */
#ifdef SUPPORT_ICELAKE_SERVER
else if ( is_icelake_server() ) {
PDEBUG("Ice Lake server detected\n");

#ifdef DEBUG
char cpu_name[32] = {0};
get_cpu_name32(cpu_name);
PDEBUG("cpu_name = %s\n", cpu_name);

if ( has_avx512_skx() ) {
PDEBUG("AVX-512 F,CD,DQ,BW,VL detected\n");
}
if ( has_avx512_vpopcntdq() ) {
PDEBUG("AVX-512 VPOPCNTDQ detected\n");
}
if ( has_avx512_snc() ) {
PDEBUG("AVX-512 VBMI2,GFNI,VAES,VPCLMULQDQ,BITALG detected\n");
}
#endif

return 2;
}
#endif /* SUPPORT_ICELAKE_SERVER */
#ifdef SUPPORT_CANNONLAKE
else if ( is_cannonlake_client() ) {
PDEBUG("Cannon Lake client detected\n");
Expand Down

0 comments on commit 9926be9

Please sign in to comment.