Merge pull request #2744 from martin-frbg/issue2738

Add AMD Renoir/Matisse cpu autodetection and preliminary support for Zen3
This commit is contained in:
Martin Kroeker 2020-07-28 19:32:04 +02:00 committed by GitHub
commit 7c02f4b1f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 9 deletions

View File

@ -1454,10 +1454,11 @@ int get_cpuname(void){
return CPUTYPE_OPTERON; return CPUTYPE_OPTERON;
case 1: case 1:
case 3: case 3:
case 7: // case 7:
case 10: // case 10:
return CPUTYPE_BARCELONA; return CPUTYPE_BARCELONA;
case 5: case 5:
case 7:
return CPUTYPE_BOBCAT; return CPUTYPE_BOBCAT;
case 6: case 6:
switch (model) { switch (model) {
@ -1507,6 +1508,8 @@ int get_cpuname(void){
// AMD Ryzen // AMD Ryzen
case 8: case 8:
// AMD Ryzen2 // AMD Ryzen2
default:
// Matisse/Renoir and other recent Ryzen2
if(support_avx()) if(support_avx())
#ifndef NO_AVX2 #ifndef NO_AVX2
return CPUTYPE_ZEN; return CPUTYPE_ZEN;
@ -1516,6 +1519,16 @@ int get_cpuname(void){
else else
return CPUTYPE_BARCELONA; 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; break;
} }
@ -2107,7 +2120,7 @@ int get_coretype(void){
return CORE_PILEDRIVER; return CORE_PILEDRIVER;
else else
return CORE_BARCELONA; //OS don't support AVX. return CORE_BARCELONA; //OS don't support AVX.
case 5: // New EXCAVATOR case 5: // New EXCAVATOR
if(support_avx()) if(support_avx())
return CORE_EXCAVATOR; return CORE_EXCAVATOR;
else else
@ -2135,12 +2148,14 @@ int get_coretype(void){
} }
break; break;
} }
} else if (exfamily == 8) { } else if (exfamily == 8 || exfamily == 10) {
switch (model) { switch (model) {
case 1: case 1:
// AMD Ryzen // AMD Ryzen
case 8: case 8:
// Ryzen 2 // Ryzen 2
default:
// Matisse,Renoir Ryzen2 models
if(support_avx()) if(support_avx())
#ifndef NO_AVX2 #ifndef NO_AVX2
return CORE_ZEN; return CORE_ZEN;

View File

@ -656,7 +656,7 @@ static gotoblas_t *get_coretype(void){
if ((exfamily == 0) || (exfamily == 2)) { if ((exfamily == 0) || (exfamily == 2)) {
if (ecx & (1 << 0)) return &gotoblas_OPTERON_SSE3; if (ecx & (1 << 0)) return &gotoblas_OPTERON_SSE3;
else return &gotoblas_OPTERON; else return &gotoblas_OPTERON;
} else if (exfamily == 5) { } else if (exfamily == 5 || exfamily == 7) {
return &gotoblas_BOBCAT; return &gotoblas_BOBCAT;
} else if (exfamily == 6) { } else if (exfamily == 6) {
if(model == 1){ if(model == 1){
@ -710,7 +710,7 @@ static gotoblas_t *get_coretype(void){
} }
} }
} else if (exfamily == 8) { } else if (exfamily == 8) {
if (model == 1 || model == 8) { /* if (model == 1 || model == 8) */ {
if(support_avx()) if(support_avx())
return &gotoblas_ZEN; return &gotoblas_ZEN;
else{ else{
@ -718,16 +718,24 @@ static gotoblas_t *get_coretype(void){
return &gotoblas_BARCELONA; //OS doesn't support AVX. Use old kernels. return &gotoblas_BARCELONA; //OS doesn't support AVX. Use old kernels.
} }
} }
} else if (exfamily == 9) { } else if (exfamily == 9) {
if(support_avx()) if(support_avx())
return &gotoblas_ZEN; return &gotoblas_ZEN;
else{ else{
openblas_warning(FALLBACK_VERBOSE, BARCELONA_FALLBACK); openblas_warning(FALLBACK_VERBOSE, BARCELONA_FALLBACK);
return &gotoblas_BARCELONA; //OS doesn't support AVX. Use old kernels. 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 { }else {
return &gotoblas_BARCELONA; return &gotoblas_BARCELONA;
} }
} }
} }