24.04
sme_interleave1VL_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<1, 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 x10\n"
38
"sub x22, x22, #0x1\n"
39
"udiv x22, x22, x10\n"
// n_passes = ceildiv(width, VL<T>)
40
"mov x21, %x[width]\n"
41
"sub x9, x10, #0x1\n"
42
"sub x20, x22, #0x1\n"
43
"ands x9, x21, x9\n"
44
"sub x28, x10, #0x2\n"
45
"mov x27, #0x0\n"
46
"mov x26, %x[in]\n"
47
"ldr x25, [x26, #0x0]\n"
48
"lsr x20, x20, #0x1\n"
// n_loops = (n_passes - 1) / 2
49
"and x24, x22, #0x1\n"
// odd_tail = bool(n_passes & 0x1)
50
"ldr x23, [x26, #0x8]\n"
51
"csel x9, x9, x10, NE\n"
52
"ptrue p11.s\n"
53
"whilelt p10.s, XZR, %x[height]\n"
54
"mov x22, %x[row_offset]\n"
55
"mov x21, %x[out]\n"
56
"whilelt p9.s, x27, %x[width]\n"
57
"whilelt p8.s, x27, %x[width]\n"
58
"add x26, x26, #0x10\n"
59
"mov x12, #0x0\n"
60
"cbz x28, 2f\n"
61
"1:"
// K loop: Charge: Loop
62
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
63
".inst 0xe0960320 // ld1w { za0h.s[x12] }, p0/Z, [x25, x22, LSL #2]\n"
64
".inst 0x25706140 // psel p0.s, p8.s/Z, p10.s[w12, #1]\n"
65
"ldr x25, [x26, #0x0]\n"
66
".inst 0xe09602e1 // ld1w { za0h.s[x12, #1] }, p0/Z, [x23, x22, LSL #2]\n"
67
"add x12, x12, #0x2\n"
68
"cmp x12, x28\n"
69
"ldr x23, [x26, #0x8]\n"
70
"add x26, x26, #0x10\n"
71
"blt 1b\n"
72
"2:"
// K loop: Charge: End
73
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
74
".inst 0xe0960320 // ld1w { za0h.s[x12] }, p0/Z, [x25, x22, LSL #2]\n"
75
".inst 0x25706140 // psel p0.s, p8.s/Z, p10.s[w12, #1]\n"
76
"mov x26, %x[in]\n"
77
".inst 0xe09602e1 // ld1w { za0h.s[x12, #1] }, p0/Z, [x23, x22, LSL #2]\n"
78
"ldr x25, [x26, #0x0]\n"
79
"incw x22\n"
80
"ldr x23, [x26, #0x8]\n"
81
"add x26, x26, #0x10\n"
82
"incw x27\n"
83
"cbz x20, 8f\n"
84
"mov x20, x20\n"
85
"3:"
// K loop: Main loop
86
"whilelt p8.s, x27, %x[width]\n"
87
"mov x12, #0x0\n"
88
"cbz x28, 5f\n"
89
"4:"
// K loop: Main loop: First: Loop
90
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
91
".inst 0xe0960328 // ld1w { za2h.s[x12] }, p0/Z, [x25, x22, LSL #2]\n"
92
".inst 0x25706141 // psel p1.s, p8.s/Z, p10.s[w12, #1]\n"
93
"ldr x25, [x26, #0x0]\n"
94
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
95
".inst 0xe09606e9 // ld1w { za2h.s[x12, #1] }, p1/Z, [x23, x22, LSL #2]\n"
96
"ldr x23, [x26, #0x8]\n"
97
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
98
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
99
".inst 0xe0aa82a1 // st1w { za0v.s[x12, #1] }, p0/Z, [x21, x10, LSL #2]\n"
100
"add x12, x12, #0x2\n"
101
"cmp x12, x28\n"
102
"add x26, x26, #0x10\n"
103
"addvl x21, x21, #2\n"
104
"blt 4b\n"
105
"5:"
// K loop: Main loop: First: Tail
106
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
107
".inst 0xe0960328 // ld1w { za2h.s[x12] }, p0/Z, [x25, x22, LSL #2]\n"
108
"mov x26, %x[in]\n"
109
"ldr x25, [x26, #0x0]\n"
110
".inst 0x25706141 // psel p1.s, p8.s/Z, p10.s[w12, #1]\n"
111
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
112
".inst 0xe09606e9 // ld1w { za2h.s[x12, #1] }, p1/Z, [x23, x22, LSL #2]\n"
113
"ldr x23, [x26, #0x8]\n"
114
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
115
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
116
"whilelt p9.s, x27, %x[width]\n"
117
"incw x27\n"
118
"add x26, x26, #0x10\n"
119
".inst 0xe0aa82a1 // st1w { za0v.s[x12, #1] }, p0/Z, [x21, x10, LSL #2]\n"
120
"addvl x21, x21, #2\n"
121
"incw x22\n"
122
"whilelt p8.s, x27, %x[width]\n"
123
"mov x12, #0x0\n"
124
"cbz x28, 7f\n"
125
"6:"
// K loop: Main loop: Second: Loop
126
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
127
".inst 0xe0960320 // ld1w { za0h.s[x12] }, p0/Z, [x25, x22, LSL #2]\n"
128
".inst 0x25706141 // psel p1.s, p8.s/Z, p10.s[w12, #1]\n"
129
"ldr x25, [x26, #0x0]\n"
130
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
131
".inst 0xe09606e1 // ld1w { za0h.s[x12, #1] }, p1/Z, [x23, x22, LSL #2]\n"
132
"ldr x23, [x26, #0x8]\n"
133
".inst 0xe0bf82a8 // st1w { za2v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
134
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
135
".inst 0xe0aa82a9 // st1w { za2v.s[x12, #1] }, p0/Z, [x21, x10, LSL #2]\n"
136
"add x12, x12, #0x2\n"
137
"cmp x12, x28\n"
138
"add x26, x26, #0x10\n"
139
"addvl x21, x21, #2\n"
140
"blt 6b\n"
141
"7:"
// K loop: Main loop: Second: Tail
142
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
143
".inst 0xe0960320 // ld1w { za0h.s[x12] }, p0/Z, [x25, x22, LSL #2]\n"
144
"mov x26, %x[in]\n"
145
"ldr x25, [x26, #0x0]\n"
146
".inst 0x25706141 // psel p1.s, p8.s/Z, p10.s[w12, #1]\n"
147
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
148
".inst 0xe09606e1 // ld1w { za0h.s[x12, #1] }, p1/Z, [x23, x22, LSL #2]\n"
149
"ldr x23, [x26, #0x8]\n"
150
".inst 0xe0bf82a8 // st1w { za2v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
151
".inst 0x25706d20 // psel p0.s, p11.s/Z, p9.s[w12, #1]\n"
152
"whilelt p9.s, x27, %x[width]\n"
153
"subs x20, x20, #0x1\n"
154
"add x26, x26, #0x10\n"
155
".inst 0xe0aa82a9 // st1w { za2v.s[x12, #1] }, p0/Z, [x21, x10, LSL #2]\n"
156
"addvl x21, x21, #2\n"
157
"incw x27\n"
158
"incw x22\n"
159
"bgt 3b\n"
160
"8:"
// K loop: Tails
161
"cbnz x24, 11f\n"
162
"mov x26, %x[in]\n"
163
"whilelt p8.s, x27, %x[width]\n"
164
"mov x12, #0x0\n"
165
"9:"
// K loop: Tails: Even: First
166
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
167
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
168
"ldr x20, [x26, #0x0]\n"
169
".inst 0x25306140 // psel p0.s, p8.s/Z, p10.s[w12]\n"
170
".inst 0xe0960288 // ld1w { za2h.s[x12] }, p0/Z, [x20, x22, LSL #2]\n"
171
"add x12, x12, #0x1\n"
172
"cmp x12, x10\n"
173
"add x26, x26, #0x8\n"
174
"addvl x21, x21, #1\n"
175
"blt 9b\n"
176
"whilelt p9.s, x27, %x[width]\n"
177
"whilelt p8.s, x27, %x[width]\n"
178
"mov x12, #0x0\n"
179
"10:"
// K loop: Tails: Even: Second
180
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
181
".inst 0xe0bf82a8 // st1w { za2v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
182
"add x12, x12, #0x1\n"
183
"cmp x12, x9\n"
184
"addvl x21, x21, #1\n"
185
"blt 10b\n"
186
"whilelt p8.s, x27, %x[width]\n"
187
"b 13f\n"
188
"11:"
// K loop: Tails: Odd
189
"mov x12, #0x0\n"
190
"12:"
// K loop: Tails: Odd: Loop
191
".inst 0x25306d20 // psel p0.s, p11.s/Z, p9.s[w12]\n"
192
".inst 0xe0bf82a0 // st1w { za0v.s[x12] }, p0/Z, [x21, XZR, LSL #2]\n"
193
"add x12, x12, #0x1\n"
194
"cmp x12, x9\n"
195
"addvl x21, x21, #1\n"
196
"blt 12b\n"
197
"13:"
// K loop: End
198
"mov %x[out], x21\n"
199
".inst 0xd503467f // SMSTOP\n"
200
: [out]
"+&r"
(out)
201
: [height]
"r"
(height), [in]
"r"
(in), [row_offset]
"r"
(row_offset), [width]
"r"
(width)
202
:
"cc"
,
"memory"
,
"p0"
,
"p1"
,
"p2"
,
"p3"
,
"p4"
,
"p5"
,
"p6"
,
"p7"
,
"p8"
,
"p9"
,
"p10"
,
"p11"
,
"p12"
,
"p13"
,
"p14"
,
"p15"
,
"x9"
,
"x10"
,
"x12"
,
"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"
203
);
204
}
205
206
#endif // defined(ARM_COMPUTE_ENABLE_SME)
src
core
NEON
kernels
arm_gemm
indirect-interleaves
sme_interleave1VL_fp32_fp32.hpp
Generated on Mon Apr 29 2024 10:53:55 for Compute Library by
1.8.17