24.04
generic.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019-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_u8u32_mmla_8x3VL(
32
const
uint8_t *Apanel,
33
const
uint8_t *Bpanel,
34
uint32_t *Cpanel,
35
int
ablocks,
36
int
bblocks,
37
int
K
) {
38
39
struct
KernelArgs {
40
size_t
K
= {};
41
const
uint8_t *Bpanel = {};
42
size_t
bblocks = {};
43
} ka;
44
45
ka.K = (
K
/8) - 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 { z4.b }, p0/Z, [x22]\n"
62
"mov z10.s, #0x0\n"
63
"mov z11.s, #0x0\n"
64
"ld1rqb { z0.b }, p0/Z, [%x[Apanel]]\n"
65
"mov z12.s, #0x0\n"
66
"mov z13.s, #0x0\n"
67
"ld1rqb { z1.b }, p0/Z, [%x[Apanel], #16]\n"
68
"mov z14.s, #0x0\n"
69
"mov z15.s, #0x0\n"
70
"ld1b { z5.b }, p0/Z, [x22, #1, MUL VL]\n"
71
"mov z16.s, #0x0\n"
72
"mov z17.s, #0x0\n"
73
"ld1rqb { z2.b }, p0/Z, [%x[Apanel], #32]\n"
74
"mov z18.s, #0x0\n"
75
"mov z19.s, #0x0\n"
76
"addvl x22, x22, #2\n"
77
"mov z20.s, #0x0\n"
78
"mov z21.s, #0x0\n"
79
"add %x[Apanel], %x[Apanel], #0x30\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
"ld1rqb { z6.b }, p0/Z, [%x[Apanel]]\n"
93
".inst 0x45c49808 // ummla z8.s, z0.b, z4.b\n"
94
".inst 0x45c5980b // ummla z11.s, z0.b, z5.b\n"
95
".inst 0x45c4982e // ummla z14.s, z1.b, z4.b\n"
96
".inst 0x45c59831 // ummla z17.s, z1.b, z5.b\n"
97
"ld1b { z7.b }, p0/Z, [x22]\n"
98
".inst 0x45c49854 // ummla z20.s, z2.b, z4.b\n"
99
".inst 0x45c59857 // ummla z23.s, z2.b, z5.b\n"
100
"ld1b { z3.b }, p0/Z, [x22, #1, MUL VL]\n"
101
".inst 0x45c498da // ummla z26.s, z6.b, z4.b\n"
102
".inst 0x45c598dd // ummla z29.s, z6.b, z5.b\n"
103
"ld1b { z5.b }, p0/Z, [x22, #2, MUL VL]\n"
104
"ld1b { z4.b }, p0/Z, [x22, #3, MUL VL]\n"
105
".inst 0x45c79809 // ummla z9.s, z0.b, z7.b\n"
106
".inst 0x45c3980c // ummla z12.s, z0.b, z3.b\n"
107
".inst 0x45c7982f // ummla z15.s, z1.b, z7.b\n"
108
".inst 0x45c39832 // ummla z18.s, z1.b, z3.b\n"
109
"sub x20, x20, #0x2\n"
110
".inst 0x45c79855 // ummla z21.s, z2.b, z7.b\n"
111
".inst 0x45c39858 // ummla z24.s, z2.b, z3.b\n"
112
"cmp x20, #0x2\n"
113
".inst 0x45c798db // ummla z27.s, z6.b, z7.b\n"
114
".inst 0x45c398de // ummla z30.s, z6.b, z3.b\n"
115
"ld1b { z3.b }, p0/Z, [x22, #4, MUL VL]\n"
116
".inst 0x45c5980a // ummla z10.s, z0.b, z5.b\n"
117
".inst 0x45c4980d // ummla z13.s, z0.b, z4.b\n"
118
"ld1rqb { z0.b }, p0/Z, [%x[Apanel], #16]\n"
119
".inst 0x45c59830 // ummla z16.s, z1.b, z5.b\n"
120
".inst 0x45c49833 // ummla z19.s, z1.b, z4.b\n"
121
"ld1rqb { z1.b }, p0/Z, [%x[Apanel], #32]\n"
122
".inst 0x45c59856 // ummla z22.s, z2.b, z5.b\n"
123
".inst 0x45c49859 // ummla z25.s, z2.b, z4.b\n"
124
"ld1b { z7.b }, p0/Z, [x22, #5, MUL VL]\n"
125
".inst 0x45c598dc // ummla z28.s, z6.b, z5.b\n"
126
".inst 0x45c498df // ummla z31.s, z6.b, z4.b\n"
127
"ld1rqb { z5.b }, p0/Z, [%x[Apanel], #48]\n"
128
"ld1rqb { z6.b }, p0/Z, [%x[Apanel], #64]\n"
129
"ld1b { z2.b }, p0/Z, [x22, #6, MUL VL]\n"
130
".inst 0x45c39808 // ummla z8.s, z0.b, z3.b\n"
131
"ld1b { z4.b }, p0/Z, [x22, #7, MUL VL]\n"
132
"addvl x22, x22, #16\n"
133
".inst 0x45c7980b // ummla z11.s, z0.b, z7.b\n"
134
".inst 0x45c3982e // ummla z14.s, z1.b, z3.b\n"
135
".inst 0x45c79831 // ummla z17.s, z1.b, z7.b\n"
136
".inst 0x45c398b4 // ummla z20.s, z5.b, z3.b\n"
137
".inst 0x45c798b7 // ummla z23.s, z5.b, z7.b\n"
138
".inst 0x45c398da // ummla z26.s, z6.b, z3.b\n"
139
".inst 0x45c798dd // ummla z29.s, z6.b, z7.b\n"
140
"ld1b { z3.b }, p0/Z, [x22, #-8, MUL VL]\n"
141
"ld1b { z7.b }, p0/Z, [x22, #-7, MUL VL]\n"
142
".inst 0x45c29809 // ummla z9.s, z0.b, z2.b\n"
143
".inst 0x45c4980c // ummla z12.s, z0.b, z4.b\n"
144
".inst 0x45c2982f // ummla z15.s, z1.b, z2.b\n"
145
".inst 0x45c49832 // ummla z18.s, z1.b, z4.b\n"
146
".inst 0x45c298b5 // ummla z21.s, z5.b, z2.b\n"
147
".inst 0x45c498b8 // ummla z24.s, z5.b, z4.b\n"
148
".inst 0x45c298db // ummla z27.s, z6.b, z2.b\n"
149
".inst 0x45c498de // ummla z30.s, z6.b, z4.b\n"
150
"ld1b { z4.b }, p0/Z, [x22, #-6, MUL VL]\n"
151
".inst 0x45c3980a // ummla z10.s, z0.b, z3.b\n"
152
".inst 0x45c7980d // ummla z13.s, z0.b, z7.b\n"
153
"ld1rqb { z0.b }, p0/Z, [%x[Apanel], #80]\n"
154
".inst 0x45c39830 // ummla z16.s, z1.b, z3.b\n"
155
".inst 0x45c79833 // ummla z19.s, z1.b, z7.b\n"
156
"ld1rqb { z1.b }, p0/Z, [%x[Apanel], #96]\n"
157
".inst 0x45c398b6 // ummla z22.s, z5.b, z3.b\n"
158
".inst 0x45c798b9 // ummla z25.s, z5.b, z7.b\n"
159
"ld1b { z5.b }, p0/Z, [x22, #-5, MUL VL]\n"
160
".inst 0x45c398dc // ummla z28.s, z6.b, z3.b\n"
161
".inst 0x45c798df // ummla z31.s, z6.b, z7.b\n"
162
"ld1rqb { z2.b }, p0/Z, [%x[Apanel], #112]\n"
163
"add %x[Apanel], %x[Apanel], #0x80\n"
164
"addvl x22, x22, #-4\n"
165
"bge 3b\n"
166
"4:"
// main loop skip
167
"ld1rqb { z7.b }, p0/Z, [%x[Apanel]]\n"
168
".inst 0x45c49808 // ummla z8.s, z0.b, z4.b\n"
169
".inst 0x45c5980b // ummla z11.s, z0.b, z5.b\n"
170
".inst 0x45c4982e // ummla z14.s, z1.b, z4.b\n"
171
".inst 0x45c59831 // ummla z17.s, z1.b, z5.b\n"
172
"ld1b { z6.b }, p0/Z, [x22]\n"
173
".inst 0x45c49854 // ummla z20.s, z2.b, z4.b\n"
174
".inst 0x45c59857 // ummla z23.s, z2.b, z5.b\n"
175
"ld1b { z3.b }, p0/Z, [x22, #1, MUL VL]\n"
176
".inst 0x45c498fa // ummla z26.s, z7.b, z4.b\n"
177
".inst 0x45c598fd // ummla z29.s, z7.b, z5.b\n"
178
"ld1b { z5.b }, p0/Z, [x22, #2, MUL VL]\n"
179
"ld1b { z4.b }, p0/Z, [x22, #3, MUL VL]\n"
180
".inst 0x45c69809 // ummla z9.s, z0.b, z6.b\n"
181
".inst 0x45c3980c // ummla z12.s, z0.b, z3.b\n"
182
".inst 0x45c6982f // ummla z15.s, z1.b, z6.b\n"
183
".inst 0x45c39832 // ummla z18.s, z1.b, z3.b\n"
184
"add %x[Apanel], %x[Apanel], #0x10\n"
185
".inst 0x45c69855 // ummla z21.s, z2.b, z6.b\n"
186
".inst 0x45c39858 // ummla z24.s, z2.b, z3.b\n"
187
"addvl x22, x22, #4\n"
188
".inst 0x45c698fb // ummla z27.s, z7.b, z6.b\n"
189
".inst 0x45c398fe // ummla z30.s, z7.b, z3.b\n"
190
".inst 0x45c5980a // ummla z10.s, z0.b, z5.b\n"
191
".inst 0x45c4980d // ummla z13.s, z0.b, z4.b\n"
192
".inst 0x45c59830 // ummla z16.s, z1.b, z5.b\n"
193
".inst 0x45c49833 // ummla z19.s, z1.b, z4.b\n"
194
".inst 0x45c59856 // ummla z22.s, z2.b, z5.b\n"
195
".inst 0x45c49859 // ummla z25.s, z2.b, z4.b\n"
196
".inst 0x45c598fc // ummla z28.s, z7.b, z5.b\n"
197
".inst 0x45c498ff // ummla z31.s, z7.b, z4.b\n"
198
"cbz x20, 5f\n"
199
"ld1b { z1.b }, p0/Z, [x22]\n"
200
"ld1rqb { z7.b }, p0/Z, [%x[Apanel]]\n"
201
".inst 0x45c198e8 // ummla z8.s, z7.b, z1.b\n"
202
"ld1rqb { z6.b }, p0/Z, [%x[Apanel], #16]\n"
203
"ld1b { z0.b }, p0/Z, [x22, #1, MUL VL]\n"
204
".inst 0x45c098eb // ummla z11.s, z7.b, z0.b\n"
205
"ld1rqb { z5.b }, p0/Z, [%x[Apanel], #32]\n"
206
"ld1rqb { z4.b }, p0/Z, [%x[Apanel], #48]\n"
207
".inst 0x45c198ce // ummla z14.s, z6.b, z1.b\n"
208
".inst 0x45c098d1 // ummla z17.s, z6.b, z0.b\n"
209
".inst 0x45c198b4 // ummla z20.s, z5.b, z1.b\n"
210
"ld1b { z3.b }, p0/Z, [x22, #2, MUL VL]\n"
211
".inst 0x45c098b7 // ummla z23.s, z5.b, z0.b\n"
212
".inst 0x45c1989a // ummla z26.s, z4.b, z1.b\n"
213
"ld1b { z2.b }, p0/Z, [x22, #3, MUL VL]\n"
214
".inst 0x45c0989d // ummla z29.s, z4.b, z0.b\n"
215
"ld1b { z1.b }, p0/Z, [x22, #4, MUL VL]\n"
216
"ld1b { z0.b }, p0/Z, [x22, #5, MUL VL]\n"
217
".inst 0x45c398e9 // ummla z9.s, z7.b, z3.b\n"
218
".inst 0x45c298ec // ummla z12.s, z7.b, z2.b\n"
219
"addvl x22, x22, #6\n"
220
".inst 0x45c398cf // ummla z15.s, z6.b, z3.b\n"
221
".inst 0x45c298d2 // ummla z18.s, z6.b, z2.b\n"
222
"add %x[Apanel], %x[Apanel], #0x40\n"
223
".inst 0x45c398b5 // ummla z21.s, z5.b, z3.b\n"
224
".inst 0x45c298b8 // ummla z24.s, z5.b, z2.b\n"
225
".inst 0x45c3989b // ummla z27.s, z4.b, z3.b\n"
226
".inst 0x45c2989e // ummla z30.s, z4.b, z2.b\n"
227
".inst 0x45c198ea // ummla z10.s, z7.b, z1.b\n"
228
".inst 0x45c098ed // ummla z13.s, z7.b, z0.b\n"
229
".inst 0x45c198d0 // ummla z16.s, z6.b, z1.b\n"
230
".inst 0x45c098d3 // ummla z19.s, z6.b, z0.b\n"
231
".inst 0x45c198b6 // ummla z22.s, z5.b, z1.b\n"
232
".inst 0x45c098b9 // ummla z25.s, z5.b, z0.b\n"
233
".inst 0x45c1989c // ummla z28.s, z4.b, z1.b\n"
234
".inst 0x45c0989f // ummla z31.s, z4.b, z0.b\n"
235
"5:"
// multiply loop done
236
"uzp1 z0.d, z8.d, z11.d\n"
237
"uzp2 z8.d, z8.d, z11.d\n"
238
"st1w { z0.s }, p0, [%x[Cpanel]]\n"
239
"uzp1 z0.d, z9.d, z12.d\n"
240
"uzp2 z9.d, z9.d, z12.d\n"
241
"st1w { z0.s }, p0, [%x[Cpanel], #1, MUL VL]\n"
242
"uzp1 z0.d, z10.d, z13.d\n"
243
"uzp2 z10.d, z10.d, z13.d\n"
244
"st1w { z0.s }, p0, [%x[Cpanel], #2, MUL VL]\n"
245
"st1w { z8.s }, p0, [%x[Cpanel], #3, MUL VL]\n"
246
"uzp1 z0.d, z14.d, z17.d\n"
247
"uzp2 z14.d, z14.d, z17.d\n"
248
"st1w { z9.s }, p0, [%x[Cpanel], #4, MUL VL]\n"
249
"uzp1 z1.d, z15.d, z18.d\n"
250
"subs x23, x23, #0x1\n"
251
"st1w { z10.s }, p0, [%x[Cpanel], #5, MUL VL]\n"
252
"uzp2 z15.d, z15.d, z18.d\n"
253
"uzp1 z17.d, z16.d, z19.d\n"
254
"st1w { z0.s }, p0, [%x[Cpanel], #6, MUL VL]\n"
255
"uzp2 z16.d, z16.d, z19.d\n"
256
"uzp1 z0.d, z20.d, z23.d\n"
257
"st1w { z1.s }, p0, [%x[Cpanel], #7, MUL VL]\n"
258
"addvl %x[Cpanel], %x[Cpanel], #16\n"
259
"uzp2 z20.d, z20.d, z23.d\n"
260
"st1w { z17.s }, p0, [%x[Cpanel], #-8, MUL VL]\n"
261
"uzp1 z23.d, z21.d, z24.d\n"
262
"uzp2 z21.d, z21.d, z24.d\n"
263
"st1w { z14.s }, p0, [%x[Cpanel], #-7, MUL VL]\n"
264
"uzp1 z19.d, z22.d, z25.d\n"
265
"uzp2 z22.d, z22.d, z25.d\n"
266
"st1w { z15.s }, p0, [%x[Cpanel], #-6, MUL VL]\n"
267
"uzp1 z18.d, z26.d, z29.d\n"
268
"uzp2 z26.d, z26.d, z29.d\n"
269
"st1w { z16.s }, p0, [%x[Cpanel], #-5, MUL VL]\n"
270
"uzp1 z17.d, z27.d, z30.d\n"
271
"uzp2 z27.d, z27.d, z30.d\n"
272
"st1w { z0.s }, p0, [%x[Cpanel], #-4, MUL VL]\n"
273
"uzp1 z16.d, z28.d, z31.d\n"
274
"uzp2 z28.d, z28.d, z31.d\n"
275
"st1w { z23.s }, p0, [%x[Cpanel], #-3, MUL VL]\n"
276
"st1w { z19.s }, p0, [%x[Cpanel], #-2, MUL VL]\n"
277
"st1w { z20.s }, p0, [%x[Cpanel], #-1, MUL VL]\n"
278
"st1w { z21.s }, p0, [%x[Cpanel]]\n"
279
"st1w { z22.s }, p0, [%x[Cpanel], #1, MUL VL]\n"
280
"st1w { z18.s }, p0, [%x[Cpanel], #2, MUL VL]\n"
281
"st1w { z17.s }, p0, [%x[Cpanel], #3, MUL VL]\n"
282
"st1w { z16.s }, p0, [%x[Cpanel], #4, MUL VL]\n"
283
"st1w { z26.s }, p0, [%x[Cpanel], #5, MUL VL]\n"
284
"st1w { z27.s }, p0, [%x[Cpanel], #6, MUL VL]\n"
285
"st1w { z28.s }, p0, [%x[Cpanel], #7, MUL VL]\n"
286
"addvl %x[Cpanel], %x[Cpanel], #8\n"
287
"bgt 2b\n"
288
"subs %x[ablocks], %x[ablocks], #0x1\n"
289
"bne 1b\n"
290
: [Apanel]
"+&r"
(Apanel), [Cpanel]
"+&r"
(Cpanel), [ablocks]
"+&r"
(ablocks)
291
: [args_ptr]
"r"
(&ka), [offsetof_Bpanel]
"I"
(offsetof(KernelArgs, Bpanel)), [offsetof_K]
"I"
(offsetof(KernelArgs,
K
)), [offsetof_bblocks]
"I"
(offsetof(KernelArgs, bblocks))
292
:
"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"
293
);
294
}
295
296
}
// namespace arm_gemm
297
#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_u8u32_mmla_8x3VL
generic.cpp
Generated on Mon Apr 29 2024 10:53:55 for Compute Library by
1.8.17