Skip to content

Commit 1a8b613

Browse files
authored
Merge pull request #3278 from brada4/A55
Add CORTEXA55 cpuid 0xd05 support
2 parents a7627c5 + f0b822a commit 1a8b613

11 files changed

Lines changed: 260 additions & 7 deletions

File tree

Makefile.arm64

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ endif
5757
endif
5858
endif
5959

60+
# Use a53 tunings because a55 is only available in GCC>=8.1
61+
ifeq ($(CORE), CORTEXA55)
62+
ifeq ($(GCCVERSIONGTEQ7), 1)
63+
ifeq ($(GCCVERSIONGTEQ8), 1)
64+
CCOMMON_OPT += -march=armv8.2-a -mtune=cortex-a55
65+
ifneq ($(F_COMPILER), NAG)
66+
FCOMMON_OPT += -march=armv8.2-a -mtune=cortex-a55
67+
endif
68+
else
69+
CCOMMON_OPT += -march=armv8.2-a -mtune=cortex-a53
70+
ifneq ($(F_COMPILER), NAG)
71+
FCOMMON_OPT += -march=armv8.2-a -mtune=cortex-a53
72+
endif
73+
endif
74+
else
75+
CCOMMON_OPT += -march=armv8-a -mtune=cortex-a53
76+
ifneq ($(F_COMPILER), NAG)
77+
FCOMMON_OPT += -march=armv8-a -mtune=cortex-a53
78+
endif
79+
endif
80+
endif
81+
6082
ifeq ($(CORE), THUNDERX)
6183
CCOMMON_OPT += -march=armv8-a -mtune=thunderx
6284
ifneq ($(F_COMPILER), NAG)

Makefile.system

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
333333
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
334334
GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
335335
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
336+
GCCVERSIONGTEQ8 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 8)
336337
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
337338
GCCVERSIONGTEQ11 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 11)
338339
GCCVERSIONGTEQ10 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 10)
@@ -625,6 +626,7 @@ DYNAMIC_CORE += CORTEXA57
625626
DYNAMIC_CORE += CORTEXA72
626627
DYNAMIC_CORE += CORTEXA73
627628
DYNAMIC_CORE += NEOVERSEN1
629+
DYNAMIC_CORE += CORTEXA55
628630
DYNAMIC_CORE += FALKOR
629631
DYNAMIC_CORE += THUNDERX
630632
DYNAMIC_CORE += THUNDERX2T99

TargetList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ CORTEXA57
9292
CORTEXA72
9393
CORTEXA73
9494
NEOVERSEN1
95+
CORTEXA55
9596
EMAG8180
9697
FALKOR
9798
THUNDERX

cmake/arch.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ endif ()
4444

4545
if (DYNAMIC_ARCH)
4646
if (ARM64)
47-
set(DYNAMIC_CORE ARMV8 CORTEXA53 CORTEXA57 CORTEXA72 CORTEXA73 FALKOR THUNDERX THUNDERX2T99 TSV110 EMAG8180 NEOVERSEN1 THUNDERX3T110)
47+
set(DYNAMIC_CORE ARMV8 CORTEXA53 CORTEXA55 CORTEXA57 CORTEXA72 CORTEXA73 FALKOR THUNDERX THUNDERX2T99 TSV110 EMAG8180 NEOVERSEN1 THUNDERX3T110)
4848
if (DYNAMIC_LIST)
4949
set(DYNAMIC_CORE ARMV8 ${DYNAMIC_LIST})
5050
endif ()

cmake/prebuild.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ if (DEFINED CORE AND CMAKE_CROSSCOMPILING AND NOT (${HOST_OS} STREQUAL "WINDOWSS
177177
set(ZGEMM_UNROLL_M 4)
178178
set(ZGEMM_UNROLL_N 4)
179179
set(SYMV_P 16)
180-
elseif ("${TCORE}" STREQUAL "CORTEXA57" OR "${TCORE}" STREQUAL "CORTEXA53")
180+
elseif ("${TCORE}" STREQUAL "CORTEXA57" OR "${TCORE}" STREQUAL "CORTEXA53" OR "${TCORE}" STREQUAL "CORTEXA55")
181181
file(APPEND ${TARGET_CONF_TEMP}
182182
"#define L1_CODE_SIZE\t32768\n"
183183
"#define L1_CODE_LINESIZE\t64\n"

cmake/system.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (DEFINED BINARY AND DEFINED TARGET AND BINARY EQUAL 32)
3939
if (${TARGET} STREQUAL "BULLDOZER" OR ${TARGET} STREQUAL "PILEDRIVER" OR ${TARGET} STREQUAL "ZEN")
4040
set(TARGET "BARCELONA")
4141
endif ()
42-
if (${TARGET} STREQUAL "ARMV8" OR ${TARGET} STREQUAL "CORTEXA57" OR ${TARGET} STREQUAL "CORTEXA53")
42+
if (${TARGET} STREQUAL "ARMV8" OR ${TARGET} STREQUAL "CORTEXA57" OR ${TARGET} STREQUAL "CORTEXA53" OR ${TARGET} STREQUAL "CORTEXA55")
4343
set(TARGET "ARMV7")
4444
endif ()
4545
endif ()

cpuid_arm64.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ size_t length=sizeof(value);
3636
#define CPU_ARMV8 1
3737
// Arm
3838
#define CPU_CORTEXA53 2
39+
#define CPU_CORTEXA55 14
3940
#define CPU_CORTEXA57 3
4041
#define CPU_CORTEXA72 4
4142
#define CPU_CORTEXA73 5
@@ -67,7 +68,8 @@ static char *cpuname[] = {
6768
"EMAG8180",
6869
"NEOVERSEN1",
6970
"THUNDERX3T110",
70-
"VORTEX"
71+
"VORTEX",
72+
"CORTEXA55"
7173
};
7274

7375
static char *cpuname_lower[] = {
@@ -84,7 +86,8 @@ static char *cpuname_lower[] = {
8486
"emag8180",
8587
"neoversen1",
8688
"thunderx3t110",
87-
"vortex"
89+
"vortex",
90+
"cortexa55"
8891
};
8992

9093
int get_feature(char *search)
@@ -161,6 +164,8 @@ int detect(void)
161164
return CPU_CORTEXA73;
162165
else if (strstr(cpu_part, "0xd0c"))
163166
return CPU_NEOVERSEN1;
167+
else if (strstr(cpu_part, "0xd05"))
168+
return CPU_CORTEXA55;
164169
}
165170
// Qualcomm
166171
else if (strstr(cpu_implementer, "0x51") && strstr(cpu_part, "0xc00"))
@@ -281,6 +286,7 @@ void get_cpuconfig(void)
281286
{
282287

283288
case CPU_CORTEXA53:
289+
case CPU_CORTEXA55:
284290
printf("#define %s\n", cpuname[d]);
285291
// Fall-through
286292
case CPU_ARMV8:

driver/others/dynamic_arm64.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ extern gotoblas_t gotoblas_NEOVERSEN1;
9999
#else
100100
#define gotoblas_NEOVERSEN1 gotoblas_ARMV8
101101
#endif
102+
#ifdef DYN_CORTEX_A55
103+
extern gotoblas_t gotoblas_CORTEXA55;
104+
#else
105+
#define gotoblas_CORTEXA55 gotoblas_ARMV8
106+
#endif
102107
#else
103108
extern gotoblas_t gotoblas_CORTEXA53;
104109
extern gotoblas_t gotoblas_CORTEXA57;
@@ -111,11 +116,12 @@ extern gotoblas_t gotoblas_TSV110;
111116
extern gotoblas_t gotoblas_EMAG8180;
112117
extern gotoblas_t gotoblas_NEOVERSEN1;
113118
extern gotoblas_t gotoblas_THUNDERX3T110;
119+
extern gotoblas_t gotoblas_CORTEXA55;
114120
#endif
115121

116122
extern void openblas_warning(int verbose, const char * msg);
117123

118-
#define NUM_CORETYPES 12
124+
#define NUM_CORETYPES 13
119125

120126
/*
121127
* In case asm/hwcap.h is outdated on the build system, make sure
@@ -142,6 +148,7 @@ static char *corename[] = {
142148
"emag8180",
143149
"neoversen1",
144150
"thunderx3t110",
151+
"cortexa55",
145152
"unknown"
146153
};
147154

@@ -158,6 +165,7 @@ char *gotoblas_corename(void) {
158165
if (gotoblas == &gotoblas_EMAG8180) return corename[ 9];
159166
if (gotoblas == &gotoblas_NEOVERSEN1) return corename[10];
160167
if (gotoblas == &gotoblas_THUNDERX3T110) return corename[11];
168+
if (gotoblas == &gotoblas_CORTEXA55) return corename[12];
161169
return corename[NUM_CORETYPES];
162170
}
163171

@@ -189,6 +197,7 @@ static gotoblas_t *force_coretype(char *coretype) {
189197
case 9: return (&gotoblas_EMAG8180);
190198
case 10: return (&gotoblas_NEOVERSEN1);
191199
case 11: return (&gotoblas_THUNDERX3T110);
200+
case 12: return (&gotoblas_CORTEXA55);
192201
}
193202
snprintf(message, 128, "Core not found: %s\n", coretype);
194203
openblas_warning(1, message);
@@ -247,6 +256,8 @@ static gotoblas_t *get_coretype(void) {
247256
return &gotoblas_CORTEXA73;
248257
case 0xd0c: // Neoverse N1
249258
return &gotoblas_NEOVERSEN1;
259+
case 0xd05: // Cortex A55
260+
return &gotoblas_CORTEXA55;
250261
}
251262
break;
252263
case 0x42: // Broadcom

getarch.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,21 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11591159
#else
11601160
#endif
11611161

1162+
#ifdef FORCE_CORTEXA55
1163+
#define FORCE
1164+
#define ARCHITECTURE "ARM64"
1165+
#define SUBARCHITECTURE "CORTEXA55"
1166+
#define SUBDIRNAME "arm64"
1167+
#define ARCHCONFIG "-DCORTEXA55 " \
1168+
"-DL1_CODE_SIZE=16384 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
1169+
"-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
1170+
"-DL2_SIZE=65536 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
1171+
"-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
1172+
"-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
1173+
#define LIBNAME "cortexa55"
1174+
#define CORENAME "CORTEXA55"
1175+
#else
1176+
#endif
11621177

11631178
#ifdef FORCE_FALKOR
11641179
#define FORCE

0 commit comments

Comments
 (0)