Skip to content

Commit 03d7110

Browse files
authored
Merge pull request #2042 from maomao194313/develop
add TARGET support for HiSilicon tsv110 CPUs
2 parents 3ce28fb + 7e3eb9b commit 03d7110

File tree

6 files changed

+223
-3
lines changed

6 files changed

+223
-3
lines changed

Makefile.arm64

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ ifeq ($(CORE), THUNDERX2T99)
3838
CCOMMON_OPT += -march=armv8.1-a -mtune=thunderx2t99
3939
FCOMMON_OPT += -march=armv8.1-a -mtune=thunderx2t99
4040
endif
41+
42+
ifeq ($(CORE), TSV110)
43+
CCOMMON_OPT += -march=armv8.2-a -mtune=tsv110
44+
FCOMMON_OPT += -march=armv8.2-a -mtune=tsv110
45+
endif

TargetList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ CORTEXA73
9090
FALKOR
9191
THUNDERX
9292
THUNDERX2T99
93+
TSV110
9394

9495
9.System Z:
9596
ZARCH_GENERIC

cpuid_arm64.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
// Cavium
4040
#define CPU_THUNDERX 7
4141
#define CPU_THUNDERX2T99 8
42+
//Hisilicon
43+
#define CPU_TSV110 9
4244

4345
static char *cpuname[] = {
4446
"UNKNOWN",
@@ -49,7 +51,8 @@ static char *cpuname[] = {
4951
"CORTEXA73",
5052
"FALKOR",
5153
"THUNDERX",
52-
"THUNDERX2T99"
54+
"THUNDERX2T99",
55+
"TSV110"
5356
};
5457

5558
static char *cpuname_lower[] = {
@@ -61,7 +64,8 @@ static char *cpuname_lower[] = {
6164
"cortexa73",
6265
"falkor",
6366
"thunderx",
64-
"thunderx2t99"
67+
"thunderx2t99",
68+
"tsv110"
6569
};
6670

6771
int get_feature(char *search)
@@ -145,6 +149,9 @@ int detect(void)
145149
return CPU_THUNDERX;
146150
else if (strstr(cpu_implementer, "0x43") && strstr(cpu_part, "0x0af"))
147151
return CPU_THUNDERX2T99;
152+
// HiSilicon
153+
else if (strstr(cpu_implementer, "0x48") && strstr(cpu_part, "0xd01"))
154+
return CPU_TSV110;
148155
}
149156

150157
p = (char *) NULL ;
@@ -286,6 +293,21 @@ void get_cpuconfig(void)
286293
printf("#define DTB_DEFAULT_ENTRIES 64 \n");
287294
printf("#define DTB_SIZE 4096 \n");
288295
break;
296+
297+
case CPU_TSV110:
298+
printf("#define TSV110 \n");
299+
printf("#define L1_CODE_SIZE 65536 \n");
300+
printf("#define L1_CODE_LINESIZE 64 \n");
301+
printf("#define L1_CODE_ASSOCIATIVE 4 \n");
302+
printf("#define L1_DATA_SIZE 65536 \n");
303+
printf("#define L1_DATA_LINESIZE 64 \n");
304+
printf("#define L1_DATA_ASSOCIATIVE 4 \n");
305+
printf("#define L2_SIZE 524228 \n");
306+
printf("#define L2_LINESIZE 64 \n");
307+
printf("#define L2_ASSOCIATIVE 8 \n");
308+
printf("#define DTB_DEFAULT_ENTRIES 64 \n");
309+
printf("#define DTB_SIZE 4096 \n");
310+
break;
289311
}
290312
}
291313

getarch.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,23 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10651065
#else
10661066
#endif
10671067

1068+
#ifdef FORCE_TSV110
1069+
#define FORCE
1070+
#define ARCHITECTURE "ARM64"
1071+
#define SUBARCHITECTURE "TSV110"
1072+
#define SUBDIRNAME "arm64"
1073+
#define ARCHCONFIG "-DTSV110 " \
1074+
"-DL1_CODE_SIZE=65536 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=4 " \
1075+
"-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=4 " \
1076+
"-DL2_SIZE=524288 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
1077+
"-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
1078+
"-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
1079+
#define LIBNAME "tsv110"
1080+
#define CORENAME "TSV110"
1081+
#else
1082+
#endif
1083+
1084+
10681085
#ifdef FORCE_ZARCH_GENERIC
10691086
#define FORCE
10701087
#define ARCHITECTURE "ZARCH"

kernel/arm64/KERNEL.TSV110

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
SAMINKERNEL = ../arm/amin.c
2+
DAMINKERNEL = ../arm/amin.c
3+
CAMINKERNEL = ../arm/zamin.c
4+
ZAMINKERNEL = ../arm/zamin.c
5+
6+
SMAXKERNEL = ../arm/max.c
7+
DMAXKERNEL = ../arm/max.c
8+
9+
SMINKERNEL = ../arm/min.c
10+
DMINKERNEL = ../arm/min.c
11+
12+
ISAMINKERNEL = ../arm/iamin.c
13+
IDAMINKERNEL = ../arm/iamin.c
14+
ICAMINKERNEL = ../arm/izamin.c
15+
IZAMINKERNEL = ../arm/izamin.c
16+
17+
ISMAXKERNEL = ../arm/imax.c
18+
IDMAXKERNEL = ../arm/imax.c
19+
20+
ISMINKERNEL = ../arm/imin.c
21+
IDMINKERNEL = ../arm/imin.c
22+
23+
STRMMKERNEL = ../generic/trmmkernel_4x4.c
24+
DTRMMKERNEL = ../generic/trmmkernel_2x2.c
25+
CTRMMKERNEL = ../generic/ztrmmkernel_2x2.c
26+
ZTRMMKERNEL = ../generic/ztrmmkernel_2x2.c
27+
28+
STRSMKERNEL_LN = ../generic/trsm_kernel_LN.c
29+
STRSMKERNEL_LT = ../generic/trsm_kernel_LT.c
30+
STRSMKERNEL_RN = ../generic/trsm_kernel_RN.c
31+
STRSMKERNEL_RT = ../generic/trsm_kernel_RT.c
32+
33+
DTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c
34+
DTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c
35+
DTRSMKERNEL_RN = ../generic/trsm_kernel_RN.c
36+
DTRSMKERNEL_RT = ../generic/trsm_kernel_RT.c
37+
38+
CTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c
39+
CTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c
40+
CTRSMKERNEL_RN = ../generic/trsm_kernel_RN.c
41+
CTRSMKERNEL_RT = ../generic/trsm_kernel_RT.c
42+
43+
ZTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c
44+
ZTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c
45+
ZTRSMKERNEL_RN = ../generic/trsm_kernel_RN.c
46+
ZTRSMKERNEL_RT = ../generic/trsm_kernel_RT.c
47+
48+
SAMAXKERNEL = amax.S
49+
DAMAXKERNEL = amax.S
50+
CAMAXKERNEL = zamax.S
51+
ZAMAXKERNEL = zamax.S
52+
53+
ISAMAXKERNEL = iamax.S
54+
IDAMAXKERNEL = iamax.S
55+
ICAMAXKERNEL = izamax.S
56+
IZAMAXKERNEL = izamax.S
57+
58+
SASUMKERNEL = asum.S
59+
DASUMKERNEL = asum.S
60+
CASUMKERNEL = casum.S
61+
ZASUMKERNEL = zasum.S
62+
63+
SAXPYKERNEL = axpy.S
64+
DAXPYKERNEL = axpy.S
65+
CAXPYKERNEL = zaxpy.S
66+
ZAXPYKERNEL = zaxpy.S
67+
68+
SCOPYKERNEL = copy.S
69+
DCOPYKERNEL = copy.S
70+
CCOPYKERNEL = copy.S
71+
ZCOPYKERNEL = copy.S
72+
73+
SDOTKERNEL = dot.S
74+
DDOTKERNEL = dot.S
75+
CDOTKERNEL = zdot.S
76+
ZDOTKERNEL = zdot.S
77+
DSDOTKERNEL = dot.S
78+
79+
SNRM2KERNEL = nrm2.S
80+
DNRM2KERNEL = nrm2.S
81+
CNRM2KERNEL = znrm2.S
82+
ZNRM2KERNEL = znrm2.S
83+
84+
SROTKERNEL = rot.S
85+
DROTKERNEL = rot.S
86+
CROTKERNEL = zrot.S
87+
ZROTKERNEL = zrot.S
88+
89+
SSCALKERNEL = scal.S
90+
DSCALKERNEL = scal.S
91+
CSCALKERNEL = zscal.S
92+
ZSCALKERNEL = zscal.S
93+
94+
SSWAPKERNEL = swap.S
95+
DSWAPKERNEL = swap.S
96+
CSWAPKERNEL = swap.S
97+
ZSWAPKERNEL = swap.S
98+
99+
SGEMVNKERNEL = gemv_n.S
100+
DGEMVNKERNEL = gemv_n.S
101+
CGEMVNKERNEL = zgemv_n.S
102+
ZGEMVNKERNEL = zgemv_n.S
103+
104+
SGEMVTKERNEL = gemv_t.S
105+
DGEMVTKERNEL = gemv_t.S
106+
CGEMVTKERNEL = zgemv_t.S
107+
ZGEMVTKERNEL = zgemv_t.S
108+
109+
SGEMMKERNEL = sgemm_kernel_$(SGEMM_UNROLL_M)x$(SGEMM_UNROLL_N).S
110+
STRMMKERNEL = strmm_kernel_$(SGEMM_UNROLL_M)x$(SGEMM_UNROLL_N).S
111+
ifneq ($(SGEMM_UNROLL_M), $(SGEMM_UNROLL_N))
112+
SGEMMINCOPY = ../generic/gemm_ncopy_$(SGEMM_UNROLL_M).c
113+
SGEMMITCOPY = ../generic/gemm_tcopy_$(SGEMM_UNROLL_M).c
114+
SGEMMINCOPYOBJ = sgemm_incopy$(TSUFFIX).$(SUFFIX)
115+
SGEMMITCOPYOBJ = sgemm_itcopy$(TSUFFIX).$(SUFFIX)
116+
endif
117+
SGEMMONCOPY = ../generic/gemm_ncopy_$(SGEMM_UNROLL_N).c
118+
SGEMMOTCOPY = ../generic/gemm_tcopy_$(SGEMM_UNROLL_N).c
119+
SGEMMONCOPYOBJ = sgemm_oncopy$(TSUFFIX).$(SUFFIX)
120+
SGEMMOTCOPYOBJ = sgemm_otcopy$(TSUFFIX).$(SUFFIX)
121+
122+
DGEMMKERNEL = dgemm_kernel_$(DGEMM_UNROLL_M)x$(DGEMM_UNROLL_N).S
123+
DTRMMKERNEL = dtrmm_kernel_$(DGEMM_UNROLL_M)x$(DGEMM_UNROLL_N).S
124+
125+
ifneq ($(DGEMM_UNROLL_M), $(DGEMM_UNROLL_N))
126+
127+
ifeq ($(DGEMM_UNROLL_M), 8)
128+
DGEMMINCOPY = dgemm_ncopy_$(DGEMM_UNROLL_M).S
129+
DGEMMITCOPY = dgemm_tcopy_$(DGEMM_UNROLL_M).S
130+
else
131+
DGEMMINCOPY = ../generic/gemm_ncopy_$(DGEMM_UNROLL_M).c
132+
DGEMMITCOPY = ../generic/gemm_tcopy_$(DGEMM_UNROLL_M).c
133+
endif
134+
135+
DGEMMINCOPYOBJ = dgemm_incopy$(TSUFFIX).$(SUFFIX)
136+
DGEMMITCOPYOBJ = dgemm_itcopy$(TSUFFIX).$(SUFFIX)
137+
endif
138+
139+
ifeq ($(DGEMM_UNROLL_N), 4)
140+
DGEMMONCOPY = dgemm_ncopy_$(DGEMM_UNROLL_N).S
141+
DGEMMOTCOPY = dgemm_tcopy_$(DGEMM_UNROLL_N).S
142+
else
143+
DGEMMONCOPY = ../generic/gemm_ncopy_$(DGEMM_UNROLL_N).c
144+
DGEMMOTCOPY = ../generic/gemm_tcopy_$(DGEMM_UNROLL_N).c
145+
endif
146+
147+
DGEMMONCOPYOBJ = dgemm_oncopy$(TSUFFIX).$(SUFFIX)
148+
DGEMMOTCOPYOBJ = dgemm_otcopy$(TSUFFIX).$(SUFFIX)
149+
150+
CGEMMKERNEL = cgemm_kernel_$(CGEMM_UNROLL_M)x$(CGEMM_UNROLL_N).S
151+
CTRMMKERNEL = ctrmm_kernel_$(CGEMM_UNROLL_M)x$(CGEMM_UNROLL_N).S
152+
ifneq ($(CGEMM_UNROLL_M), $(CGEMM_UNROLL_N))
153+
CGEMMINCOPY = ../generic/zgemm_ncopy_$(CGEMM_UNROLL_M).c
154+
CGEMMITCOPY = ../generic/zgemm_tcopy_$(CGEMM_UNROLL_M).c
155+
CGEMMINCOPYOBJ = cgemm_incopy$(TSUFFIX).$(SUFFIX)
156+
CGEMMITCOPYOBJ = cgemm_itcopy$(TSUFFIX).$(SUFFIX)
157+
endif
158+
CGEMMONCOPY = ../generic/zgemm_ncopy_$(CGEMM_UNROLL_N).c
159+
CGEMMOTCOPY = ../generic/zgemm_tcopy_$(CGEMM_UNROLL_N).c
160+
CGEMMONCOPYOBJ = cgemm_oncopy$(TSUFFIX).$(SUFFIX)
161+
CGEMMOTCOPYOBJ = cgemm_otcopy$(TSUFFIX).$(SUFFIX)
162+
163+
ZGEMMKERNEL = zgemm_kernel_$(ZGEMM_UNROLL_M)x$(ZGEMM_UNROLL_N).S
164+
ZTRMMKERNEL = ztrmm_kernel_$(ZGEMM_UNROLL_M)x$(ZGEMM_UNROLL_N).S
165+
ifneq ($(ZGEMM_UNROLL_M), $(ZGEMM_UNROLL_N))
166+
ZGEMMINCOPY = ../generic/zgemm_ncopy_$(ZGEMM_UNROLL_M).c
167+
ZGEMMITCOPY = ../generic/zgemm_tcopy_$(ZGEMM_UNROLL_M).c
168+
ZGEMMINCOPYOBJ = zgemm_incopy$(TSUFFIX).$(SUFFIX)
169+
ZGEMMITCOPYOBJ = zgemm_itcopy$(TSUFFIX).$(SUFFIX)
170+
endif
171+
ZGEMMONCOPY = ../generic/zgemm_ncopy_$(ZGEMM_UNROLL_N).c
172+
ZGEMMOTCOPY = ../generic/zgemm_tcopy_$(ZGEMM_UNROLL_N).c
173+
ZGEMMONCOPYOBJ = zgemm_oncopy$(TSUFFIX).$(SUFFIX)
174+
ZGEMMOTCOPYOBJ = zgemm_otcopy$(TSUFFIX).$(SUFFIX)
175+

param.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25912591

25922592
#if defined(CORTEXA53) || defined(CORTEXA57) || \
25932593
defined(CORTEXA72) || defined(CORTEXA73) || \
2594-
defined(FALKOR)
2594+
defined(FALKOR) || defined(TSV110)
25952595

25962596
#define SGEMM_DEFAULT_UNROLL_M 16
25972597
#define SGEMM_DEFAULT_UNROLL_N 4

0 commit comments

Comments
 (0)