24.04
sme_interleave2VL_block4_s8_s8.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022-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
25
#if defined(ARM_COMPUTE_ENABLE_SME)
26
27
template
<>
28
void
interleave_block<2, 4, VLType::SME, false>(
29
int8_t * &out,
const
int8_t *
const
*in,
30
size_t
width,
size_t
height,
size_t
row_offset,
bool
31
)
32
{
33
__asm__ __volatile__(
34
".inst 0xd503477f // SMSTART ZA\n"
35
"cntb x21\n"
36
"mov x23, %x[width]\n"
37
"incb x23\n"
38
"mov x20, %x[width]\n"
39
"sub x17, x21, #0x1\n"
40
"cntw x16\n"
41
"sub x23, x23, #0x1\n"
42
"ands x17, x20, x17\n"
43
"udiv x23, x23, x21\n"
// n_passes = ceildiv(width, VL<T>)
44
"csel x17, x17, x21, NE\n"
45
"lsl x22, %x[height], #0x1\n"
// height * 2
46
"lsl x21, x16, #0x1\n"
47
"sub x20, x23, #0x1\n"
48
"add x17, x17, #0x3\n"
49
"sub x15, x16, #0x2\n"
50
"whilelt p9.b, XZR, x22\n"
51
"whilelt p8.b, x21, x22\n"
52
"mov x14, #0x0\n"
53
"mov x11, %x[in]\n"
54
"add x10, %x[in], x16, LSL #3\n"
55
"ldr x9, [x11, #0x0]\n"
56
"cntw x28, ALL, MUL #2\n"
57
"cntw x27, ALL, MUL #3\n"
58
"ldr x26, [x10, #0x0]\n"
59
"lsr x20, x20, #0x1\n"
// n_loops = (n_passes - 1) / 2
60
"and x25, x23, #0x1\n"
// odd_tail = bool(n_passes & 0x1)
61
"ldr x24, [x11, #0x8]\n"
62
"lsr x17, x17, #0x2\n"
63
"ptrue p11.s\n"
64
"ldr x23, [x10, #0x8]\n"
65
"zip1 p10.b, p9.b, p8.b\n"
66
"mov x22, %x[row_offset]\n"
67
"mov x21, %x[out]\n"
68
"whilelt p9.b, x14, %x[width]\n"
69
"whilelt p8.b, x14, %x[width]\n"
70
"add x11, x11, #0x10\n"
71
"add x10, x10, #0x10\n"
72
"mov x12, #0x0\n"
73
"cbz x15, 2f\n"
74
"1:"
// K loop: Charge: Loop
75
".inst 0x25246140 // psel p0.b, p8.b/Z, p10.b[w12]\n"
76
".inst 0xe0160120 // ld1b { za0h.b[x12] }, p0/Z, [x9, x22]\n"
77
".inst 0x252c6140 // psel p0.b, p8.b/Z, p10.b[w12, #1]\n"
78
"ldr x9, [x11, #0x0]\n"
79
".inst 0xe0160341 // ld1b { za0h.b[x12, #1] }, p0/Z, [x26, x22]\n"
80
".inst 0x25646141 // psel p1.b, p8.b/Z, p10.b[w12, #4]\n"
81
".inst 0x256c6140 // psel p0.b, p8.b/Z, p10.b[w12, #5]\n"
82
"ldr x26, [x10, #0x0]\n"
83
".inst 0xe0160704 // ld1b { za0h.b[x12, #4] }, p1/Z, [x24, x22]\n"
84
"ldr x24, [x11, #0x8]\n"
85
"add x11, x11, #0x10\n"
86
".inst 0xe01602e5 // ld1b { za0h.b[x12, #5] }, p0/Z, [x23, x22]\n"
87
"add x12, x12, #0x8\n"
88
"cmp x12, x15, LSL #2\n"
89
"ldr x23, [x10, #0x8]\n"
90
"add x10, x10, #0x10\n"
91
"blt 1b\n"
92
"2:"
// K loop: Charge: End
93
".inst 0x25246140 // psel p0.b, p8.b/Z, p10.b[w12]\n"
94
".inst 0xe0160120 // ld1b { za0h.b[x12] }, p0/Z, [x9, x22]\n"
95
".inst 0x252c6140 // psel p0.b, p8.b/Z, p10.b[w12, #1]\n"
96
".inst 0xe0160341 // ld1b { za0h.b[x12, #1] }, p0/Z, [x26, x22]\n"
97
".inst 0x25646141 // psel p1.b, p8.b/Z, p10.b[w12, #4]\n"
98
".inst 0x256c6140 // psel p0.b, p8.b/Z, p10.b[w12, #5]\n"
99
".inst 0xe0160704 // ld1b { za0h.b[x12, #4] }, p1/Z, [x24, x22]\n"
100
"mov x11, %x[in]\n"
101
"add x10, %x[in], x16, LSL #3\n"
102
"ldr x9, [x11, #0x0]\n"
103
".inst 0xe01602e5 // ld1b { za0h.b[x12, #5] }, p0/Z, [x23, x22]\n"
104
"ldr x26, [x10, #0x0]\n"
105
"incb x22\n"
106
"incb x14\n"
107
"ldr x24, [x11, #0x8]\n"
108
"add x11, x11, #0x10\n"
109
"ldr x23, [x10, #0x8]\n"
110
"add x10, x10, #0x10\n"
111
"cbz x20, 8f\n"
112
"mov x20, x20\n"
113
"3:"
// K loop: Main loop
114
"whilelt p8.b, x14, %x[width]\n"
115
"mov x13, #0x0\n"
116
"mov x12, #0x0\n"
117
"cbz x15, 5f\n"
118
"4:"
// K loop: Main loop: First: Loop
119
".inst 0x25356140 // psel p0.b, p8.b/Z, p10.b[w13, #2]\n"
120
".inst 0xe0162122 // ld1b { za0h.b[x13, #2] }, p0/Z, [x9, x22]\n"
121
".inst 0x253d6140 // psel p0.b, p8.b/Z, p10.b[w13, #3]\n"
122
"ldr x9, [x11, #0x0]\n"
123
".inst 0xe0162343 // ld1b { za0h.b[x13, #3] }, p0/Z, [x26, x22]\n"
124
".inst 0x25756140 // psel p0.b, p8.b/Z, p10.b[w13, #6]\n"
125
".inst 0x257d6142 // psel p2.b, p8.b/Z, p10.b[w13, #7]\n"
126
"ldr x26, [x10, #0x0]\n"
127
".inst 0xe0162306 // ld1b { za0h.b[x13, #6] }, p0/Z, [x24, x22]\n"
128
".inst 0x25306d21 // psel p1.s, p11.s/Z, p9.s[w12]\n"
129
"ldr x24, [x11, #0x8]\n"
130
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
131
".inst 0xe0162ae7 // ld1b { za0h.b[x13, #7] }, p2/Z, [x23, x22]\n"
132
"ldr x23, [x10, #0x8]\n"
133
".inst 0xe0bf86a0 // st1w { za0v.s[x12] }, p1/Z, [x21, XZR, LSL #2]\n"
134
".inst 0x25706d21 // psel p1.s, p11.s/Z, p9.s[w12, #1]\n"
135
".inst 0xe0b082a4 // st1w { za1v.s[x12] }, p0/Z, [x21, x16, LSL #2]\n"
136
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
137
"add x11, x11, #0x10\n"
138
".inst 0xe0bc86a1 // st1w { za0v.s[x12, #1] }, p1/Z, [x21, x28, LSL #2]\n"
139
"add x10, x10, #0x10\n"
140
"add x13, x13, #0x8\n"
141
".inst 0xe0bb82a5 // st1w { za1v.s[x12, #1] }, p0/Z, [x21, x27, LSL #2]\n"
142
"add x12, x12, #0x2\n"
143
"cmp x12, x15\n"
144
"addvl x21, x21, #4\n"
145
"blt 4b\n"
146
"5:"
// K loop: Main loop: First: Tail
147
".inst 0x25356140 // psel p0.b, p8.b/Z, p10.b[w13, #2]\n"
148
".inst 0xe0162122 // ld1b { za0h.b[x13, #2] }, p0/Z, [x9, x22]\n"
149
".inst 0x253d6140 // psel p0.b, p8.b/Z, p10.b[w13, #3]\n"
150
".inst 0xe0162343 // ld1b { za0h.b[x13, #3] }, p0/Z, [x26, x22]\n"
151
".inst 0x25756140 // psel p0.b, p8.b/Z, p10.b[w13, #6]\n"
152
"mov x11, %x[in]\n"
153
"ldr x9, [x11, #0x0]\n"
154
".inst 0xe0162306 // ld1b { za0h.b[x13, #6] }, p0/Z, [x24, x22]\n"
155
"add x10, %x[in], x16, LSL #3\n"
156
".inst 0x257d6141 // psel p1.b, p8.b/Z, p10.b[w13, #7]\n"
157
"ldr x26, [x10, #0x0]\n"
158
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
159
".inst 0xe01626e7 // ld1b { za0h.b[x13, #7] }, p1/Z, [x23, x22]\n"
160
"ldr x24, [x11, #0x8]\n"
161
".inst 0x25306d22 // psel p2.s, p11.s/Z, p9.s[w12]\n"
162
"ldr x23, [x10, #0x8]\n"
163
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
164
".inst 0x25706d21 // psel p1.s, p11.s/Z, p9.s[w12, #1]\n"
165
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
166
".inst 0xe0b08aa4 // st1w { za1v.s[x12] }, p2/Z, [x21, x16, LSL #2]\n"
167
"whilelt p9.b, x14, %x[width]\n"
168
"incb x14\n"
169
".inst 0xe0bc86a1 // st1w { za0v.s[x12, #1] }, p1/Z, [x21, x28, LSL #2]\n"
170
"add x11, x11, #0x10\n"
171
"add x10, x10, #0x10\n"
172
".inst 0xe0bb82a5 // st1w { za1v.s[x12, #1] }, p0/Z, [x21, x27, LSL #2]\n"
173
"addvl x21, x21, #4\n"
174
"incb x22\n"
175
"whilelt p8.b, x14, %x[width]\n"
176
"mov x13, #0x0\n"
177
"mov x12, #0x0\n"
178
"cbz x15, 7f\n"
179
"6:"
// K loop: Main loop: Second: Loop
180
".inst 0x25256140 // psel p0.b, p8.b/Z, p10.b[w13]\n"
181
".inst 0xe0162120 // ld1b { za0h.b[x13] }, p0/Z, [x9, x22]\n"
182
".inst 0x252d6140 // psel p0.b, p8.b/Z, p10.b[w13, #1]\n"
183
"ldr x9, [x11, #0x0]\n"
184
".inst 0xe0162341 // ld1b { za0h.b[x13, #1] }, p0/Z, [x26, x22]\n"
185
".inst 0x25656140 // psel p0.b, p8.b/Z, p10.b[w13, #4]\n"
186
".inst 0x256d6142 // psel p2.b, p8.b/Z, p10.b[w13, #5]\n"
187
"ldr x26, [x10, #0x0]\n"
188
".inst 0xe0162304 // ld1b { za0h.b[x13, #4] }, p0/Z, [x24, x22]\n"
189
".inst 0x25306d21 // psel p1.s, p11.s/Z, p9.s[w12]\n"
190
"ldr x24, [x11, #0x8]\n"
191
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
192
".inst 0xe0162ae5 // ld1b { za0h.b[x13, #5] }, p2/Z, [x23, x22]\n"
193
"ldr x23, [x10, #0x8]\n"
194
".inst 0xe0bf86a8 // st1w { za2v.s[x12] }, p1/Z, [x21, XZR, LSL #2]\n"
195
".inst 0x25706d21 // psel p1.s, p11.s/Z, p9.s[w12, #1]\n"
196
".inst 0xe0b082ac // st1w { za3v.s[x12] }, p0/Z, [x21, x16, LSL #2]\n"
197
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
198
"add x11, x11, #0x10\n"
199
".inst 0xe0bc86a9 // st1w { za2v.s[x12, #1] }, p1/Z, [x21, x28, LSL #2]\n"
200
"add x10, x10, #0x10\n"
201
"add x13, x13, #0x8\n"
202
".inst 0xe0bb82ad // st1w { za3v.s[x12, #1] }, p0/Z, [x21, x27, LSL #2]\n"
203
"add x12, x12, #0x2\n"
204
"cmp x12, x15\n"
205
"addvl x21, x21, #4\n"
206
"blt 6b\n"
207
"7:"
// K loop: Main loop: Second: Tail
208
".inst 0x25256140 // psel p0.b, p8.b/Z, p10.b[w13]\n"
209
".inst 0xe0162120 // ld1b { za0h.b[x13] }, p0/Z, [x9, x22]\n"
210
".inst 0x252d6140 // psel p0.b, p8.b/Z, p10.b[w13, #1]\n"
211
".inst 0xe0162341 // ld1b { za0h.b[x13, #1] }, p0/Z, [x26, x22]\n"
212
".inst 0x25656140 // psel p0.b, p8.b/Z, p10.b[w13, #4]\n"
213
"mov x11, %x[in]\n"
214
"ldr x9, [x11, #0x0]\n"
215
".inst 0xe0162304 // ld1b { za0h.b[x13, #4] }, p0/Z, [x24, x22]\n"
216
"add x10, %x[in], x16, LSL #3\n"
217
".inst 0x256d6141 // psel p1.b, p8.b/Z, p10.b[w13, #5]\n"
218
"ldr x26, [x10, #0x0]\n"
219
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
220
".inst 0xe01626e5 // ld1b { za0h.b[x13, #5] }, p1/Z, [x23, x22]\n"
221
"ldr x24, [x11, #0x8]\n"
222
".inst 0x25306d22 // psel p2.s, p11.s/Z, p9.s[w12]\n"
223
"ldr x23, [x10, #0x8]\n"
224
".inst 0xe0bf82a8 // st1w { za2v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
225
".inst 0x25706d21 // psel p1.s, p11.s/Z, p9.s[w12, #1]\n"
226
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
227
".inst 0xe0b08aac // st1w { za3v.s[x12] }, p2/Z, [x21, x16, LSL #2]\n"
228
"whilelt p9.b, x14, %x[width]\n"
229
"subs x20, x20, #0x1\n"
230
".inst 0xe0bc86a9 // st1w { za2v.s[x12, #1] }, p1/Z, [x21, x28, LSL #2]\n"
231
"add x11, x11, #0x10\n"
232
"add x10, x10, #0x10\n"
233
".inst 0xe0bb82ad // st1w { za3v.s[x12, #1] }, p0/Z, [x21, x27, LSL #2]\n"
234
"addvl x21, x21, #4\n"
235
"incb x14\n"
236
"incb x22\n"
237
"bgt 3b\n"
238
"8:"
// K loop: Tails
239
"cbnz x25, 11f\n"
240
"mov x11, %x[in]\n"
241
"whilelt p8.b, x14, %x[width]\n"
242
"mov x13, #0x0\n"
243
"mov x12, #0x0\n"
244
"9:"
// K loop: Tails: Even: First
245
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
246
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
247
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
248
".inst 0xe0b082a4 // st1w { za1v.s[x12] }, p0/Z, [x21, x16, LSL #2]\n"
249
"ldr x20, [x11, #0x0]\n"
250
".inst 0x25356140 // psel p0.b, p8.b/Z, p10.b[w13, #2]\n"
251
".inst 0xe0162282 // ld1b { za0h.b[x13, #2] }, p0/Z, [x20, x22]\n"
252
"ldr x20, [x11, x16, LSL #0x3]\n"
253
"add x12, x12, #0x1\n"
254
".inst 0x253d6140 // psel p0.b, p8.b/Z, p10.b[w13, #3]\n"
255
".inst 0xe0162283 // ld1b { za0h.b[x13, #3] }, p0/Z, [x20, x22]\n"
256
"cmp x12, x16\n"
257
"add x11, x11, #0x8\n"
258
"addvl x21, x21, #2\n"
259
"add x13, x13, #0x4\n"
260
"blt 9b\n"
261
"whilelt p9.b, x14, %x[width]\n"
262
"whilelt p8.b, x14, %x[width]\n"
263
"mov x20, #0x0\n"
264
"mov x12, #0x0\n"
265
"10:"
// K loop: Tails: Even: Second
266
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
267
".inst 0xe0bf82a8 // st1w { za2v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
268
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
269
".inst 0xe0b082ac // st1w { za3v.s[x12] }, p0/Z, [x21, x16, LSL #2]\n"
270
"add x12, x12, #0x1\n"
271
"cmp x12, x17\n"
272
"addvl x21, x21, #2\n"
273
"add x20, x20, #0x4\n"
274
"blt 10b\n"
275
"whilelt p8.b, x14, %x[width]\n"
276
"b 13f\n"
277
"11:"
// K loop: Tails: Odd
278
"mov x12, #0x0\n"
279
"12:"
// K loop: Tails: Odd: Loop
280
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
281
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
282
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
283
".inst 0xe0b082a4 // st1w { za1v.s[x12] }, p0/Z, [x21, x16, LSL #2]\n"
284
"add x12, x12, #0x1\n"
285
"cmp x12, x17\n"
286
"addvl x21, x21, #2\n"
287
"blt 12b\n"
288
"13:"
// K loop: End
289
"mov %x[out], x21\n"
290
".inst 0xd503467f // SMSTOP\n"
291
: [out]
"+&r"
(out)
292
: [height]
"r"
(height), [in]
"r"
(in), [row_offset]
"r"
(row_offset), [width]
"r"
(width)
293
:
"cc"
,
"memory"
,
"p0"
,
"p1"
,
"p2"
,
"p3"
,
"p4"
,
"p5"
,
"p6"
,
"p7"
,
"p8"
,
"p9"
,
"p10"
,
"p11"
,
"p12"
,
"p13"
,
"p14"
,
"p15"
,
"x9"
,
"x10"
,
"x11"
,
"x12"
,
"x13"
,
"x14"
,
"x15"
,
"x16"
,
"x17"
,
"x20"
,
"x21"
,
"x22"
,
"x23"
,
"x24"
,
"x25"
,
"x26"
,
"x27"
,
"x28"
,
"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"
294
);
295
}
296
297
#endif // defined(ARM_COMPUTE_ENABLE_SME)
src
core
NEON
kernels
arm_gemm
indirect-interleaves
sme_interleave2VL_block4_s8_s8.hpp
Generated on Mon Apr 29 2024 10:53:55 for Compute Library by
1.8.17