From 33c03417e628646fd8942377e0f84f2b983b6d6e Mon Sep 17 00:00:00 2001 From: lujiaweics Date: Fri, 23 Oct 2026 01:57:54 +0800 Subject: [PATCH] In DYNAMIC_ARCH builds the Emerald Rapids CPU is not detected and falls back to Cooper Lake. The detection logic for Emerald Rapids already exists in cpuid_x86.c, so this commit just ports it here. Tested on a local Sapphire Rapids server. --- driver/others/dynamic.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/driver/others/dynamic.c b/driver/others/dynamic.c index bd24ed969e..cdabb4b24a 100644 --- a/driver/others/dynamic.c +++ b/driver/others/dynamic.c @@ -804,6 +804,26 @@ static gotoblas_t *get_coretype(void){ return &gotoblas_NEHALEM; //OS doesn't support AVX. Use old kernels. } } + return NULL; + + case 12: + if (model == 15){ // Emerald Rapids + if(support_amx_bf16()) + return &gotoblas_SAPPHIRERAPIDS; + if(support_avx512_bf16()) + return &gotoblas_COOPERLAKE; + if (support_avx512()) + return &gotoblas_SKYLAKEX; + if(support_avx2()) + return &gotoblas_HASWELL; + if(support_avx()) { + openblas_warning(FALLBACK_VERBOSE, SANDYBRIDGE_FALLBACK); + return &gotoblas_SANDYBRIDGE; + } else { + openblas_warning(FALLBACK_VERBOSE, NEHALEM_FALLBACK); + return &gotoblas_NEHALEM; + } + } return NULL; } break; @@ -1157,11 +1177,12 @@ void gotoblas_dynamic_init(void) { if (gotoblas == NULL) gotoblas = &gotoblas_KATMAI; #else if (gotoblas == NULL) { - if (support_avx512_bf16()) gotoblas = &gotoblas_COOPERLAKE; - else if (support_avx512()) gotoblas = &gotoblas_SKYLAKEX; - else if (support_avx2()) gotoblas = &gotoblas_HASWELL; - else if (support_avx()) gotoblas = &gotoblas_SANDYBRIDGE; - else gotoblas = &gotoblas_PRESCOTT; + if (support_amx_bf16()) gotoblas = &gotoblas_SAPPHIRERAPIDS; + else if (support_avx512_bf16()) gotoblas = &gotoblas_COOPERLAKE; + else if (support_avx512()) gotoblas = &gotoblas_SKYLAKEX; + else if (support_avx2()) gotoblas = &gotoblas_HASWELL; + else if (support_avx()) gotoblas = &gotoblas_SANDYBRIDGE; + else gotoblas = &gotoblas_PRESCOTT; } /* sanity check, if 64bit pointer we can't have a 32 bit cpu */ if (sizeof(void*) == 8) {