24.04
sme2_interleave2VL_block2_fp32_bf16.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_SME2)
26
27
template
<>
28
void
interleave_block<2, 2, VLType::SME, false>(
29
bfloat16
* &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
"cntw x22, ALL, MUL #2\n"
36
"cntw x9\n"
37
"sub x28, %x[width], #0x1\n"
38
"cntw x21, ALL, MUL #2\n"
39
"sub x20, x22, #0x1\n"
40
".inst 0x25207815 // ptrue pn13.b\n"
41
"whilelt p12.s, XZR, %x[height]\n"
42
"whilelt p11.s, x9, %x[height]\n"
43
"add x28, x28, x21\n"
44
"ands x27, %x[width], x20\n"
45
"udiv x28, x28, x21\n"
46
"csel x27, x27, x22, NE\n"
47
"mov x26, #0x0\n"
48
"and x25, x28, #0x1\n"
49
"sub x28, x28, #0x1\n"
50
"add x27, x27, #0x1\n"
51
"mov x20, %x[width]\n"
52
"mov x24, %x[in]\n"
53
"ptrue p0.b\n"
54
"mov x23, %x[outptr_raw]\n"
55
"mov x22, %x[row_offset]\n"
56
"lsr x28, x28, #0x1\n"
57
"lsr x27, x27, #0x1\n"
58
"mov x12, #0x0\n"
59
".inst 0x25b44752 // whilelt pn10.s, x26, x20, VLx2\n"
60
"add x21, x24, x9, LSL #3\n"
61
"1:"
// Width loop: Preamble: Loop
62
"ldr x20, [x24], #0x8\n"
63
".inst 0x25306989 // psel p9.s, p10.s/Z, p12.s[w12]\n"
64
".inst 0x25306968 // psel p8.s, p10.s/Z, p11.s[w12]\n"
65
".inst 0xa0164698 // ld1w { z24.s-z25.s }, pn9.s/Z, [x20, x22, LSL #2]\n"
66
"ldr x20, [x21], #0x8\n"
67
".inst 0xa0164296 // ld1w { z22.s-z23.s }, pn8.s/Z, [x20, x22, LSL #2]\n"
68
".inst 0xc160e318 // bfcvt z24.h, { z24.s-z25.s }\n"
69
".inst 0xc160e2d6 // bfcvt z22.h, { z22.s-z23.s }\n"
70
".inst 0xc0800300 // mova za0h.s[x12], p0/M, z24.s\n"
71
".inst 0xc08002c4 // mova za1h.s[x12], p0/M, z22.s\n"
72
"add x12, x12, #0x1\n"
73
"cmp x12, x9\n"
74
"blt 1b\n"
75
"incw x22, ALL, MUL #2\n"
76
"incw x26, ALL, MUL #2\n"
77
"cbz x28, 5f\n"
78
"2:"
// Width loop
79
"mov x20, %x[width]\n"
80
"mov x24, %x[in]\n"
81
"mov x12, #0x0\n"
82
".inst 0x25b44752 // whilelt pn10.s, x26, x20, VLx2\n"
83
"add x21, x24, x9, LSL #3\n"
84
"3:"
// Width loop: Odd: Loop
85
"ldr x20, [x24], #0x8\n"
86
".inst 0x25306989 // psel p9.s, p10.s/Z, p12.s[w12]\n"
87
".inst 0x25306968 // psel p8.s, p10.s/Z, p11.s[w12]\n"
88
".inst 0xa0164696 // ld1w { z22.s-z23.s }, pn9.s/Z, [x20, x22, LSL #2]\n"
89
"ldr x20, [x21], #0x8\n"
90
".inst 0xa016428a // ld1w { z10.s-z11.s }, pn8.s/Z, [x20, x22, LSL #2]\n"
91
".inst 0xc160e2d6 // bfcvt z22.h, { z22.s-z23.s }\n"
92
".inst 0xc160e14a // bfcvt z10.h, { z10.s-z11.s }\n"
93
".inst 0xc08002c8 // mova za2h.s[x12], p0/M, z22.s\n"
94
".inst 0xc080014c // mova za3h.s[x12], p0/M, z10.s\n"
95
".inst 0xc0828008 // mova z8.s, p0/M, za0v.s[x12]\n"
96
".inst 0xc0828089 // mova z9.s, p0/M, za1v.s[x12]\n"
97
"add x12, x12, #0x1\n"
98
"cmp x12, x9\n"
99
".inst 0xa06056e8 // st1w { z8.s-z9.s }, pn13.b, [x23]\n"
100
"addvl x23, x23, #2\n"
101
"blt 3b\n"
102
"incw x26, ALL, MUL #2\n"
103
"mov x20, %x[width]\n"
104
"mov x24, %x[in]\n"
105
"incw x22, ALL, MUL #2\n"
106
"mov x12, #0x0\n"
107
".inst 0x25b44752 // whilelt pn10.s, x26, x20, VLx2\n"
108
"add x21, x24, x9, LSL #3\n"
109
"4:"
// Width loop: Even: Loop
110
"ldr x20, [x24], #0x8\n"
111
".inst 0x25306989 // psel p9.s, p10.s/Z, p12.s[w12]\n"
112
".inst 0x25306968 // psel p8.s, p10.s/Z, p11.s[w12]\n"
113
".inst 0xa016469a // ld1w { z26.s-z27.s }, pn9.s/Z, [x20, x22, LSL #2]\n"
114
"ldr x20, [x21], #0x8\n"
115
".inst 0xa016429e // ld1w { z30.s-z31.s }, pn8.s/Z, [x20, x22, LSL #2]\n"
116
".inst 0xc160e35a // bfcvt z26.h, { z26.s-z27.s }\n"
117
".inst 0xc160e3de // bfcvt z30.h, { z30.s-z31.s }\n"
118
".inst 0xc0800340 // mova za0h.s[x12], p0/M, z26.s\n"
119
".inst 0xc08003c4 // mova za1h.s[x12], p0/M, z30.s\n"
120
".inst 0xc0828106 // mova z6.s, p0/M, za2v.s[x12]\n"
121
".inst 0xc082818e // mova z14.s, p0/M, za3v.s[x12]\n"
122
"add x12, x12, #0x1\n"
123
"cmp x12, x9\n"
124
".inst 0xa16056e6 // st1w { z6.s, z14.s }, pn13.b, [x23]\n"
125
"addvl x23, x23, #2\n"
126
"blt 4b\n"
127
"subs x28, x28, #0x1\n"
128
"incw x22, ALL, MUL #2\n"
129
"incw x26, ALL, MUL #2\n"
130
"bgt 2b\n"
131
"5:"
// Width loop: Tails
132
"cbnz x25, 8f\n"
133
"mov x20, %x[width]\n"
134
"mov x24, %x[in]\n"
135
"mov x12, #0x0\n"
136
".inst 0x25b44752 // whilelt pn10.s, x26, x20, VLx2\n"
137
"add x21, x24, x9, LSL #3\n"
138
"6:"
// Width loop: Tails: Even: Odd: Loop
139
"ldr x20, [x24], #0x8\n"
140
".inst 0x25306989 // psel p9.s, p10.s/Z, p12.s[w12]\n"
141
".inst 0x25306968 // psel p8.s, p10.s/Z, p11.s[w12]\n"
142
".inst 0xa016468c // ld1w { z12.s-z13.s }, pn9.s/Z, [x20, x22, LSL #2]\n"
143
"ldr x20, [x21], #0x8\n"
144
".inst 0xa016428e // ld1w { z14.s-z15.s }, pn8.s/Z, [x20, x22, LSL #2]\n"
145
".inst 0xc160e18c // bfcvt z12.h, { z12.s-z13.s }\n"
146
".inst 0xc160e1ce // bfcvt z14.h, { z14.s-z15.s }\n"
147
".inst 0xc0800188 // mova za2h.s[x12], p0/M, z12.s\n"
148
".inst 0xc08001cc // mova za3h.s[x12], p0/M, z14.s\n"
149
".inst 0xc0828007 // mova z7.s, p0/M, za0v.s[x12]\n"
150
".inst 0xc082808f // mova z15.s, p0/M, za1v.s[x12]\n"
151
"add x12, x12, #0x1\n"
152
"cmp x12, x9\n"
153
".inst 0xa16056e7 // st1w { z7.s, z15.s }, pn13.b, [x23]\n"
154
"addvl x23, x23, #2\n"
155
"blt 6b\n"
156
"mov x12, #0x0\n"
157
"7:"
// Width loop: Tails: Even: Even: Loop
158
".inst 0xc082810e // mova z14.s, p0/M, za2v.s[x12]\n"
159
".inst 0xc082818f // mova z15.s, p0/M, za3v.s[x12]\n"
160
"add x12, x12, #0x1\n"
161
"cmp x12, x27\n"
162
".inst 0xa06056ee // st1w { z14.s-z15.s }, pn13.b, [x23]\n"
163
"addvl x23, x23, #2\n"
164
"blt 7b\n"
165
"b 10f\n"
166
"8:"
// Width loop: Tails: Odd
167
"mov x12, #0x0\n"
168
"9:"
// Width loop: Tails: Odd: Loop
169
".inst 0xc0828014 // mova z20.s, p0/M, za0v.s[x12]\n"
170
".inst 0xc0828095 // mova z21.s, p0/M, za1v.s[x12]\n"
171
"add x12, x12, #0x1\n"
172
"cmp x12, x27\n"
173
".inst 0xa06056f4 // st1w { z20.s-z21.s }, pn13.b, [x23]\n"
174
"addvl x23, x23, #2\n"
175
"blt 9b\n"
176
"10:"
// End
177
"mov %x[outptr_raw], x23\n"
178
".inst 0xd503467f // SMSTOP\n"
179
: [outptr_raw]
"+&r"
(out)
180
: [height]
"r"
(height), [in]
"r"
(in), [row_offset]
"r"
(row_offset), [width]
"r"
(width)
181
:
"cc"
,
"memory"
,
"p0"
,
"p1"
,
"p2"
,
"p3"
,
"p4"
,
"p5"
,
"p6"
,
"p7"
,
"p8"
,
"p9"
,
"p10"
,
"p11"
,
"p12"
,
"p13"
,
"p14"
,
"p15"
,
"x9"
,
"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"
182
);
183
}
184
185
#endif // defined(ARM_COMPUTE_ENABLE_SME2)
arm_gemm::bfloat16
arm_compute::bfloat16 bfloat16
Definition:
bfloat.hpp:30
src
core
NEON
kernels
arm_gemm
indirect-interleaves
sme2_interleave2VL_block2_fp32_bf16.hpp
Generated on Mon Apr 29 2024 10:53:55 for Compute Library by
1.8.17