From 9b2d69aa80b72f9958860a5e8bcadb89f0e81045 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 24 Jan 2021 23:18:01 +0100 Subject: [PATCH 1/4] Add DYNAMIC_LIST option for ARM64 --- Makefile.system | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.system b/Makefile.system index abc2c3dc5..848c38797 100644 --- a/Makefile.system +++ b/Makefile.system @@ -625,6 +625,11 @@ DYNAMIC_CORE += THUNDERX2T99 DYNAMIC_CORE += TSV110 DYNAMIC_CORE += EMAG8180 DYNAMIC_CORE += THUNDERX3T110 +ifdef DYNAMIC_LIST +override DYNAMIC_CORE = ARMV8 $(DYNAMIC_LIST) +XCCOMMON_OPT = -DDYNAMIC_LIST -DDYN_ARMV8 +XCCOMMON_OPT += $(foreach dcore,$(DYNAMIC_LIST),-DDYN_$(dcore)) +endif endif ifeq ($(ARCH), mips64) From deb2e66bcce70c64b1e1d82612b24191563dedb5 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 24 Jan 2021 23:18:52 +0100 Subject: [PATCH 2/4] Add DYNAMIC_LIST support for ARM64 --- driver/others/dynamic_arm64.c | 80 ++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/driver/others/dynamic_arm64.c b/driver/others/dynamic_arm64.c index 37c0694b6..a86a95890 100644 --- a/driver/others/dynamic_arm64.c +++ b/driver/others/dynamic_arm64.c @@ -41,8 +41,75 @@ #include #include #endif +#ifdef OS_DARWIN +#include +int32_t value; +size_t length=sizeof(value); +#endif extern gotoblas_t gotoblas_ARMV8; +#ifdef DYNAMIC_LIST +#ifdef DYN_CORTEXA53 +extern gotoblas_t gotoblas_CORTEXA53; +#else +#define gotoblas_CORTEXA53 gotoblas_ARMV8 +#endif +#ifdef DYN_CORTEXA57 +extern gotoblas_t gotoblas_CORTEXA57; +#else +#define gotoblas_CORTEXA57 gotoblas_ARMV8 +#endif +#ifdef DYN_CORTEXA72 +extern gotoblas_t gotoblas_CORTEXA72; +#else +#define gotoblas_CORTEXA72 gotoblas_ARMV8 +#endif +#ifdef DYN_CORTEXA73 +extern gotoblas_t gotoblas_CORTEXA73; +#else +#define gotoblas_CORTEXA73 gotoblas_ARMV8 +#endif +#ifdef DYN_FALKOR +extern gotoblas_t gotoblas_FALKOR; +#else +#define gotoblas_FALKOR gotoblas_ARMV8 +#endif +#ifdef DYN_TSV110 +extern gotoblas_t gotoblas_TSV110; +#else +#define gotoblas_TSV110 gotoblas_ARMV8 +#endif +#ifdef DYN_THUNDERX +extern gotoblas_t gotoblas_THUNDERX; +#else +#define gotoblas_THUNDERX gotoblas_ARMV8 +#endif +#ifdef DYN_THUNDERX2T99 +extern gotoblas_t gotoblas_THUNDERX2T99; +#else +#define gotoblas_THUNDERX2T99 gotoblas_ARMV8 +#endif +#ifdef DYN_THUNDERX3T110 +extern gotoblas_t gotoblas_THUNDERX3T110; +#else +#define gotoblas_THUNDERX3T110 gotoblas_ARMV8 +#endif +#ifdef DYN_EMAG8180 +extern gotoblas_t gotoblas_EMAG8180; +#else +#define gotoblas_EMAG8180 gotoblas_ARMV8 +#endif +#ifdef DYN_NEOVERSEN1 +extern gotoblas_t gotoblas_NEOVERSEN1; +#else +#define gotoblas_NEOVERSEN1 gotoblas_ARMV8 +#endif +#ifdef DYN_VORTEX +extern gotoblas_t gotoblas_VORTEX; +#else +#define gotoblas_VORTEX gotoblas_ARMV8 +#endif +#else extern gotoblas_t gotoblas_CORTEXA53; extern gotoblas_t gotoblas_CORTEXA57; extern gotoblas_t gotoblas_CORTEXA72; @@ -54,10 +121,12 @@ extern gotoblas_t gotoblas_TSV110; extern gotoblas_t gotoblas_EMAG8180; extern gotoblas_t gotoblas_NEOVERSEN1; extern gotoblas_t gotoblas_THUNDERX3T110; +extern gotoblas_t gotoblas_VORTEX; +#endif extern void openblas_warning(int verbose, const char * msg); -#define NUM_CORETYPES 12 +#define NUM_CORETYPES 13 /* * In case asm/hwcap.h is outdated on the build system, make sure @@ -68,7 +137,7 @@ extern void openblas_warning(int verbose, const char * msg); #endif #define get_cpu_ftr(id, var) ({ \ - __asm__ __volatile__("mrs %0, "#id : "=r" (var)); \ + __asm__ ("mrs %0, "#id : "=r" (var)); \ }) static char *corename[] = { @@ -84,6 +153,7 @@ static char *corename[] = { "emag8180", "neoversen1", "thunderx3t110", + "vortex", "unknown" }; @@ -100,6 +170,7 @@ char *gotoblas_corename(void) { if (gotoblas == &gotoblas_EMAG8180) return corename[ 9]; if (gotoblas == &gotoblas_NEOVERSEN1) return corename[10]; if (gotoblas == &gotoblas_THUNDERX3T110) return corename[11]; + if (gotoblas == &gotoblas_VORTEX) return corename[12]; return corename[NUM_CORETYPES]; } @@ -131,6 +202,7 @@ static gotoblas_t *force_coretype(char *coretype) { case 9: return (&gotoblas_EMAG8180); case 10: return (&gotoblas_NEOVERSEN1); case 11: return (&gotoblas_THUNDERX3T110); + case 12: return (&gotoblas_VORTEX); } snprintf(message, 128, "Core not found: %s\n", coretype); openblas_warning(1, message); @@ -142,6 +214,10 @@ static gotoblas_t *get_coretype(void) { char coremsg[128]; #if (!defined OS_LINUX && !defined OS_ANDROID) +#ifdef DARWIN + sysctlbyname("hw.cpufamily",&value,&length,NULL,0); + if (value ==131287967) return CPU_VORTEX; +#endif return NULL; #else From cb61d3b46bb65787bff8452cd384e047c2f5687d Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 25 Jan 2021 13:13:20 +0100 Subject: [PATCH 3/4] Add DYNAMIC_LIST support for ARM64 --- cmake/arch.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/arch.cmake b/cmake/arch.cmake index 5457bfb07..4451f9eaa 100644 --- a/cmake/arch.cmake +++ b/cmake/arch.cmake @@ -45,6 +45,9 @@ endif () if (DYNAMIC_ARCH) if (ARM64) set(DYNAMIC_CORE ARMV8 CORTEXA53 CORTEXA57 CORTEXA72 CORTEXA73 FALKOR THUNDERX THUNDERX2T99 TSV110 EMAG8180 NEOVERSEN1 THUNDERX3T110) + if (DYNAMIC_LIST) + set(DYNAMIC_CORE ARMV8 ${DYNAMIC_LIST}) + endif () endif () if (POWER) From 0cb9e9fc8d5b56eb0db42136dd8268671438ad27 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 25 Jan 2021 19:02:21 +0100 Subject: [PATCH 4/4] Remove the VORTEX support bits again for now --- driver/others/dynamic_arm64.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/driver/others/dynamic_arm64.c b/driver/others/dynamic_arm64.c index a86a95890..6c68ba98a 100644 --- a/driver/others/dynamic_arm64.c +++ b/driver/others/dynamic_arm64.c @@ -41,11 +41,6 @@ #include #include #endif -#ifdef OS_DARWIN -#include -int32_t value; -size_t length=sizeof(value); -#endif extern gotoblas_t gotoblas_ARMV8; #ifdef DYNAMIC_LIST @@ -104,11 +99,6 @@ extern gotoblas_t gotoblas_NEOVERSEN1; #else #define gotoblas_NEOVERSEN1 gotoblas_ARMV8 #endif -#ifdef DYN_VORTEX -extern gotoblas_t gotoblas_VORTEX; -#else -#define gotoblas_VORTEX gotoblas_ARMV8 -#endif #else extern gotoblas_t gotoblas_CORTEXA53; extern gotoblas_t gotoblas_CORTEXA57; @@ -121,12 +111,11 @@ extern gotoblas_t gotoblas_TSV110; extern gotoblas_t gotoblas_EMAG8180; extern gotoblas_t gotoblas_NEOVERSEN1; extern gotoblas_t gotoblas_THUNDERX3T110; -extern gotoblas_t gotoblas_VORTEX; #endif extern void openblas_warning(int verbose, const char * msg); -#define NUM_CORETYPES 13 +#define NUM_CORETYPES 12 /* * In case asm/hwcap.h is outdated on the build system, make sure @@ -153,7 +142,6 @@ static char *corename[] = { "emag8180", "neoversen1", "thunderx3t110", - "vortex", "unknown" }; @@ -170,7 +158,6 @@ char *gotoblas_corename(void) { if (gotoblas == &gotoblas_EMAG8180) return corename[ 9]; if (gotoblas == &gotoblas_NEOVERSEN1) return corename[10]; if (gotoblas == &gotoblas_THUNDERX3T110) return corename[11]; - if (gotoblas == &gotoblas_VORTEX) return corename[12]; return corename[NUM_CORETYPES]; } @@ -202,7 +189,6 @@ static gotoblas_t *force_coretype(char *coretype) { case 9: return (&gotoblas_EMAG8180); case 10: return (&gotoblas_NEOVERSEN1); case 11: return (&gotoblas_THUNDERX3T110); - case 12: return (&gotoblas_VORTEX); } snprintf(message, 128, "Core not found: %s\n", coretype); openblas_warning(1, message); @@ -214,10 +200,6 @@ static gotoblas_t *get_coretype(void) { char coremsg[128]; #if (!defined OS_LINUX && !defined OS_ANDROID) -#ifdef DARWIN - sysctlbyname("hw.cpufamily",&value,&length,NULL,0); - if (value ==131287967) return CPU_VORTEX; -#endif return NULL; #else