Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AMD Renoir/Matisse cpu autodetection and preliminary support for Zen3 #2744

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions cpuid_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,10 +1454,11 @@ int get_cpuname(void){
return CPUTYPE_OPTERON;
case 1:
case 3:
case 7:
case 10:
// case 7:
// case 10:
return CPUTYPE_BARCELONA;
case 5:
case 7:
return CPUTYPE_BOBCAT;
case 6:
switch (model) {
Expand Down Expand Up @@ -1507,6 +1508,8 @@ int get_cpuname(void){
// AMD Ryzen
case 8:
// AMD Ryzen2
default:
// Matisse/Renoir and other recent Ryzen2
if(support_avx())
#ifndef NO_AVX2
return CPUTYPE_ZEN;
Expand All @@ -1516,6 +1519,16 @@ int get_cpuname(void){
else
return CPUTYPE_BARCELONA;
}
break;
case 10: // Zen3
if(support_avx())
#ifndef NO_AVX2
return CPUTYPE_ZEN;
#else
return CPUTYPE_SANDYBRIDGE; // Zen is closer in architecture to Sandy Bridge than to Excavator
#endif
else
return CPUTYPE_BARCELONA;
}
break;
}
Expand Down Expand Up @@ -2107,7 +2120,7 @@ int get_coretype(void){
return CORE_PILEDRIVER;
else
return CORE_BARCELONA; //OS don't support AVX.
case 5: // New EXCAVATOR
case 5: // New EXCAVATOR
if(support_avx())
return CORE_EXCAVATOR;
else
Expand Down Expand Up @@ -2135,12 +2148,14 @@ int get_coretype(void){
}
break;
}
} else if (exfamily == 8) {
} else if (exfamily == 8 || exfamily == 10) {
switch (model) {
case 1:
// AMD Ryzen
case 8:
// Ryzen 2
// Ryzen 2
default:
// Matisse,Renoir Ryzen2 models
if(support_avx())
#ifndef NO_AVX2
return CORE_ZEN;
Expand Down
16 changes: 12 additions & 4 deletions driver/others/dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static gotoblas_t *get_coretype(void){
if ((exfamily == 0) || (exfamily == 2)) {
if (ecx & (1 << 0)) return &gotoblas_OPTERON_SSE3;
else return &gotoblas_OPTERON;
} else if (exfamily == 5) {
} else if (exfamily == 5 || exfamily == 7) {
return &gotoblas_BOBCAT;
} else if (exfamily == 6) {
if(model == 1){
Expand Down Expand Up @@ -710,24 +710,32 @@ static gotoblas_t *get_coretype(void){
}
}
} else if (exfamily == 8) {
if (model == 1 || model == 8) {
/* if (model == 1 || model == 8) */ {
if(support_avx())
return &gotoblas_ZEN;
else{
openblas_warning(FALLBACK_VERBOSE, BARCELONA_FALLBACK);
return &gotoblas_BARCELONA; //OS doesn't support AVX. Use old kernels.
}
}
} else if (exfamily == 9) {
} else if (exfamily == 9) {
if(support_avx())
return &gotoblas_ZEN;
else{
openblas_warning(FALLBACK_VERBOSE, BARCELONA_FALLBACK);
return &gotoblas_BARCELONA; //OS doesn't support AVX. Use old kernels.
}
}
} else if (exfamily == 10) {
if(support_avx())
return &gotoblas_ZEN;
else{
openblas_warning(FALLBACK_VERBOSE, BARCELONA_FALLBACK);
return &gotoblas_BARCELONA; //OS doesn't support AVX. Use old kernels.
}
}else {
return &gotoblas_BARCELONA;
}

}
}

Expand Down