24.04
a64fx.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021, 2023 Arm Limited.
3
*
4
* SPDX-License-Identifier: MIT
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to
8
* deal in the Software without restriction, including without limitation the
9
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
* sell copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in all
14
* copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
#ifdef ARM_COMPUTE_ENABLE_SVE
25
26
#include <cstddef>
27
#include <cstdint>
28
29
namespace
arm_gemm
{
30
31
void
sve_interleaved_s8s32_dot_8x3VL_a64fx(
32
const
int8_t *Apanel,
33
const
int8_t *Bpanel,
34
int32_t *Cpanel,
35
int
ablocks,
36
int
bblocks,
37
int
K
) {
38
39
struct
KernelArgs {
40
size_t
K
= {};
41
const
int8_t *Bpanel = {};
42
size_t
bblocks = {};
43
} ka;
44
45
ka.K = (
K
/4) - 1;
46
ka.Bpanel = Bpanel;
47
ka.bblocks = bblocks;
48
49
__asm__ __volatile__(
50
"ptrue p0.b\n"
51
"1:"
// Height loop
52
"ldr x23, [%x[args_ptr], %[offsetof_bblocks]]\n"
53
"ldr x22, [%x[args_ptr], %[offsetof_Bpanel]]\n"
54
"mov x21, %x[Apanel]\n"
55
"2:"
// Width loop
56
"ldr x20, [%x[args_ptr], %[offsetof_K]]\n"
57
"mov %x[Apanel], x21\n"
58
"cmp x20, #0x2\n"
59
"mov z8.s, #0x0\n"
60
"mov z9.s, #0x0\n"
61
"ld1b { z0.b }, p0/Z, [x22]\n"
62
"mov z10.s, #0x0\n"
63
"mov z11.s, #0x0\n"
64
"ld1b { z1.b }, p0/Z, [x22, #1, MUL VL]\n"
65
"mov z12.s, #0x0\n"
66
"mov z13.s, #0x0\n"
67
"ld1b { z2.b }, p0/Z, [x22, #2, MUL VL]\n"
68
"mov z14.s, #0x0\n"
69
"mov z15.s, #0x0\n"
70
"ld1rw { z3.s }, p0/Z, [%x[Apanel]]\n"
71
"mov z16.s, #0x0\n"
72
"mov z17.s, #0x0\n"
73
"ld1rw { z4.s }, p0/Z, [%x[Apanel], #4]\n"
74
"mov z18.s, #0x0\n"
75
"mov z19.s, #0x0\n"
76
"ld1rw { z5.s }, p0/Z, [%x[Apanel], #8]\n"
77
"mov z20.s, #0x0\n"
78
"mov z21.s, #0x0\n"
79
"ld1rw { z6.s }, p0/Z, [%x[Apanel], #12]\n"
80
"mov z22.s, #0x0\n"
81
"mov z23.s, #0x0\n"
82
"mov z24.s, #0x0\n"
83
"mov z25.s, #0x0\n"
84
"mov z26.s, #0x0\n"
85
"mov z27.s, #0x0\n"
86
"mov z28.s, #0x0\n"
87
"mov z29.s, #0x0\n"
88
"mov z30.s, #0x0\n"
89
"mov z31.s, #0x0\n"
90
"blt 4f\n"
91
"3:"
// main loop head
92
"sdot z8.s, z0.b, z3.b\n"
93
"sdot z9.s, z1.b, z3.b\n"
94
"sub x20, x20, #0x2\n"
95
"sdot z10.s, z2.b, z3.b\n"
96
"ld1rw { z7.s }, p0/Z, [%x[Apanel], #16]\n"
97
"sdot z11.s, z0.b, z4.b\n"
98
"sdot z12.s, z1.b, z4.b\n"
99
"sdot z13.s, z2.b, z4.b\n"
100
"ld1rw { z4.s }, p0/Z, [%x[Apanel], #20]\n"
101
"sdot z14.s, z0.b, z5.b\n"
102
"sdot z15.s, z1.b, z5.b\n"
103
"cmp x20, #0x2\n"
104
"sdot z16.s, z2.b, z5.b\n"
105
"ld1rw { z3.s }, p0/Z, [%x[Apanel], #24]\n"
106
"sdot z17.s, z0.b, z6.b\n"
107
"sdot z18.s, z1.b, z6.b\n"
108
"sdot z19.s, z2.b, z6.b\n"
109
"ld1rw { z5.s }, p0/Z, [%x[Apanel], #28]\n"
110
"sdot z20.s, z0.b, z7.b\n"
111
"sdot z21.s, z1.b, z7.b\n"
112
"sdot z22.s, z2.b, z7.b\n"
113
"ld1rw { z7.s }, p0/Z, [%x[Apanel], #32]\n"
114
"sdot z23.s, z0.b, z4.b\n"
115
"sdot z24.s, z1.b, z4.b\n"
116
"sdot z25.s, z2.b, z4.b\n"
117
"ld1rw { z4.s }, p0/Z, [%x[Apanel], #36]\n"
118
"sdot z26.s, z0.b, z3.b\n"
119
"sdot z27.s, z1.b, z3.b\n"
120
"sdot z28.s, z2.b, z3.b\n"
121
"ld1rw { z3.s }, p0/Z, [%x[Apanel], #40]\n"
122
"sdot z29.s, z0.b, z5.b\n"
123
"ld1b { z6.b }, p0/Z, [x22, #3, MUL VL]\n"
124
"sdot z30.s, z1.b, z5.b\n"
125
"sdot z31.s, z2.b, z5.b\n"
126
"ld1b { z2.b }, p0/Z, [x22, #4, MUL VL]\n"
127
"ld1b { z5.b }, p0/Z, [x22, #5, MUL VL]\n"
128
"sdot z8.s, z6.b, z7.b\n"
129
"ld1rw { z1.s }, p0/Z, [%x[Apanel], #44]\n"
130
"sdot z9.s, z2.b, z7.b\n"
131
"sdot z10.s, z5.b, z7.b\n"
132
"sdot z11.s, z6.b, z4.b\n"
133
"ld1rw { z7.s }, p0/Z, [%x[Apanel], #48]\n"
134
"sdot z12.s, z2.b, z4.b\n"
135
"sdot z13.s, z5.b, z4.b\n"
136
"ld1rw { z4.s }, p0/Z, [%x[Apanel], #52]\n"
137
"sdot z14.s, z6.b, z3.b\n"
138
"sdot z15.s, z2.b, z3.b\n"
139
"addvl x22, x22, #6\n"
140
"sdot z16.s, z5.b, z3.b\n"
141
"ld1rw { z0.s }, p0/Z, [%x[Apanel], #56]\n"
142
"sdot z17.s, z6.b, z1.b\n"
143
"sdot z18.s, z2.b, z1.b\n"
144
"sdot z19.s, z5.b, z1.b\n"
145
"ld1rw { z1.s }, p0/Z, [%x[Apanel], #60]\n"
146
"add %x[Apanel], %x[Apanel], #0x40\n"
147
"sdot z20.s, z6.b, z7.b\n"
148
"sdot z21.s, z2.b, z7.b\n"
149
"sdot z22.s, z5.b, z7.b\n"
150
"sdot z23.s, z6.b, z4.b\n"
151
"ld1rw { z3.s }, p0/Z, [%x[Apanel]]\n"
152
"sdot z24.s, z2.b, z4.b\n"
153
"sdot z25.s, z5.b, z4.b\n"
154
"ld1rw { z4.s }, p0/Z, [%x[Apanel], #4]\n"
155
"sdot z26.s, z6.b, z0.b\n"
156
"sdot z27.s, z2.b, z0.b\n"
157
"sdot z28.s, z5.b, z0.b\n"
158
"sdot z29.s, z6.b, z1.b\n"
159
"ld1b { z0.b }, p0/Z, [x22]\n"
160
"sdot z30.s, z2.b, z1.b\n"
161
"sdot z31.s, z5.b, z1.b\n"
162
"ld1b { z1.b }, p0/Z, [x22, #1, MUL VL]\n"
163
"ld1b { z2.b }, p0/Z, [x22, #2, MUL VL]\n"
164
"ld1rw { z5.s }, p0/Z, [%x[Apanel], #8]\n"
165
"ld1rw { z6.s }, p0/Z, [%x[Apanel], #12]\n"
166
"bge 3b\n"
167
"4:"
// main loop skip
168
"sdot z8.s, z0.b, z3.b\n"
169
"sdot z9.s, z1.b, z3.b\n"
170
"addvl x22, x22, #3\n"
171
"sdot z10.s, z2.b, z3.b\n"
172
"ld1rw { z7.s }, p0/Z, [%x[Apanel], #16]\n"
173
"sdot z11.s, z0.b, z4.b\n"
174
"sdot z12.s, z1.b, z4.b\n"
175
"sdot z13.s, z2.b, z4.b\n"
176
"ld1rw { z4.s }, p0/Z, [%x[Apanel], #20]\n"
177
"sdot z14.s, z0.b, z5.b\n"
178
"sdot z15.s, z1.b, z5.b\n"
179
"sdot z16.s, z2.b, z5.b\n"
180
"ld1rw { z5.s }, p0/Z, [%x[Apanel], #24]\n"
181
"sdot z17.s, z0.b, z6.b\n"
182
"sdot z18.s, z1.b, z6.b\n"
183
"sdot z19.s, z2.b, z6.b\n"
184
"ld1rw { z3.s }, p0/Z, [%x[Apanel], #28]\n"
185
"sdot z20.s, z0.b, z7.b\n"
186
"sdot z21.s, z1.b, z7.b\n"
187
"add %x[Apanel], %x[Apanel], #0x20\n"
188
"sdot z22.s, z2.b, z7.b\n"
189
"sdot z23.s, z0.b, z4.b\n"
190
"sdot z24.s, z1.b, z4.b\n"
191
"sdot z25.s, z2.b, z4.b\n"
192
"sdot z26.s, z0.b, z5.b\n"
193
"sdot z27.s, z1.b, z5.b\n"
194
"sdot z28.s, z2.b, z5.b\n"
195
"sdot z29.s, z0.b, z3.b\n"
196
"sdot z30.s, z1.b, z3.b\n"
197
"sdot z31.s, z2.b, z3.b\n"
198
"cbz x20, 5f\n"
199
"ld1b { z6.b }, p0/Z, [x22]\n"
200
"ld1b { z5.b }, p0/Z, [x22, #1, MUL VL]\n"
201
"ld1b { z4.b }, p0/Z, [x22, #2, MUL VL]\n"
202
"ld1rw { z3.s }, p0/Z, [%x[Apanel]]\n"
203
"sdot z8.s, z6.b, z3.b\n"
204
"ld1rw { z2.s }, p0/Z, [%x[Apanel], #4]\n"
205
"ld1rw { z1.s }, p0/Z, [%x[Apanel], #8]\n"
206
"sdot z9.s, z5.b, z3.b\n"
207
"ld1rw { z0.s }, p0/Z, [%x[Apanel], #12]\n"
208
"sdot z10.s, z4.b, z3.b\n"
209
"sdot z11.s, z6.b, z2.b\n"
210
"sdot z12.s, z5.b, z2.b\n"
211
"sdot z13.s, z4.b, z2.b\n"
212
"ld1rw { z3.s }, p0/Z, [%x[Apanel], #16]\n"
213
"sdot z14.s, z6.b, z1.b\n"
214
"sdot z15.s, z5.b, z1.b\n"
215
"ld1rw { z2.s }, p0/Z, [%x[Apanel], #20]\n"
216
"sdot z16.s, z4.b, z1.b\n"
217
"sdot z17.s, z6.b, z0.b\n"
218
"ld1rw { z1.s }, p0/Z, [%x[Apanel], #24]\n"
219
"sdot z18.s, z5.b, z0.b\n"
220
"sdot z19.s, z4.b, z0.b\n"
221
"ld1rw { z0.s }, p0/Z, [%x[Apanel], #28]\n"
222
"sdot z20.s, z6.b, z3.b\n"
223
"sdot z21.s, z5.b, z3.b\n"
224
"addvl x22, x22, #3\n"
225
"sdot z22.s, z4.b, z3.b\n"
226
"sdot z23.s, z6.b, z2.b\n"
227
"add %x[Apanel], %x[Apanel], #0x20\n"
228
"sdot z24.s, z5.b, z2.b\n"
229
"sdot z25.s, z4.b, z2.b\n"
230
"sdot z26.s, z6.b, z1.b\n"
231
"sdot z27.s, z5.b, z1.b\n"
232
"sdot z28.s, z4.b, z1.b\n"
233
"sdot z29.s, z6.b, z0.b\n"
234
"sdot z30.s, z5.b, z0.b\n"
235
"sdot z31.s, z4.b, z0.b\n"
236
"5:"
// multiply loop done
237
"st1w { z8.s }, p0, [%x[Cpanel]]\n"
238
"subs x23, x23, #0x1\n"
239
"st1w { z9.s }, p0, [%x[Cpanel], #1, MUL VL]\n"
240
"st1w { z10.s }, p0, [%x[Cpanel], #2, MUL VL]\n"
241
"st1w { z11.s }, p0, [%x[Cpanel], #3, MUL VL]\n"
242
"st1w { z12.s }, p0, [%x[Cpanel], #4, MUL VL]\n"
243
"st1w { z13.s }, p0, [%x[Cpanel], #5, MUL VL]\n"
244
"st1w { z14.s }, p0, [%x[Cpanel], #6, MUL VL]\n"
245
"st1w { z15.s }, p0, [%x[Cpanel], #7, MUL VL]\n"
246
"addvl %x[Cpanel], %x[Cpanel], #16\n"
247
"st1w { z16.s }, p0, [%x[Cpanel], #-8, MUL VL]\n"
248
"st1w { z17.s }, p0, [%x[Cpanel], #-7, MUL VL]\n"
249
"st1w { z18.s }, p0, [%x[Cpanel], #-6, MUL VL]\n"
250
"st1w { z19.s }, p0, [%x[Cpanel], #-5, MUL VL]\n"
251
"st1w { z20.s }, p0, [%x[Cpanel], #-4, MUL VL]\n"
252
"st1w { z21.s }, p0, [%x[Cpanel], #-3, MUL VL]\n"
253
"st1w { z22.s }, p0, [%x[Cpanel], #-2, MUL VL]\n"
254
"st1w { z23.s }, p0, [%x[Cpanel], #-1, MUL VL]\n"
255
"st1w { z24.s }, p0, [%x[Cpanel]]\n"
256
"st1w { z25.s }, p0, [%x[Cpanel], #1, MUL VL]\n"
257
"st1w { z26.s }, p0, [%x[Cpanel], #2, MUL VL]\n"
258
"st1w { z27.s }, p0, [%x[Cpanel], #3, MUL VL]\n"
259
"st1w { z28.s }, p0, [%x[Cpanel], #4, MUL VL]\n"
260
"st1w { z29.s }, p0, [%x[Cpanel], #5, MUL VL]\n"
261
"st1w { z30.s }, p0, [%x[Cpanel], #6, MUL VL]\n"
262
"st1w { z31.s }, p0, [%x[Cpanel], #7, MUL VL]\n"
263
"addvl %x[Cpanel], %x[Cpanel], #8\n"
264
"bgt 2b\n"
265
"subs %x[ablocks], %x[ablocks], #0x1\n"
266
"bne 1b\n"
267
: [Apanel]
"+&r"
(Apanel), [Cpanel]
"+&r"
(Cpanel), [ablocks]
"+&r"
(ablocks)
268
: [args_ptr]
"r"
(&ka), [offsetof_Bpanel]
"I"
(offsetof(KernelArgs, Bpanel)), [offsetof_K]
"I"
(offsetof(KernelArgs,
K
)), [offsetof_bblocks]
"I"
(offsetof(KernelArgs, bblocks))
269
:
"cc"
,
"memory"
,
"p0"
,
"x20"
,
"x21"
,
"x22"
,
"x23"
,
"z0"
,
"z1"
,
"z2"
,
"z3"
,
"z4"
,
"z5"
,
"z6"
,
"z7"
,
"z8"
,
"z9"
,
"z10"
,
"z11"
,
"z12"
,
"z13"
,
"z14"
,
"z15"
,
"z16"
,
"z17"
,
"z18"
,
"z19"
,
"z20"
,
"z21"
,
"z22"
,
"z23"
,
"z24"
,
"z25"
,
"z26"
,
"z27"
,
"z28"
,
"z29"
,
"z30"
,
"z31"
270
);
271
}
272
273
}
// namespace arm_gemm
274
#endif // ARM_COMPUTE_ENABLE_SVE
arm_gemm
Definition:
barrier.hpp:30
K
unsigned int K
Definition:
CpuGemmAssemblyDispatch.cpp:106
src
core
NEON
kernels
arm_gemm
kernels
sve_interleaved_s8s32_dot_8x3VL
a64fx.cpp
Generated on Mon Apr 29 2024 10:53:56 for Compute Library by
1.8.17