24.04
sme_interleave2VL_fp32_fp32.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, 1, VLType::SME, false>(
29
float
* &out,
const
float
*
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
"mov x22, %x[width]\n"
36
"incw x22\n"
37
"cntw x16\n"
38
"sub x22, x22, #0x1\n"
39
"udiv x22, x22, x16\n"
// n_passes = ceildiv(width, VL<T>)
40
"mov x21, %x[width]\n"
41
"sub x15, x16, #0x1\n"
42
"sub x20, x22, #0x1\n"
43
"ands x15, x21, x15\n"
44
"sub x14, x16, #0x2\n"
45
"mov x13, #0x0\n"
46
"mov x11, %x[in]\n"
47
"ldr x10, [x11, #0x0]\n"
48
"add x9, %x[in], x16, LSL #3\n"
49
"cntw x28, ALL, MUL #2\n"
50
"ldr x27, [x9, #0x0]\n"
51
"cntw x26, ALL, MUL #3\n"
52
"lsr x20, x20, #0x1\n"
// n_loops = (n_passes - 1) / 2
53
"ldr x25, [x11, #0x8]\n"
54
"and x24, x22, #0x1\n"
// odd_tail = bool(n_passes & 0x1)
55
"csel x15, x15, x16, NE\n"
56
"ldr x21, [x9, #0x8]\n"
57
"ptrue p13.s\n"
58
"whilelt p12.s, XZR, %x[height]\n"
59
"whilelt p11.s, x16, %x[height]\n"
60
"mov x23, %x[row_offset]\n"
61
"mov x22, %x[out]\n"
62
"whilelt p10.s, x13, %x[width]\n"
63
"whilelt p9.s, x13, %x[width]\n"
64
"whilelt p8.s, x13, %x[width]\n"
65
"add x11, x11, #0x10\n"
66
"add x9, x9, #0x10\n"
67
"mov x12, #0x0\n"
68
"cbz x14, 2f\n"
69
"1:"
// K loop: Charge: Loop
70
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
71
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
72
".inst 0xe0970540 // ld1w { za0h.s[x12] }, p1/Z, [x10, x23, LSL #2]\n"
73
"ldr x10, [x11, #0x0]\n"
74
".inst 0xe0970364 // ld1w { za1h.s[x12] }, p0/Z, [x27, x23, LSL #2]\n"
75
".inst 0x25706581 // psel p1.s, p9.s/Z, p12.s[w12, #1]\n"
76
".inst 0x25706160 // psel p0.s, p8.s/Z, p11.s[w12, #1]\n"
77
"ldr x27, [x9, #0x0]\n"
78
".inst 0xe0970721 // ld1w { za0h.s[x12, #1] }, p1/Z, [x25, x23, LSL #2]\n"
79
"ldr x25, [x11, #0x8]\n"
80
"add x11, x11, #0x10\n"
81
".inst 0xe09702a5 // ld1w { za1h.s[x12, #1] }, p0/Z, [x21, x23, LSL #2]\n"
82
"add x12, x12, #0x2\n"
83
"cmp x12, x14\n"
84
"ldr x21, [x9, #0x8]\n"
85
"add x9, x9, #0x10\n"
86
"blt 1b\n"
87
"2:"
// K loop: Charge: End
88
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
89
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
90
".inst 0xe0970540 // ld1w { za0h.s[x12] }, p1/Z, [x10, x23, LSL #2]\n"
91
".inst 0xe0970364 // ld1w { za1h.s[x12] }, p0/Z, [x27, x23, LSL #2]\n"
92
".inst 0x25706581 // psel p1.s, p9.s/Z, p12.s[w12, #1]\n"
93
".inst 0x25706160 // psel p0.s, p8.s/Z, p11.s[w12, #1]\n"
94
"mov x11, %x[in]\n"
95
"add x9, %x[in], x16, LSL #3\n"
96
".inst 0xe0970721 // ld1w { za0h.s[x12, #1] }, p1/Z, [x25, x23, LSL #2]\n"
97
"ldr x10, [x11, #0x0]\n"
98
".inst 0xe09702a5 // ld1w { za1h.s[x12, #1] }, p0/Z, [x21, x23, LSL #2]\n"
99
"ldr x27, [x9, #0x0]\n"
100
"incw x23\n"
101
"incw x13\n"
102
"ldr x25, [x11, #0x8]\n"
103
"add x11, x11, #0x10\n"
104
"ldr x21, [x9, #0x8]\n"
105
"add x9, x9, #0x10\n"
106
"cbz x20, 8f\n"
107
"mov x20, x20\n"
108
"3:"
// K loop: Main loop
109
"whilelt p9.s, x13, %x[width]\n"
110
"whilelt p8.s, x13, %x[width]\n"
111
"mov x12, #0x0\n"
112
"cbz x14, 5f\n"
113
"4:"
// K loop: Main loop: First: Loop
114
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
115
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
116
".inst 0xe0970548 // ld1w { za2h.s[x12] }, p1/Z, [x10, x23, LSL #2]\n"
117
"ldr x10, [x11, #0x0]\n"
118
".inst 0xe097036c // ld1w { za3h.s[x12] }, p0/Z, [x27, x23, LSL #2]\n"
119
".inst 0x25706580 // psel p0.s, p9.s/Z, p12.s[w12, #1]\n"
120
".inst 0x25706162 // psel p2.s, p8.s/Z, p11.s[w12, #1]\n"
121
"ldr x27, [x9, #0x0]\n"
122
".inst 0x25307541 // psel p1.s, p13.s/Z, p10.s[w12]\n"
123
".inst 0xe0970329 // ld1w { za2h.s[x12, #1] }, p0/Z, [x25, x23, LSL #2]\n"
124
"ldr x25, [x11, #0x8]\n"
125
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
126
".inst 0xe0970aad // ld1w { za3h.s[x12, #1] }, p2/Z, [x21, x23, LSL #2]\n"
127
"ldr x21, [x9, #0x8]\n"
128
".inst 0xe0bf86c0 // st1w { za0v.s[x12] }, p1/Z, [x22, XZR, LSL #2]\n"
129
".inst 0x25707541 // psel p1.s, p13.s/Z, p10.s[w12, #1]\n"
130
".inst 0xe0b082c4 // st1w { za1v.s[x12] }, p0/Z, [x22, x16, LSL #2]\n"
131
".inst 0x25707540 // psel p0.s, p13.s/Z, p10.s[w12, #1]\n"
132
"add x11, x11, #0x10\n"
133
".inst 0xe0bc86c1 // st1w { za0v.s[x12, #1] }, p1/Z, [x22, x28, LSL #2]\n"
134
"add x9, x9, #0x10\n"
135
".inst 0xe0ba82c5 // st1w { za1v.s[x12, #1] }, p0/Z, [x22, x26, LSL #2]\n"
136
"add x12, x12, #0x2\n"
137
"cmp x12, x14\n"
138
"addvl x22, x22, #4\n"
139
"blt 4b\n"
140
"5:"
// K loop: Main loop: First: Tail
141
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
142
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
143
".inst 0xe0970548 // ld1w { za2h.s[x12] }, p1/Z, [x10, x23, LSL #2]\n"
144
".inst 0xe097036c // ld1w { za3h.s[x12] }, p0/Z, [x27, x23, LSL #2]\n"
145
"mov x11, %x[in]\n"
146
"add x9, %x[in], x16, LSL #3\n"
147
"ldr x10, [x11, #0x0]\n"
148
".inst 0x25706580 // psel p0.s, p9.s/Z, p12.s[w12, #1]\n"
149
".inst 0x25706161 // psel p1.s, p8.s/Z, p11.s[w12, #1]\n"
150
".inst 0xe0970329 // ld1w { za2h.s[x12, #1] }, p0/Z, [x25, x23, LSL #2]\n"
151
"ldr x27, [x9, #0x0]\n"
152
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
153
".inst 0xe09706ad // ld1w { za3h.s[x12, #1] }, p1/Z, [x21, x23, LSL #2]\n"
154
"ldr x25, [x11, #0x8]\n"
155
".inst 0x25307542 // psel p2.s, p13.s/Z, p10.s[w12]\n"
156
"ldr x21, [x9, #0x8]\n"
157
".inst 0xe0bf82c0 // st1w { za0v.s[x12] }, p0/Z, [x22, XZR, LSL #2]\n"
158
".inst 0x25707541 // psel p1.s, p13.s/Z, p10.s[w12, #1]\n"
159
".inst 0x25707540 // psel p0.s, p13.s/Z, p10.s[w12, #1]\n"
160
".inst 0xe0b08ac4 // st1w { za1v.s[x12] }, p2/Z, [x22, x16, LSL #2]\n"
161
"whilelt p10.s, x13, %x[width]\n"
162
"incw x13\n"
163
".inst 0xe0bc86c1 // st1w { za0v.s[x12, #1] }, p1/Z, [x22, x28, LSL #2]\n"
164
"add x11, x11, #0x10\n"
165
"add x9, x9, #0x10\n"
166
".inst 0xe0ba82c5 // st1w { za1v.s[x12, #1] }, p0/Z, [x22, x26, LSL #2]\n"
167
"addvl x22, x22, #4\n"
168
"incw x23\n"
169
"whilelt p9.s, x13, %x[width]\n"
170
"whilelt p8.s, x13, %x[width]\n"
171
"mov x12, #0x0\n"
172
"cbz x14, 7f\n"
173
"6:"
// K loop: Main loop: Second: Loop
174
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
175
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
176
".inst 0xe0970540 // ld1w { za0h.s[x12] }, p1/Z, [x10, x23, LSL #2]\n"
177
"ldr x10, [x11, #0x0]\n"
178
".inst 0xe0970364 // ld1w { za1h.s[x12] }, p0/Z, [x27, x23, LSL #2]\n"
179
".inst 0x25706580 // psel p0.s, p9.s/Z, p12.s[w12, #1]\n"
180
".inst 0x25706162 // psel p2.s, p8.s/Z, p11.s[w12, #1]\n"
181
"ldr x27, [x9, #0x0]\n"
182
".inst 0x25307541 // psel p1.s, p13.s/Z, p10.s[w12]\n"
183
".inst 0xe0970321 // ld1w { za0h.s[x12, #1] }, p0/Z, [x25, x23, LSL #2]\n"
184
"ldr x25, [x11, #0x8]\n"
185
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
186
".inst 0xe0970aa5 // ld1w { za1h.s[x12, #1] }, p2/Z, [x21, x23, LSL #2]\n"
187
"ldr x21, [x9, #0x8]\n"
188
".inst 0xe0bf86c8 // st1w { za2v.s[x12] }, p1/Z, [x22, XZR, LSL #2]\n"
189
".inst 0x25707541 // psel p1.s, p13.s/Z, p10.s[w12, #1]\n"
190
".inst 0xe0b082cc // st1w { za3v.s[x12] }, p0/Z, [x22, x16, LSL #2]\n"
191
".inst 0x25707540 // psel p0.s, p13.s/Z, p10.s[w12, #1]\n"
192
"add x11, x11, #0x10\n"
193
".inst 0xe0bc86c9 // st1w { za2v.s[x12, #1] }, p1/Z, [x22, x28, LSL #2]\n"
194
"add x9, x9, #0x10\n"
195
".inst 0xe0ba82cd // st1w { za3v.s[x12, #1] }, p0/Z, [x22, x26, LSL #2]\n"
196
"add x12, x12, #0x2\n"
197
"cmp x12, x14\n"
198
"addvl x22, x22, #4\n"
199
"blt 6b\n"
200
"7:"
// K loop: Main loop: Second: Tail
201
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
202
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
203
".inst 0xe0970540 // ld1w { za0h.s[x12] }, p1/Z, [x10, x23, LSL #2]\n"
204
".inst 0xe0970364 // ld1w { za1h.s[x12] }, p0/Z, [x27, x23, LSL #2]\n"
205
"mov x11, %x[in]\n"
206
"add x9, %x[in], x16, LSL #3\n"
207
"ldr x10, [x11, #0x0]\n"
208
".inst 0x25706580 // psel p0.s, p9.s/Z, p12.s[w12, #1]\n"
209
".inst 0x25706161 // psel p1.s, p8.s/Z, p11.s[w12, #1]\n"
210
".inst 0xe0970321 // ld1w { za0h.s[x12, #1] }, p0/Z, [x25, x23, LSL #2]\n"
211
"ldr x27, [x9, #0x0]\n"
212
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
213
".inst 0xe09706a5 // ld1w { za1h.s[x12, #1] }, p1/Z, [x21, x23, LSL #2]\n"
214
"ldr x25, [x11, #0x8]\n"
215
".inst 0x25307542 // psel p2.s, p13.s/Z, p10.s[w12]\n"
216
"ldr x21, [x9, #0x8]\n"
217
".inst 0xe0bf82c8 // st1w { za2v.s[x12] }, p0/Z, [x22, XZR, LSL #2]\n"
218
".inst 0x25707541 // psel p1.s, p13.s/Z, p10.s[w12, #1]\n"
219
".inst 0x25707540 // psel p0.s, p13.s/Z, p10.s[w12, #1]\n"
220
".inst 0xe0b08acc // st1w { za3v.s[x12] }, p2/Z, [x22, x16, LSL #2]\n"
221
"whilelt p10.s, x13, %x[width]\n"
222
"subs x20, x20, #0x1\n"
223
".inst 0xe0bc86c9 // st1w { za2v.s[x12, #1] }, p1/Z, [x22, x28, LSL #2]\n"
224
"add x11, x11, #0x10\n"
225
"add x9, x9, #0x10\n"
226
".inst 0xe0ba82cd // st1w { za3v.s[x12, #1] }, p0/Z, [x22, x26, LSL #2]\n"
227
"addvl x22, x22, #4\n"
228
"incw x13\n"
229
"incw x23\n"
230
"bgt 3b\n"
231
"8:"
// K loop: Tails
232
"cbnz x24, 11f\n"
233
"mov x11, %x[in]\n"
234
"whilelt p9.s, x13, %x[width]\n"
235
"whilelt p8.s, x13, %x[width]\n"
236
"mov x12, #0x0\n"
237
"9:"
// K loop: Tails: Even: First
238
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
239
".inst 0xe0bf82c0 // st1w { za0v.s[x12] }, p0/Z, [x22, XZR, LSL #2]\n"
240
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
241
".inst 0xe0b082c4 // st1w { za1v.s[x12] }, p0/Z, [x22, x16, LSL #2]\n"
242
"ldr x21, [x11, #0x0]\n"
243
".inst 0x25306581 // psel p1.s, p9.s/Z, p12.s[w12]\n"
244
".inst 0x25306160 // psel p0.s, p8.s/Z, p11.s[w12]\n"
245
"ldr x20, [x11, x16, LSL #0x3]\n"
246
".inst 0xe09706a8 // ld1w { za2h.s[x12] }, p1/Z, [x21, x23, LSL #2]\n"
247
"add x11, x11, #0x8\n"
248
"addvl x22, x22, #2\n"
249
".inst 0xe097028c // ld1w { za3h.s[x12] }, p0/Z, [x20, x23, LSL #2]\n"
250
"add x12, x12, #0x1\n"
251
"cmp x12, x16\n"
252
"blt 9b\n"
253
"whilelt p10.s, x13, %x[width]\n"
254
"whilelt p8.s, x13, %x[width]\n"
255
"whilelt p8.s, x13, %x[width]\n"
256
"mov x12, #0x0\n"
257
"10:"
// K loop: Tails: Even: Second
258
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
259
".inst 0xe0bf82c8 // st1w { za2v.s[x12] }, p0/Z, [x22, XZR, LSL #2]\n"
260
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
261
".inst 0xe0b082cc // st1w { za3v.s[x12] }, p0/Z, [x22, x16, LSL #2]\n"
262
"add x12, x12, #0x1\n"
263
"cmp x12, x15\n"
264
"addvl x22, x22, #2\n"
265
"blt 10b\n"
266
"whilelt p8.s, x13, %x[width]\n"
267
"b 13f\n"
268
"11:"
// K loop: Tails: Odd
269
"mov x12, #0x0\n"
270
"12:"
// K loop: Tails: Odd: Loop
271
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
272
".inst 0xe0bf82c0 // st1w { za0v.s[x12] }, p0/Z, [x22, XZR, LSL #2]\n"
273
".inst 0x25307540 // psel p0.s, p13.s/Z, p10.s[w12]\n"
274
".inst 0xe0b082c4 // st1w { za1v.s[x12] }, p0/Z, [x22, x16, LSL #2]\n"
275
"add x12, x12, #0x1\n"
276
"cmp x12, x15\n"
277
"addvl x22, x22, #2\n"
278
"blt 12b\n"
279
"13:"
// K loop: End
280
"mov %x[out], x22\n"
281
".inst 0xd503467f // SMSTOP\n"
282
: [out]
"+&r"
(out)
283
: [height]
"r"
(height), [in]
"r"
(in), [row_offset]
"r"
(row_offset), [width]
"r"
(width)
284
:
"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"
,
"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"
285
);
286
}
287
288
#endif // defined(ARM_COMPUTE_ENABLE_SME)
src
core
NEON
kernels
arm_gemm
indirect-interleaves
sme_interleave2VL_fp32_fp32.hpp
Generated on Mon Apr 29 2024 10:53:55 for Compute Library by
1.8.17