blob: eab06aa50d0067aad8116a43ef5a26b2033ab976 [file] [log] [blame]
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001/*
Gian Marco Iodice10e88a72021-11-29 12:49:19 +00002 * Copyright (c) 2021-2022 Arm Limited.
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00003 *
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
Giorgio Arenabdd16d12021-05-13 16:58:51 +010025// *INDENT-OFF*
26// clang-format off
SiCong Lica364df2022-04-13 15:48:19 +010027#ifndef ARM_COMPUTE_TILE_HELPERS_H
28#define ARM_COMPUTE_TILE_HELPERS_H
Giorgio Arenabdd16d12021-05-13 16:58:51 +010029
Gian Marco Iodice8155c022021-04-16 15:08:59 +010030#define TILE_VECTOR_SIZE1 1
31#define TILE_VECTOR_SIZE2 2
32#define TILE_VECTOR_SIZE3 3
33#define TILE_VECTOR_SIZE4 4
34#define TILE_VECTOR_SIZE5 8
35#define TILE_VECTOR_SIZE6 8
36#define TILE_VECTOR_SIZE7 8
37#define TILE_VECTOR_SIZE8 8
38#define TILE_VECTOR_SIZE9 16
39#define TILE_VECTOR_SIZE10 16
40#define TILE_VECTOR_SIZE11 16
41#define TILE_VECTOR_SIZE12 16
42#define TILE_VECTOR_SIZE13 16
43#define TILE_VECTOR_SIZE14 16
44#define TILE_VECTOR_SIZE15 16
45#define TILE_VECTOR_SIZE16 16
46
47#define TILE_VECTOR_TYPE1(DATA_TYPE) DATA_TYPE##1
48#define TILE_VECTOR_TYPE2(DATA_TYPE) DATA_TYPE##2
49#define TILE_VECTOR_TYPE3(DATA_TYPE) DATA_TYPE##3
50#define TILE_VECTOR_TYPE4(DATA_TYPE) DATA_TYPE##4
51#define TILE_VECTOR_TYPE5(DATA_TYPE) DATA_TYPE##8
52#define TILE_VECTOR_TYPE6(DATA_TYPE) DATA_TYPE##8
53#define TILE_VECTOR_TYPE7(DATA_TYPE) DATA_TYPE##8
54#define TILE_VECTOR_TYPE8(DATA_TYPE) DATA_TYPE##8
55#define TILE_VECTOR_TYPE9(DATA_TYPE) DATA_TYPE##16
56#define TILE_VECTOR_TYPE10(DATA_TYPE) DATA_TYPE##16
57#define TILE_VECTOR_TYPE11(DATA_TYPE) DATA_TYPE##16
58#define TILE_VECTOR_TYPE12(DATA_TYPE) DATA_TYPE##16
59#define TILE_VECTOR_TYPE13(DATA_TYPE) DATA_TYPE##16
60#define TILE_VECTOR_TYPE14(DATA_TYPE) DATA_TYPE##16
61#define TILE_VECTOR_TYPE15(DATA_TYPE) DATA_TYPE##16
62#define TILE_VECTOR_TYPE16(DATA_TYPE) DATA_TYPE##16
63
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +000064/** Tile object
65 * A tile object is a 2D memory block and can be accessed using the following syntax:
66 * -# a[m0].v = access the the vector at row "m0" (OpenCL vector)
67 * -# a[m0].s[x] = access the scalar element at row "m0" and column "n0" (scalar access)
68 *
69 * @param[in] DATA_TYPE Data type of the tile
70 * @param[in] H Number of tile rows
71 * @param[in] W Number of tile colums
72 * @param[in] BASENAME Tile's name
73 */
74#define TILE(DATA_TYPE, H, W, BASENAME) TILE_STR(DATA_TYPE, H, W, BASENAME)
75#define TILE_STR(DATA_TYPE, H, W, BASENAME) \
76 union { \
Gian Marco Iodice8155c022021-04-16 15:08:59 +010077 DATA_TYPE s[TILE_VECTOR_SIZE##W]; \
78 TILE_VECTOR_TYPE##W(DATA_TYPE) v; \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +000079 } BASENAME[H]
80
Giorgio Arenabdd16d12021-05-13 16:58:51 +010081#define TENSOR4D_IMAGE(name) \
82 __read_only image2d_t name##_img, \
83 __global uchar *name##_ptr, \
84 uint name##_stride_x, \
85 uint name##_step_x, \
86 uint name##_stride_y, \
87 uint name##_step_y, \
88 uint name##_stride_z, \
89 uint name##_step_z, \
90 uint name##_stride_w, \
91 uint name##_step_w, \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +000092 uint name##_offset_first_element_in_bytes
93
Giorgio Arenabdd16d12021-05-13 16:58:51 +010094#define TENSOR4D_BUFFER(name) \
95 __global uchar *name##_ptr, \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +000096 uint name##_stride_x, \
97 uint name##_step_x, \
98 uint name##_stride_y, \
99 uint name##_step_y, \
100 uint name##_stride_z, \
101 uint name##_step_z, \
102 uint name##_stride_w, \
103 uint name##_step_w, \
104 uint name##_offset_first_element_in_bytes
105
106#define TENSOR4D_STR(name, type) TENSOR4D_##type(name)
107#define TENSOR4D(name, type) TENSOR4D_STR(name, type)
108
Adnan AlSinan17975a62021-11-08 17:46:39 +0000109#define TENSOR4D_T_IMAGE(name) \
110 __read_only image2d_t name##_img, \
111 __global uchar *name##_ptr, \
112 uint name##_stride_y, \
113 uint name##_stride_z, \
114 uint name##_stride_w, \
115 uint name##_c, \
116 uint name##_w, \
117 uint name##_h, \
118 uint name##_n, \
119 uint name##_offset_first_element_in_bytes
120
121#define TENSOR4D_T_BUFFER(name) \
122 __global uchar *name##_ptr, \
123 uint name##_stride_y, \
124 uint name##_stride_z, \
125 uint name##_stride_w, \
126 uint name##_c, \
127 uint name##_w, \
128 uint name##_h, \
129 uint name##_n, \
130 uint name##_offset_first_element_in_bytes
131
132#define TENSOR4D_T_STR(name, type) TENSOR4D_T_##type(name)
133#define TENSOR4D_T(name, type) TENSOR4D_T_STR(name, type)
134
Gian Marco Iodice4fb56702021-11-10 11:18:50 +0000135#define TENSOR3D_T_IMAGE(name) \
136 __read_only image2d_t name##_img, \
137 __global uchar *name##_ptr, \
138 uint name##_stride_y, \
139 uint name##_stride_z, \
140 uint name##_w, \
141 uint name##_h, \
142 uint name##_n, \
143 uint name##_offset_first_element_in_bytes
144
145#define TENSOR3D_T_BUFFER(name) \
146 __global uchar *name##_ptr, \
147 uint name##_stride_y, \
148 uint name##_stride_z, \
149 uint name##_w, \
150 uint name##_h, \
151 uint name##_n, \
152 uint name##_offset_first_element_in_bytes
153
154#define TENSOR3D_T_STR(name, type) TENSOR3D_T_##type(name)
155#define TENSOR3D_T(name, type) TENSOR3D_T_STR(name, type)
156
Giorgio Arenaea8d2662021-05-20 11:36:56 +0100157#if !defined(UNROLL_WITH_PRAGMA)
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100158#define UNROLL_INCR(idx, step, macro) idx += (step); (macro)
159
160#define LOOP_UNROLLING_1(idx, step, macro) (macro)
161#define LOOP_UNROLLING_2(idx, step, macro) LOOP_UNROLLING_1(idx, step, macro); UNROLL_INCR(idx, step, macro)
162#define LOOP_UNROLLING_3(idx, step, macro) LOOP_UNROLLING_2(idx, step, macro); UNROLL_INCR(idx, step, macro)
163#define LOOP_UNROLLING_4(idx, step, macro) LOOP_UNROLLING_3(idx, step, macro); UNROLL_INCR(idx, step, macro)
164#define LOOP_UNROLLING_5(idx, step, macro) LOOP_UNROLLING_4(idx, step, macro); UNROLL_INCR(idx, step, macro)
165#define LOOP_UNROLLING_6(idx, step, macro) LOOP_UNROLLING_5(idx, step, macro); UNROLL_INCR(idx, step, macro)
166#define LOOP_UNROLLING_7(idx, step, macro) LOOP_UNROLLING_6(idx, step, macro); UNROLL_INCR(idx, step, macro)
167#define LOOP_UNROLLING_8(idx, step, macro) LOOP_UNROLLING_7(idx, step, macro); UNROLL_INCR(idx, step, macro)
168#define LOOP_UNROLLING_9(idx, step, macro) LOOP_UNROLLING_8(idx, step, macro); UNROLL_INCR(idx, step, macro)
169#define LOOP_UNROLLING_10(idx, step, macro) LOOP_UNROLLING_9(idx, step, macro); UNROLL_INCR(idx, step, macro)
170#define LOOP_UNROLLING_11(idx, step, macro) LOOP_UNROLLING_10(idx, step, macro); UNROLL_INCR(idx, step, macro)
171#define LOOP_UNROLLING_12(idx, step, macro) LOOP_UNROLLING_11(idx, step, macro); UNROLL_INCR(idx, step, macro)
172#define LOOP_UNROLLING_13(idx, step, macro) LOOP_UNROLLING_12(idx, step, macro); UNROLL_INCR(idx, step, macro)
173#define LOOP_UNROLLING_14(idx, step, macro) LOOP_UNROLLING_13(idx, step, macro); UNROLL_INCR(idx, step, macro)
174#define LOOP_UNROLLING_15(idx, step, macro) LOOP_UNROLLING_14(idx, step, macro); UNROLL_INCR(idx, step, macro)
175#define LOOP_UNROLLING_16(idx, step, macro) LOOP_UNROLLING_15(idx, step, macro); UNROLL_INCR(idx, step, macro)
176#define LOOP_UNROLLING_17(idx, step, macro) LOOP_UNROLLING_16(idx, step, macro); UNROLL_INCR(idx, step, macro)
177#define LOOP_UNROLLING_18(idx, step, macro) LOOP_UNROLLING_17(idx, step, macro); UNROLL_INCR(idx, step, macro)
178#define LOOP_UNROLLING_19(idx, step, macro) LOOP_UNROLLING_18(idx, step, macro); UNROLL_INCR(idx, step, macro)
179#define LOOP_UNROLLING_20(idx, step, macro) LOOP_UNROLLING_19(idx, step, macro); UNROLL_INCR(idx, step, macro)
180#define LOOP_UNROLLING_21(idx, step, macro) LOOP_UNROLLING_20(idx, step, macro); UNROLL_INCR(idx, step, macro)
181#define LOOP_UNROLLING_22(idx, step, macro) LOOP_UNROLLING_21(idx, step, macro); UNROLL_INCR(idx, step, macro)
182#define LOOP_UNROLLING_23(idx, step, macro) LOOP_UNROLLING_22(idx, step, macro); UNROLL_INCR(idx, step, macro)
183#define LOOP_UNROLLING_24(idx, step, macro) LOOP_UNROLLING_23(idx, step, macro); UNROLL_INCR(idx, step, macro)
184#define LOOP_UNROLLING_25(idx, step, macro) LOOP_UNROLLING_24(idx, step, macro); UNROLL_INCR(idx, step, macro)
185#define LOOP_UNROLLING_26(idx, step, macro) LOOP_UNROLLING_25(idx, step, macro); UNROLL_INCR(idx, step, macro)
186#define LOOP_UNROLLING_27(idx, step, macro) LOOP_UNROLLING_26(idx, step, macro); UNROLL_INCR(idx, step, macro)
187#define LOOP_UNROLLING_28(idx, step, macro) LOOP_UNROLLING_27(idx, step, macro); UNROLL_INCR(idx, step, macro)
188#define LOOP_UNROLLING_29(idx, step, macro) LOOP_UNROLLING_28(idx, step, macro); UNROLL_INCR(idx, step, macro)
189#define LOOP_UNROLLING_30(idx, step, macro) LOOP_UNROLLING_29(idx, step, macro); UNROLL_INCR(idx, step, macro)
190#define LOOP_UNROLLING_31(idx, step, macro) LOOP_UNROLLING_30(idx, step, macro); UNROLL_INCR(idx, step, macro)
191#define LOOP_UNROLLING_32(idx, step, macro) LOOP_UNROLLING_31(idx, step, macro); UNROLL_INCR(idx, step, macro)
192#define LOOP_UNROLLING_33(idx, step, macro) LOOP_UNROLLING_32(idx, step, macro); UNROLL_INCR(idx, step, macro)
193#define LOOP_UNROLLING_34(idx, step, macro) LOOP_UNROLLING_33(idx, step, macro); UNROLL_INCR(idx, step, macro)
194#define LOOP_UNROLLING_35(idx, step, macro) LOOP_UNROLLING_34(idx, step, macro); UNROLL_INCR(idx, step, macro)
195#define LOOP_UNROLLING_36(idx, step, macro) LOOP_UNROLLING_35(idx, step, macro); UNROLL_INCR(idx, step, macro)
196#define LOOP_UNROLLING_37(idx, step, macro) LOOP_UNROLLING_36(idx, step, macro); UNROLL_INCR(idx, step, macro)
197#define LOOP_UNROLLING_38(idx, step, macro) LOOP_UNROLLING_37(idx, step, macro); UNROLL_INCR(idx, step, macro)
198#define LOOP_UNROLLING_39(idx, step, macro) LOOP_UNROLLING_38(idx, step, macro); UNROLL_INCR(idx, step, macro)
199#define LOOP_UNROLLING_40(idx, step, macro) LOOP_UNROLLING_39(idx, step, macro); UNROLL_INCR(idx, step, macro)
200#define LOOP_UNROLLING_41(idx, step, macro) LOOP_UNROLLING_40(idx, step, macro); UNROLL_INCR(idx, step, macro)
201#define LOOP_UNROLLING_42(idx, step, macro) LOOP_UNROLLING_41(idx, step, macro); UNROLL_INCR(idx, step, macro)
202#define LOOP_UNROLLING_43(idx, step, macro) LOOP_UNROLLING_42(idx, step, macro); UNROLL_INCR(idx, step, macro)
203#define LOOP_UNROLLING_44(idx, step, macro) LOOP_UNROLLING_43(idx, step, macro); UNROLL_INCR(idx, step, macro)
204#define LOOP_UNROLLING_45(idx, step, macro) LOOP_UNROLLING_44(idx, step, macro); UNROLL_INCR(idx, step, macro)
205#define LOOP_UNROLLING_46(idx, step, macro) LOOP_UNROLLING_45(idx, step, macro); UNROLL_INCR(idx, step, macro)
206#define LOOP_UNROLLING_47(idx, step, macro) LOOP_UNROLLING_46(idx, step, macro); UNROLL_INCR(idx, step, macro)
207#define LOOP_UNROLLING_48(idx, step, macro) LOOP_UNROLLING_47(idx, step, macro); UNROLL_INCR(idx, step, macro)
208#define LOOP_UNROLLING_49(idx, step, macro) LOOP_UNROLLING_48(idx, step, macro); UNROLL_INCR(idx, step, macro)
209#define LOOP_UNROLLING_50(idx, step, macro) LOOP_UNROLLING_49(idx, step, macro); UNROLL_INCR(idx, step, macro)
210#define LOOP_UNROLLING_51(idx, step, macro) LOOP_UNROLLING_50(idx, step, macro); UNROLL_INCR(idx, step, macro)
211#define LOOP_UNROLLING_52(idx, step, macro) LOOP_UNROLLING_51(idx, step, macro); UNROLL_INCR(idx, step, macro)
212#define LOOP_UNROLLING_53(idx, step, macro) LOOP_UNROLLING_52(idx, step, macro); UNROLL_INCR(idx, step, macro)
213#define LOOP_UNROLLING_54(idx, step, macro) LOOP_UNROLLING_53(idx, step, macro); UNROLL_INCR(idx, step, macro)
214#define LOOP_UNROLLING_55(idx, step, macro) LOOP_UNROLLING_54(idx, step, macro); UNROLL_INCR(idx, step, macro)
215#define LOOP_UNROLLING_56(idx, step, macro) LOOP_UNROLLING_55(idx, step, macro); UNROLL_INCR(idx, step, macro)
216#define LOOP_UNROLLING_57(idx, step, macro) LOOP_UNROLLING_56(idx, step, macro); UNROLL_INCR(idx, step, macro)
217#define LOOP_UNROLLING_58(idx, step, macro) LOOP_UNROLLING_57(idx, step, macro); UNROLL_INCR(idx, step, macro)
218#define LOOP_UNROLLING_59(idx, step, macro) LOOP_UNROLLING_58(idx, step, macro); UNROLL_INCR(idx, step, macro)
219#define LOOP_UNROLLING_60(idx, step, macro) LOOP_UNROLLING_59(idx, step, macro); UNROLL_INCR(idx, step, macro)
220#define LOOP_UNROLLING_61(idx, step, macro) LOOP_UNROLLING_60(idx, step, macro); UNROLL_INCR(idx, step, macro)
221#define LOOP_UNROLLING_62(idx, step, macro) LOOP_UNROLLING_61(idx, step, macro); UNROLL_INCR(idx, step, macro)
222#define LOOP_UNROLLING_63(idx, step, macro) LOOP_UNROLLING_62(idx, step, macro); UNROLL_INCR(idx, step, macro)
223#define LOOP_UNROLLING_64(idx, step, macro) LOOP_UNROLLING_63(idx, step, macro); UNROLL_INCR(idx, step, macro)
224#define LOOP_UNROLLING_65(idx, step, macro) LOOP_UNROLLING_64(idx, step, macro); UNROLL_INCR(idx, step, macro)
225#define LOOP_UNROLLING_66(idx, step, macro) LOOP_UNROLLING_65(idx, step, macro); UNROLL_INCR(idx, step, macro)
226#define LOOP_UNROLLING_67(idx, step, macro) LOOP_UNROLLING_66(idx, step, macro); UNROLL_INCR(idx, step, macro)
227#define LOOP_UNROLLING_68(idx, step, macro) LOOP_UNROLLING_67(idx, step, macro); UNROLL_INCR(idx, step, macro)
228#define LOOP_UNROLLING_69(idx, step, macro) LOOP_UNROLLING_68(idx, step, macro); UNROLL_INCR(idx, step, macro)
229#define LOOP_UNROLLING_70(idx, step, macro) LOOP_UNROLLING_69(idx, step, macro); UNROLL_INCR(idx, step, macro)
230#define LOOP_UNROLLING_71(idx, step, macro) LOOP_UNROLLING_70(idx, step, macro); UNROLL_INCR(idx, step, macro)
231#define LOOP_UNROLLING_72(idx, step, macro) LOOP_UNROLLING_71(idx, step, macro); UNROLL_INCR(idx, step, macro)
232#define LOOP_UNROLLING_73(idx, step, macro) LOOP_UNROLLING_72(idx, step, macro); UNROLL_INCR(idx, step, macro)
233#define LOOP_UNROLLING_74(idx, step, macro) LOOP_UNROLLING_73(idx, step, macro); UNROLL_INCR(idx, step, macro)
234#define LOOP_UNROLLING_75(idx, step, macro) LOOP_UNROLLING_74(idx, step, macro); UNROLL_INCR(idx, step, macro)
235#define LOOP_UNROLLING_76(idx, step, macro) LOOP_UNROLLING_75(idx, step, macro); UNROLL_INCR(idx, step, macro)
236#define LOOP_UNROLLING_77(idx, step, macro) LOOP_UNROLLING_76(idx, step, macro); UNROLL_INCR(idx, step, macro)
237#define LOOP_UNROLLING_78(idx, step, macro) LOOP_UNROLLING_77(idx, step, macro); UNROLL_INCR(idx, step, macro)
238#define LOOP_UNROLLING_79(idx, step, macro) LOOP_UNROLLING_78(idx, step, macro); UNROLL_INCR(idx, step, macro)
239#define LOOP_UNROLLING_80(idx, step, macro) LOOP_UNROLLING_79(idx, step, macro); UNROLL_INCR(idx, step, macro)
240#define LOOP_UNROLLING_81(idx, step, macro) LOOP_UNROLLING_80(idx, step, macro); UNROLL_INCR(idx, step, macro)
241#define LOOP_UNROLLING_82(idx, step, macro) LOOP_UNROLLING_81(idx, step, macro); UNROLL_INCR(idx, step, macro)
242#define LOOP_UNROLLING_83(idx, step, macro) LOOP_UNROLLING_82(idx, step, macro); UNROLL_INCR(idx, step, macro)
243#define LOOP_UNROLLING_84(idx, step, macro) LOOP_UNROLLING_83(idx, step, macro); UNROLL_INCR(idx, step, macro)
244#define LOOP_UNROLLING_85(idx, step, macro) LOOP_UNROLLING_84(idx, step, macro); UNROLL_INCR(idx, step, macro)
245#define LOOP_UNROLLING_86(idx, step, macro) LOOP_UNROLLING_85(idx, step, macro); UNROLL_INCR(idx, step, macro)
246#define LOOP_UNROLLING_87(idx, step, macro) LOOP_UNROLLING_86(idx, step, macro); UNROLL_INCR(idx, step, macro)
247#define LOOP_UNROLLING_88(idx, step, macro) LOOP_UNROLLING_87(idx, step, macro); UNROLL_INCR(idx, step, macro)
248#define LOOP_UNROLLING_89(idx, step, macro) LOOP_UNROLLING_88(idx, step, macro); UNROLL_INCR(idx, step, macro)
249#define LOOP_UNROLLING_90(idx, step, macro) LOOP_UNROLLING_89(idx, step, macro); UNROLL_INCR(idx, step, macro)
250#define LOOP_UNROLLING_91(idx, step, macro) LOOP_UNROLLING_90(idx, step, macro); UNROLL_INCR(idx, step, macro)
251#define LOOP_UNROLLING_92(idx, step, macro) LOOP_UNROLLING_91(idx, step, macro); UNROLL_INCR(idx, step, macro)
252#define LOOP_UNROLLING_93(idx, step, macro) LOOP_UNROLLING_92(idx, step, macro); UNROLL_INCR(idx, step, macro)
253#define LOOP_UNROLLING_94(idx, step, macro) LOOP_UNROLLING_93(idx, step, macro); UNROLL_INCR(idx, step, macro)
254#define LOOP_UNROLLING_95(idx, step, macro) LOOP_UNROLLING_94(idx, step, macro); UNROLL_INCR(idx, step, macro)
255#define LOOP_UNROLLING_96(idx, step, macro) LOOP_UNROLLING_95(idx, step, macro); UNROLL_INCR(idx, step, macro)
256#define LOOP_UNROLLING_97(idx, step, macro) LOOP_UNROLLING_96(idx, step, macro); UNROLL_INCR(idx, step, macro)
257#define LOOP_UNROLLING_98(idx, step, macro) LOOP_UNROLLING_97(idx, step, macro); UNROLL_INCR(idx, step, macro)
258#define LOOP_UNROLLING_99(idx, step, macro) LOOP_UNROLLING_98(idx, step, macro); UNROLL_INCR(idx, step, macro)
259#define LOOP_UNROLLING_100(idx, step, macro) LOOP_UNROLLING_99(idx, step, macro); UNROLL_INCR(idx, step, macro)
260#define LOOP_UNROLLING_101(idx, step, macro) LOOP_UNROLLING_100(idx, step, macro); UNROLL_INCR(idx, step, macro)
261#define LOOP_UNROLLING_102(idx, step, macro) LOOP_UNROLLING_101(idx, step, macro); UNROLL_INCR(idx, step, macro)
262#define LOOP_UNROLLING_103(idx, step, macro) LOOP_UNROLLING_102(idx, step, macro); UNROLL_INCR(idx, step, macro)
263#define LOOP_UNROLLING_104(idx, step, macro) LOOP_UNROLLING_103(idx, step, macro); UNROLL_INCR(idx, step, macro)
264#define LOOP_UNROLLING_105(idx, step, macro) LOOP_UNROLLING_104(idx, step, macro); UNROLL_INCR(idx, step, macro)
265#define LOOP_UNROLLING_106(idx, step, macro) LOOP_UNROLLING_105(idx, step, macro); UNROLL_INCR(idx, step, macro)
266#define LOOP_UNROLLING_107(idx, step, macro) LOOP_UNROLLING_106(idx, step, macro); UNROLL_INCR(idx, step, macro)
267#define LOOP_UNROLLING_108(idx, step, macro) LOOP_UNROLLING_107(idx, step, macro); UNROLL_INCR(idx, step, macro)
268#define LOOP_UNROLLING_109(idx, step, macro) LOOP_UNROLLING_108(idx, step, macro); UNROLL_INCR(idx, step, macro)
269#define LOOP_UNROLLING_110(idx, step, macro) LOOP_UNROLLING_109(idx, step, macro); UNROLL_INCR(idx, step, macro)
270#define LOOP_UNROLLING_111(idx, step, macro) LOOP_UNROLLING_110(idx, step, macro); UNROLL_INCR(idx, step, macro)
271#define LOOP_UNROLLING_112(idx, step, macro) LOOP_UNROLLING_111(idx, step, macro); UNROLL_INCR(idx, step, macro)
272#define LOOP_UNROLLING_113(idx, step, macro) LOOP_UNROLLING_112(idx, step, macro); UNROLL_INCR(idx, step, macro)
273#define LOOP_UNROLLING_114(idx, step, macro) LOOP_UNROLLING_113(idx, step, macro); UNROLL_INCR(idx, step, macro)
274#define LOOP_UNROLLING_115(idx, step, macro) LOOP_UNROLLING_114(idx, step, macro); UNROLL_INCR(idx, step, macro)
275#define LOOP_UNROLLING_116(idx, step, macro) LOOP_UNROLLING_115(idx, step, macro); UNROLL_INCR(idx, step, macro)
276#define LOOP_UNROLLING_117(idx, step, macro) LOOP_UNROLLING_116(idx, step, macro); UNROLL_INCR(idx, step, macro)
277#define LOOP_UNROLLING_118(idx, step, macro) LOOP_UNROLLING_117(idx, step, macro); UNROLL_INCR(idx, step, macro)
278#define LOOP_UNROLLING_119(idx, step, macro) LOOP_UNROLLING_118(idx, step, macro); UNROLL_INCR(idx, step, macro)
279#define LOOP_UNROLLING_120(idx, step, macro) LOOP_UNROLLING_119(idx, step, macro); UNROLL_INCR(idx, step, macro)
280#define LOOP_UNROLLING_121(idx, step, macro) LOOP_UNROLLING_120(idx, step, macro); UNROLL_INCR(idx, step, macro)
281#define LOOP_UNROLLING_122(idx, step, macro) LOOP_UNROLLING_121(idx, step, macro); UNROLL_INCR(idx, step, macro)
282#define LOOP_UNROLLING_123(idx, step, macro) LOOP_UNROLLING_122(idx, step, macro); UNROLL_INCR(idx, step, macro)
283#define LOOP_UNROLLING_124(idx, step, macro) LOOP_UNROLLING_123(idx, step, macro); UNROLL_INCR(idx, step, macro)
284#define LOOP_UNROLLING_125(idx, step, macro) LOOP_UNROLLING_124(idx, step, macro); UNROLL_INCR(idx, step, macro)
285#define LOOP_UNROLLING_126(idx, step, macro) LOOP_UNROLLING_125(idx, step, macro); UNROLL_INCR(idx, step, macro)
286#define LOOP_UNROLLING_127(idx, step, macro) LOOP_UNROLLING_126(idx, step, macro); UNROLL_INCR(idx, step, macro)
287#define LOOP_UNROLLING_128(idx, step, macro) LOOP_UNROLLING_127(idx, step, macro); UNROLL_INCR(idx, step, macro)
288
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100289#define LOOP_UNROLLING_STR(type, idx, start, step, num, macro) \
290 { \
291 type idx = start; \
292 LOOP_UNROLLING_##num(idx, step, macro); \
293 }
Giorgio Arenaea8d2662021-05-20 11:36:56 +0100294#else // !defined(UNROLL_WITH_PRAGMA)
295#define LOOP_UNROLLING_STR(type, idx, start, step, num, macro) \
296 { \
297 _Pragma("unroll") \
298 for(type idx = start; idx < (num * step); idx += step) \
299 { \
300 (macro); \
301 } \
302 }
303#endif // !defined(UNROLL_WITH_PRAGMA)
304#define LOOP_UNROLLING(type, idx, start, step, num, macro) LOOP_UNROLLING_STR(type, idx, start, step, num, macro)
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000305
306/** Get the get_global_id with partial N0. This function is useful when the dimension is not multiple of N0 and we need to use a partial N0
307 * to avoid out-of-bound read/write
308 *
309 * @note PARTIAL_N0 is used for get_global_id(n) = 0.
310 *
311 * @param[in] IDX get_global_id index (0,1 and 2 only)
312 * @param[in] N0 Number of elements read/written on the IDX direction
313 * @param[in] PARTIAL_N0 Number of elements read/written on the IDX direction for get_global_id(IDX) = 0. If zero,
314 * the Number of elements read/written on the IDX direction for get_global_id(IDX) = 0 is N0
315 */
316#define GET_SPATIAL_IDX(IDX, N0, PARTIAL_N0) (max((int)(get_global_id(IDX) * N0 - (N0 - PARTIAL_N0) % N0), 0))
317
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000318/** Dot product integet 8bit function
319 *
320 * @note Performs: c += dot(a, b)
321 *
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100322 * @param[in] A_DATA_TYPE A (lhs) data type
323 * @param[in] B_DATA_TYPE B (rhs) data type
324 * @param[in] C_DATA_TYPE C (accumulator) data type
325 * @param[in] K0 Number of accumulations
326 * @param[in] a OpenCL vector a
327 * @param[in] b OpenCL vector b
328 * @param[in] c Scalar variable c
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000329 */
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100330#define DOT_PRODUCT_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, b, c) DOT_PRODUCT_INTEGER8_STR(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, b, c)
331#define DOT_PRODUCT_INTEGER8_STR(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, b, c) DOT_PRODUCT##K0##_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c)
332#define DOT_PRODUCT1_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000333 ({ \
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100334 c += (C_DATA_TYPE)(a) * (C_DATA_TYPE)(b); \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000335 })
336#if defined(ARM_COMPUTE_OPENCL_DOT8_ACC_ENABLED) && defined(cl_arm_integer_dot_product_accumulate_int8)
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100337#define DOT_PRODUCT2_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) c = arm_dot_acc((A_DATA_TYPE##4)((a).s01, (A_DATA_TYPE##2)(0)), (B_DATA_TYPE##4)(((b).s01), (B_DATA_TYPE##2)(0)), (c));
338#define DOT_PRODUCT3_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) c = arm_dot_acc((A_DATA_TYPE##4)((a).s012, (A_DATA_TYPE)0), (B_DATA_TYPE##4)(((b).s012), (B_DATA_TYPE)0), (c));
339#define DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) c = arm_dot_acc((a), (b), (c));
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000340#elif defined(ARM_COMPUTE_OPENCL_DOT8_ENABLED) && defined(cl_arm_integer_dot_product_int8) // defined(ARM_COMPUTE_OPENCL_DOT8_ENABLED) && defined(cl_arm_integer_dot_product_int8)
Michalis Spyrouc38ca382021-07-14 13:30:28 +0100341#define DOT_PRODUCT2_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) c += arm_dot((A_DATA_TYPE##4)((a).s01, (A_DATA_TYPE##2)(0)), (B_DATA_TYPE##4)(((b).s01), (B_DATA_TYPE##2)(0)));
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100342#define DOT_PRODUCT3_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) c += arm_dot((A_DATA_TYPE##4)((a).s012, (A_DATA_TYPE)0), (B_DATA_TYPE##4)(((b).s012), (B_DATA_TYPE)0));
343#define DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) c += arm_dot((a), (b));
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000344#else // defined(ARM_COMPUTE_OPENCL_DOT8_ACC_ENABLED) && defined(cl_arm_integer_dot_product_accumulate_int8)
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100345#define DOT_PRODUCT2_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
346 ({ \
347 c += (C_DATA_TYPE)(a).s0 * (C_DATA_TYPE)(b).s0; \
348 c += (C_DATA_TYPE)(a).s1 * (C_DATA_TYPE)(b).s1; \
349 })
350#define DOT_PRODUCT3_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
351 ({ \
352 DOT_PRODUCT2_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c); \
353 c += (C_DATA_TYPE)(a).s2 * (C_DATA_TYPE)(b).s2; \
354 })
355#define DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, x, y, val) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000356 ({ \
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100357 val += (C_DATA_TYPE)(x).s0 * (C_DATA_TYPE)(y).s0; \
358 val += (C_DATA_TYPE)(x).s1 * (C_DATA_TYPE)(y).s1; \
359 val += (C_DATA_TYPE)(x).s2 * (C_DATA_TYPE)(y).s2; \
360 val += (C_DATA_TYPE)(x).s3 * (C_DATA_TYPE)(y).s3; \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000361 })
362#endif // defined(ARM_COMPUTE_OPENCL_DOT8_ACC_ENABLED) && defined(cl_arm_integer_dot_product_accumulate_int8)
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100363#define DOT_PRODUCT5_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
364 ({ \
365 DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s0123), ((b).s0123), c); \
366 DOT_PRODUCT1_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s4), ((b).s4), c); \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000367 })
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100368#define DOT_PRODUCT6_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
369 ({ \
370 DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s0123), ((b).s0123), c); \
371 DOT_PRODUCT2_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s45), ((b).s45), c); \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000372 })
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100373#define DOT_PRODUCT7_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
374 ({ \
375 DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s0123), ((b).s0123), c); \
376 DOT_PRODUCT3_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s456), ((b).s456), c); \
377 })
378#define DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
379 ({ \
380 DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).lo), ((b).lo), c); \
381 DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).hi), ((b).hi), c); \
382 })
383#define DOT_PRODUCT9_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
384 ({ \
385 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
386 DOT_PRODUCT1_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s8), ((b).s8), c); \
387 })
388#define DOT_PRODUCT10_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
389 ({ \
390 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
391 DOT_PRODUCT2_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s89), ((b).s89), c); \
392 })
393#define DOT_PRODUCT11_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
394 ({ \
395 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
396 DOT_PRODUCT3_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s89A), ((b).s89A), c); \
397 })
398#define DOT_PRODUCT12_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
399 ({ \
400 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
401 DOT_PRODUCT4_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s89AB), ((b).s89AB), c); \
402 })
403#define DOT_PRODUCT13_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
404 ({ \
405 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
406 DOT_PRODUCT5_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s89ABC), ((b).s89ABC), c); \
407 })
408#define DOT_PRODUCT14_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
409 ({ \
410 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
411 DOT_PRODUCT6_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s89ABCD), ((b).s89ABCD), c); \
412 })
413#define DOT_PRODUCT15_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
414 ({ \
415 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s01234567), ((b).s01234567), c); \
416 DOT_PRODUCT7_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).s89ABCDE), ((b).s89ABCDE), c); \
417 })
418#define DOT_PRODUCT16_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, a, b, c) \
419 ({ \
420 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).lo), ((b).lo), c); \
421 DOT_PRODUCT8_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, ((a).hi), ((b).hi), c); \
422 })
423
424/** Dot product integet 8bit function
425 *
426 * @note Performs: c += dot(a, b)
427 *
428 * @param[in] A_DATA_TYPE A (lhs) data type
429 * @param[in] B_DATA_TYPE B (rhs) data type
430 * @param[in] C_DATA_TYPE C (accumulator) data type
431 * @param[in] K0 Number of accumulations
432 * @param[in] a OpenCL vector a
433 * @param[in] c Scalar variable c
434 */
435#define REDUCE_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, c) REDUCE_INTEGER8_STR(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, c)
436#define REDUCE_INTEGER8_STR(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, c) DOT_PRODUCT_INTEGER8(A_DATA_TYPE, B_DATA_TYPE, C_DATA_TYPE, K0, a, (TILE_VECTOR_TYPE##K0(B_DATA_TYPE))1, c)
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000437
438/** Load a vector from global memory (tensor)
439 *
440 * @param[in] DATA_TYPE Data type
441 * @param[in] WIDTH Number of dst columns
442 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image).
443 * In case of cl_image, only WIDTH multiples of 4 are supported (4, 8, 16)
444 * @param[in] TENSOR Tensor basename
445 * @param[in] X Starting X position
446 * @param[in] Y Starting Y position
447 * @param[in] STRIDE_Y Stride Y (in bytes)
448 */
449#define V_LOAD(DATA_TYPE, WIDTH, TENSOR_TYPE, TENSOR, X, Y, STRIDE_Y) V_LOAD_STR(DATA_TYPE, WIDTH, TENSOR_TYPE, TENSOR, X, Y, STRIDE_Y)
450#define V_LOAD_STR(DATA_TYPE, WIDTH, TENSOR_TYPE, TENSOR, X, Y, STRIDE_Y) V_LOAD_##TENSOR_TYPE(DATA_TYPE, WIDTH, TENSOR, X, Y, STRIDE_Y)
451#define V_LOAD_BUFFER(DATA_TYPE, WIDTH, TENSOR, X, Y, STRIDE_Y) \
452 VLOAD(WIDTH) \
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100453 (0, (__global DATA_TYPE *)(TENSOR##_ptr + TENSOR##_offset_first_element_in_bytes + (X) * sizeof(DATA_TYPE) + (Y) * (STRIDE_Y)))
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000454#define V_LOAD_IMAGE(DATA_TYPE, WIDTH, TENSOR, X, Y, STRIDE_Y) READ_IMAGE2D(DATA_TYPE, CONVERT_VECTOR_SIZE_TO_PIXEL_UNIT(WIDTH), TENSOR##_img, (X) / 4, (Y))
455
456/** Load a tile from global memory (tensor)
457 *
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100458 * @param[in] DATA_TYPE Data type
459 * @param[in] HEIGHT Number of dst rows
460 * @param[in] WIDTH Number of dst columns
461 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image).
462 * In case of cl_image, only WIDTH multiples of 4 are supported (4, 8, 16)
463 * @param[in] TENSOR Tensor basename
464 * @param[in] X Starting X position
465 * @param[in] Y Starting Y position
466 * @param[in] YI_MULTIPLIER Parameter used to multiply the internal row increment (_i).
467 * In common cases should be 1 but it becomes useful when we want to load rows which are multiple of STRIDE_Y. (e.g. loading the weights of convolution layer).
468 * In this case the address calculation is performed as: (Y + _i * Y_MULTIPLIER) * STRIDE_Y
469 * @param[in] STRIDE_Y Stride Y (in bytes) used to load each row.
470 * @param[out] dst Output tile
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000471 */
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100472#define T_LOAD(DATA_TYPE, HEIGHT, WIDTH, TENSOR_TYPE, TENSOR, X, Y, YI_MULTIPLIER, STRIDE_Y, dst) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100473 ({ \
474 LOOP_UNROLLING(int, _i, 0, 1, HEIGHT, \
475 { \
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100476 dst[_i].v = V_LOAD(DATA_TYPE, WIDTH, TENSOR_TYPE, TENSOR, X, ((Y) + _i * (int)(YI_MULTIPLIER)), STRIDE_Y); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100477 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000478 })
479
480/** Load a tile from global memory (tensor) using an indirect Y index tile
481 *
482 * @param[in] DATA_TYPE Data type
483 * @param[in] HEIGHT Number of dst rows
484 * @param[in] WIDTH Number of dst columns
485 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image). Currently BUFFER only is supported
486 * In case of cl_image, only WIDTH multiples of 4 are supported (4, 8, 16)
487 * @param[in] TENSOR Tensor basename
488 * @param[in] X Starting X position
489 * @param[in] STRIDE_Y Stride Y (in bytes)
490 * @param[in] indirect_y Indirect Y index tile
491 * @param[out] dst Output tile
492 */
493#define T_LOAD_INDIRECT(DATA_TYPE, HEIGHT, WIDTH, TENSOR_TYPE, TENSOR, X, STRIDE_Y, indirect_y, dst) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100494 ({ \
495 LOOP_UNROLLING(int, _i, 0, 1, HEIGHT, \
496 { \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000497 dst[_i].v = V_LOAD(DATA_TYPE, WIDTH, TENSOR_TYPE, TENSOR, X, (indirect_y[_i].v), STRIDE_Y); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100498 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000499 })
500
Adnan AlSinan3e155a52021-12-10 12:34:02 +0000501/** Load a tile from global memory (tensor) using an indirect Y index tile and conditionally use a different length for the load
502 *
503 * @note If WIDTH1_CONDITION is true, the load will use the WIDTH1 length for the store
504 * @note The vectors are stored in reverse order so the invalid rows are overwritten by the valid ones
505 *
506 * @param[in] DATA_TYPE Data type
507 * @param[in] HEIGHT Number of dst rows
508 * @param[in] WIDTH0 Store width to use if WIDTH1_CONDITION = false
509 * @param[in] WIDTH1 Store width to use if WIDTH1_CONDITION = true
510 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image).
511 * In case of cl_image, only WIDTH multiples of 4 are supported (4, 8, 16)
512 * @param[in] TENSOR Tensor basename
513 * @param[in] X Starting X position
514 * @param[in] STRIDE_Y Stride Y (in bytes) used to load each row.
515 * @param[in] WIDTH1_CONDITION Condition to select the WIDTH1 store
516 * @param[out] dst Output tile
517 * @param[out] indirect_y Indirect Y index tile
518 */
519#define T_LOAD_INDIRECT_WIDTH_SELECT(DATA_TYPE, HEIGHT, WIDTH0, WIDTH1, TENSOR_TYPE, TENSOR, X, STRIDE_Y, WIDTH1_CONDITION, dst, indirect_y) \
520 ({ \
521 if(WIDTH1_CONDITION) \
522 { \
523 LOOP_UNROLLING(int, _i, 0, 1, HEIGHT, \
524 { \
525 VLOAD_PARTIAL(WIDTH0, WIDTH1) \
526 (dst[HEIGHT - 1 - _i].v, 0, (__global DATA_TYPE *)(TENSOR##_ptr + TENSOR##_offset_first_element_in_bytes + (X) * sizeof(DATA_TYPE) + (indirect_y[HEIGHT - 1 - _i].v) * STRIDE_Y)); \
527 }) \
528 } \
529 else \
530 { \
531 LOOP_UNROLLING(int, _i, 0, 1, HEIGHT, \
532 { \
533 dst[HEIGHT - 1 - _i].v = V_LOAD(DATA_TYPE, WIDTH0, TENSOR_TYPE, TENSOR, X, (indirect_y[HEIGHT - 1 - _i].v), STRIDE_Y); \
534 }) \
535 } \
536 })
Gian Marco Iodice534b8892021-04-01 16:17:16 +0100537/** Load a tile from global memory (tensor) when the tensor is stored using a NHWC layout
538 *
539 * @param[in] DATA_TYPE Data type
540 * @param[in] TILE_HEIGHT Number of elements to load from Y (height) dimension
541 * @param[in] TILE_WIDTH Number of elements to load from X (width) dimension
542 * @param[in] TILE_CHANNELS Number of elements to load from C (channel) dimension
543 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image). Currently BUFFER only is supported
544 * In case of cl_image, only TILE_CHANNELS multiples of 4 are supported (4, 8, 16)
545 * @param[in] TENSOR Tensor basename
546 * @param[in] B Starting batch index
547 * @param[in] Y Starting Y index
548 * @param[in] X Starting X index
549 * @param[in] C Starting C index
550 * @param[in] TENSOR_HEIGHT Number of elements to load from Y (height) dimension
551 * @param[in] TENSOR_WIDTH Number of elements to load from X (width) dimension
552 * @param[in] STRIDE_Y Stride Y (in bytes)
553 * @param[out] dst Output tile
554 */
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100555#define T_LOAD_NHWC(DATA_TYPE, TILE_HEIGHT, TILE_WIDTH, TILE_CHANNELS, TENSOR_TYPE, TENSOR, B, Y, X, C, TENSOR_WIDTH, TENSOR_HEIGHT, STRIDE_Y, dst) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100556 ({ \
557 LOOP_UNROLLING(int, _yk, 0, 1, TILE_HEIGHT, \
558 { \
559 LOOP_UNROLLING(int, _xk, 0, 1, TILE_WIDTH, \
560 { \
561 int _src_y = (X) + _xk + ((Y) + _yk) * (TENSOR_WIDTH); \
562 _src_y += (B) * (int)(TENSOR_WIDTH) * (int)(TENSOR_HEIGHT); \
Gian Marco Iodice534b8892021-04-01 16:17:16 +0100563 int _src_valid_y = (((X) + _xk) >= 0 && ((X) + _xk) < (int)(TENSOR_WIDTH) && ((Y) + _yk) >= 0 && ((Y) + _yk) < (int)(TENSOR_HEIGHT)); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100564 if(_src_valid_y != 0) \
565 { \
566 dst[_xk + _yk * (TILE_WIDTH)].v = V_LOAD(DATA_TYPE, TILE_CHANNELS, TENSOR_TYPE, TENSOR, C, _src_y, STRIDE_Y); \
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100567 } \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100568 }) \
569 }) \
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100570 })
571
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100572/** Load a tile from global memory (tensor) when the tensor is stored using a NHWC layout with dilation for the X and Y increments
573 *
574 * @param[in] DATA_TYPE Data type
575 * @param[in] TILE_HEIGHT Number of elements to load from Y (height) dimension
576 * @param[in] TILE_WIDTH Number of elements to load from X (width) dimension
577 * @param[in] TILE_CHANNELS Number of elements to load from C (channel) dimension
578 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image). Currently BUFFER only is supported
579 * In case of cl_image, only TILE_CHANNELS multiples of 4 are supported (4, 8, 16)
580 * @param[in] TENSOR Tensor basename
581 * @param[in] B Starting batch index
582 * @param[in] Y Starting Y index
583 * @param[in] X Starting X index
584 * @param[in] C Starting C index
585 * @param[in] TENSOR_HEIGHT Number of elements to load from Y (height) dimension
586 * @param[in] TENSOR_WIDTH Number of elements to load from X (width) dimension
587 * @param[in] DILATION_X Dilation for the X increment
588 * @param[in] DILATION_Y Dilation for the Y increment
589 * @param[in] BOUNDARY_CHECK Boundary check flag. If true, it checks for any out-of-bound reads
590 * @param[out] dst Output tile
591 */
592#define T_LOAD_NHWC_WITH_DILATION(DATA_TYPE, TILE_HEIGHT, TILE_WIDTH, TILE_CHANNELS, TENSOR_TYPE, TENSOR, B, Y, X, C, TENSOR_WIDTH, TENSOR_HEIGHT, DILATION_X, DILATION_Y, BOUNDARY_CHECK, dst) \
593 ({ \
594 LOOP_UNROLLING(int, _yk, 0, 1, TILE_HEIGHT, \
595 { \
596 LOOP_UNROLLING(int, _xk, 0, 1, TILE_WIDTH, \
597 { \
598 int _src_y = (X) + _xk * (DILATION_X); \
599 int _src_z = ((Y) + _yk * (DILATION_Y)); \
600 int _src_w = (B); \
601 bool _src_valid_y = (((X) + _xk * (DILATION_X)) >= 0) && (((X) + _xk * (DILATION_X)) < (int)(TENSOR_WIDTH)) && (((Y) + _yk * (DILATION_Y)) >= 0) && (((Y) + _yk * (DILATION_Y)) < (int)(TENSOR_HEIGHT)); \
602 if(!(BOUNDARY_CHECK)) \
603 { \
604 dst[_xk + _yk * (TILE_WIDTH)].v = VLOAD(TILE_CHANNELS) \
605 (0, (__global DATA_TYPE *)(TENSOR##_ptr + TENSOR##_offset_first_element_in_bytes + (C) * sizeof(DATA_TYPE) + (_src_y) * (TENSOR##_stride_y) + (_src_z) * (TENSOR##_stride_z) + (_src_w) * (TENSOR##_stride_w))); \
606 } \
607 else \
608 { \
609 if(_src_valid_y) \
610 { \
611 dst[_xk + _yk * (TILE_WIDTH)].v = VLOAD(TILE_CHANNELS) \
612 (0, (__global DATA_TYPE *)(TENSOR##_ptr + TENSOR##_offset_first_element_in_bytes + (C) * sizeof(DATA_TYPE) + (_src_y) * (TENSOR##_stride_y) + (_src_z) * (TENSOR##_stride_z) + (_src_w) * (TENSOR##_stride_w))); \
613 } \
614 } \
615 }) \
616 }) \
617 })
618
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100619/** Load a tile from global memory (tensor) when the tensor is stored using a NHWC layout using indirect X and Y coordinates
620 *
621 * @param[in] DATA_TYPE Data type
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100622 * @param[in] TILE_AREA Number of elements to load from Y (height) dimension * Number of elements to load from X (width) dimension
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100623 * @param[in] TILE_CHANNELS Number of elements to load from C (channel) dimension
624 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image). Currently BUFFER only is supported
625 * In case of cl_image, only TILE_CHANNELS multiples of 4 are supported (4, 8, 16)
626 * @param[in] TENSOR Tensor basename
627 * @param[in] B Starting batch index
628 * @param[in] Y Starting Y index
629 * @param[in] X Starting X index
630 * @param[in] C Starting C index
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100631 * @param[in] TENSOR_WIDTH Number of elements to load from X (width) dimension
Giorgio Arena945ae9e2021-10-13 11:13:04 +0100632 * @param[in] TENSOR_HEIGHT Number of elements to load from Y (height) dimension
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100633 * @param[in] STRIDE_Y Stride Y (in bytes)
634 * @param[out] xi A tile with (TILE_WIDTH x TILE_HEIGHT) values with the indirect X coordinate
635 * @param[out] yi A tile with (TILE_WIDTH x TILE_HEIGHT) values with the indirect Y coordinate
636 * @param[out] dst Output tile
637 */
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100638#define T_LOAD_NHWC_INDIRECT(DATA_TYPE, TILE_AREA, TILE_CHANNELS, TENSOR_TYPE, TENSOR, B, Y, X, C, TENSOR_WIDTH, TENSOR_HEIGHT, STRIDE_Y, xi, yi, dst) \
639 ({ \
640 LOOP_UNROLLING(int, _i, 0, 1, TILE_AREA, \
641 { \
642 int _src_y = (X) + xi[_i].v + ((Y) + yi[_i].v) * (TENSOR_WIDTH); \
643 _src_y += (B) * (int)(TENSOR_WIDTH) * (int)(TENSOR_HEIGHT); \
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100644 int _src_valid_y = (((X) + xi[_i].v) >= 0 && ((X) + xi[_i].v) < (int)(TENSOR_WIDTH) && ((Y) + yi[_i].v) >= 0 && ((Y) + yi[_i].v) < (int)(TENSOR_HEIGHT)); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100645 if(_src_valid_y != 0) \
646 { \
647 dst[_i].v = V_LOAD(DATA_TYPE, TILE_CHANNELS, TENSOR_TYPE, TENSOR, C, _src_y, STRIDE_Y); \
Gian Marco Iodice0b76f7d2021-04-08 17:20:00 +0100648 } \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100649 }) \
Gian Marco Iodice534b8892021-04-01 16:17:16 +0100650 })
651
Giorgio Arena945ae9e2021-10-13 11:13:04 +0100652/** Load a tile from global memory (tensor) when the tensor is stored using a NDHWC layout using indirect X, Y and Z coordinates
653 *
654 * @param[in] DATA_TYPE Data type
655 * @param[in] TILE_AREA Number of elements to load from Y (height) dimension * Number of elements to load from X (width) dimension
656 * @param[in] TILE_CHANNELS Number of elements to load from C (channel) dimension
657 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image). Currently BUFFER only is supported
658 * In case of cl_image, only TILE_CHANNELS multiples of 4 are supported (4, 8, 16)
659 * @param[in] TENSOR Tensor basename
660 * @param[in] B Starting batch index
661 * @param[in] Z Starting Z index
662 * @param[in] Y Starting Y index
663 * @param[in] X Starting X index
664 * @param[in] C Starting C index
665 * @param[in] TENSOR_WIDTH Number of elements to load from X (width) dimension
666 * @param[in] TENSOR_HEIGHT Number of elements to load from Y (height) dimension
667 * @param[in] TENSOR_DEPTH Number of elements to load from Z (depth) dimension
668 * @param[in] STRIDE_Y Stride Y (in bytes)
669 * @param[out] xi A tile with (TILE_WIDTH x TILE_HEIGHT) values with the indirect X coordinate
670 * @param[out] yi A tile with (TILE_WIDTH x TILE_HEIGHT) values with the indirect Y coordinate
671 * @param[out] zi A tile with (TILE_WIDTH x TILE_HEIGHT) values with the indirect Z coordinate
672 * @param[out] dst Output tile
673 */
674#define T_LOAD_NDHWC_INDIRECT(DATA_TYPE, TILE_AREA, TILE_CHANNELS, TENSOR_TYPE, TENSOR, B, Z, Y, X, C, TENSOR_WIDTH, TENSOR_HEIGHT, TENSOR_DEPTH, STRIDE_Y, xi, yi, zi, dst) \
675 ({ \
676 LOOP_UNROLLING(int, _i, 0, 1, TILE_AREA, \
677 { \
678 int _src_y = (X) + xi[_i].v + ((Y) + yi[_i].v) * (TENSOR_WIDTH) + ((Z) + zi[_i].v) * (TENSOR_WIDTH * TENSOR_HEIGHT); \
679 _src_y += (B) * (int)(TENSOR_WIDTH) * (int)(TENSOR_HEIGHT) * (int)(TENSOR_DEPTH); \
680 int _src_valid_y = (((X) + xi[_i].v) >= 0 && ((X) + xi[_i].v) < (int)(TENSOR_WIDTH) && ((Y) + yi[_i].v) >= 0 && ((Y) + yi[_i].v) < (int)(TENSOR_HEIGHT) \
681 && ((Z) + zi[_i].v) >= 0 && ((Z) + zi[_i].v) < (int)(TENSOR_DEPTH)); \
682 if(_src_valid_y != 0) \
683 { \
684 dst[_i].v = V_LOAD(DATA_TYPE, TILE_CHANNELS, TENSOR_TYPE, TENSOR, C, _src_y, STRIDE_Y); \
685 } \
686 }) \
687 })
688
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000689/** Store a tile to global memory (tensor) using an indirect Y index tile and conditionally use a different length for the store
690 *
691 * @note If WIDTH1_CONDITION is true, the store will use the WIDTH1 length for the store
692 * @note The vectors are stored in reverse order so the invalid rows are overwritten by the valid ones
693 *
694 * @param[in] DATA_TYPE Data type
695 * @param[in] HEIGHT Number of src rows
696 * @param[in] WIDTH0 Store width to use if WIDTH1_CONDITION = false
697 * @param[in] WIDTH1 Store width to use if WIDTH1_CONDITION = true
698 * @param[in] TENSOR_TYPE Type of cl_type used to store the tensor in global memory (BUFFER=cl_buffer, IMAGE=cl_image). Currently BUFFER only is supported
699 * cl_image is not supported.
700 * @param[in] TENSOR Tensor basename
701 * @param[in] X Starting X position
702 * @param[in] STRIDE_Y Stride Y (in bytes)
703 * @param[in] WIDTH1_CONDITION Condition to select the WIDTH1 store
704 * @param[in] src Input tile
705 * @param[in] indirect_y Indirect Y index tile
706 */
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000707#define T_STORE_INDIRECT_WIDTH_SELECT(DATA_TYPE, HEIGHT, WIDTH0, WIDTH1, TENSOR_TYPE, TENSOR, X, STRIDE_Y, WIDTH1_CONDITION, src, indirect_y) \
708 ({ \
709 if(WIDTH1_CONDITION) \
710 { \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100711 LOOP_UNROLLING(int, _i, 0, 1, HEIGHT, \
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000712 { \
713 VSTORE_PARTIAL(WIDTH0, WIDTH1) \
Giorgio Arena945ae9e2021-10-13 11:13:04 +0100714 (CONVERT(src[HEIGHT - 1 - _i].v, VEC_DATA_TYPE(DATA_TYPE, WIDTH0)), 0, (__global DATA_TYPE *)(TENSOR##_ptr + TENSOR##_offset_first_element_in_bytes + (X) * sizeof(DATA_TYPE) + (indirect_y[HEIGHT - 1 - _i].v) * STRIDE_Y)); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100715 }) \
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000716 } \
717 else \
718 { \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100719 LOOP_UNROLLING(int, _i, 0, 1, HEIGHT, \
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000720 { \
721 VSTORE(WIDTH0) \
Giorgio Arena945ae9e2021-10-13 11:13:04 +0100722 (CONVERT(src[HEIGHT - 1 - _i].v, VEC_DATA_TYPE(DATA_TYPE, WIDTH0)), 0, (__global DATA_TYPE *)(TENSOR##_ptr + TENSOR##_offset_first_element_in_bytes + (X) * sizeof(DATA_TYPE) + (indirect_y[HEIGHT - 1 - _i].v) * STRIDE_Y)); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100723 }) \
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000724 } \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000725 })
726
727/** Offset correction for the QASYMM8 computation
728 *
729 * @param[in] ACC_DATA_TYPE Accumulator data type
730 * @param[in] M0 Number of src/dst rows
731 * @param[in] N0 Number of src/dst columns
732 * @param[in] K0 Number of src columns
733 * @param[in] SRC_OFFSET Source quantization offset
734 * @param[in] WEI_OFFSET Weights quantization shift
735 * @param[in] lhs LHS tile
736 * @param[in] rhs RHS tile
737 * @param[out] dst DST tile
738 */
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100739#define T_OFFSET_CORRECTION(ACC_DATA_TYPE, M0, N0, K0, SRC_OFFSET, WEI_OFFSET, lhs, rhs, dst) \
740 ({ \
741 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
742 { \
743 ACC_DATA_TYPE _tm = 0; \
744 LOOP_UNROLLING(int, _k0, 0, 1, K0, \
745 { \
746 _tm += ((ACC_DATA_TYPE)lhs[_m0].s[_k0] * (ACC_DATA_TYPE)WEI_OFFSET); \
747 }) \
748 LOOP_UNROLLING(int, _n0, 0, 1, N0, \
749 { \
750 dst[_m0].s[_n0] += _tm; \
751 LOOP_UNROLLING(int, _k0, 0, 1, K0, \
752 { \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000753 dst[_m0].s[_n0] += ((ACC_DATA_TYPE)rhs[_n0].s[_k0] * (ACC_DATA_TYPE)SRC_OFFSET); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100754 }) \
755 }) \
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100756 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000757 })
758
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100759/** 8-bit quantization with fixed-point scale
760 *
761 * @param[in] SRC_DATA_TYPE SRC data type
762 * @param[in] DST_DATA_TYPE DST data type
763 * @param[in] QUANTIZATION_TYPE Quantization type (PER_TENSOR or PER_CHANNEL)
764 * @param[in] M0 Number of src/dst rows
765 * @param[in] N0 Number of src/dst columns
766 * @param[in] DST_OFFSET Quantization offset used for both the per-tensor and per-channel quantization
767 * @param[in] DST_SHIFT Quantization shift for the per-tensor quantization
768 * @param[in] DST_MULTIPLIER Quantization multiplier for the per-tensor quantization
769 * @param[in] src Input tile
770 * @param[in] dst_multipliers Output multipliers tile for the per-channel quantization
771 * @param[in] dst_shifts Output shift tile for the per-channel quantization
772 * @param[out] dst Output tile
773 */
774#define T_QUANTIZE8(SRC_DATA_TYPE, DST_DATA_TYPE, QUANTIZATION_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst_multipliers, dst_shifts, dst) T_QUANTIZE8_STR(SRC_DATA_TYPE, DST_DATA_TYPE, QUANTIZATION_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst_multipliers, dst_shifts, dst)
775#define T_QUANTIZE8_STR(SRC_DATA_TYPE, DST_DATA_TYPE, QUANTIZATION_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst_multipliers, dst_shifts, dst) T_QUANTIZE8_##QUANTIZATION_TYPE(SRC_DATA_TYPE, DST_DATA_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst_multipliers, dst_shifts, dst)
776
777/** 8-bit per-tensor quantization with fixed-point scale
778 *
779 * @param[in] SRC_DATA_TYPE SRC data type
780 * @param[in] DST_DATA_TYPE DST data type
781 * @param[in] M0 Number of src/dst rows
782 * @param[in] N0 Number of src/dst columns
783 * @param[in] DST_OFFSET Quantization offset
784 * @param[in] DST_SHIFT Quantization shift for the per-tensor quantization
785 * @param[in] DST_MULTIPLIER Quantization multiplier for the per-tensor quantization
786 * @param[in] src Input tile
787 * @param[in] dst_multipliers (unused)
788 * @param[in] dst_shifts (unused)
789 * @param[out] dst Output tile
790 */
791#define T_QUANTIZE8_PER_TENSOR(SRC_DATA_TYPE, DST_DATA_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst_multipliers, dst_shifts, dst) \
792 ({ \
793 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
794 { \
795 LOOP_UNROLLING(int, _n0, 0, 1, N0, \
796 { \
797 SRC_DATA_TYPE _tmp = 0; \
798 SRC_DATA_TYPE _src = src[_m0].s[_n0]; \
799 _src *= select((SRC_DATA_TYPE)1, ((SRC_DATA_TYPE)1 << (SRC_DATA_TYPE)(-DST_SHIFT)), ((SRC_DATA_TYPE)DST_SHIFT < (SRC_DATA_TYPE)0)); \
800 SRC_DATA_TYPE overflow = _src == DST_MULTIPLIER && _src == INT_MIN; \
801 long a_64 = (long)(_src); \
802 long b_64 = (long)(DST_MULTIPLIER); \
803 long ab_64 = a_64 * b_64; \
804 long mask1 = 1 << 30; \
805 long mask2 = 1 - (1 << 30); \
806 long is_positive_or_zero = ab_64 >= 0; \
807 long nudge = select(mask2, mask1, is_positive_or_zero); \
808 SRC_DATA_TYPE ab_x2_high32 = CONVERT((ab_64 + nudge) / (long)(1ll << 31), SRC_DATA_TYPE); \
809 _tmp = select(ab_x2_high32, (SRC_DATA_TYPE)INT_MAX, overflow); \
810 if(DST_SHIFT >= 0) \
811 { \
Freddie Liardet767dbf92021-07-21 16:20:41 +0100812 long mask = ((((int)1) << DST_SHIFT) - (long)1); \
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100813 long threshold = _tmp < (int)0 ? (mask >> 1) + (long)1 : (mask >> 1) + 0; \
814 _tmp = (_tmp & mask) > threshold ? (_tmp >> DST_SHIFT) + (int)1 : (_tmp >> DST_SHIFT); \
815 } \
816 _tmp += DST_OFFSET; \
817 dst[_m0].s[_n0] = CONVERT_SAT(_tmp, DST_DATA_TYPE); \
818 }) \
819 }) \
820 })
821
822/** 8-bit per-channel quantization with fixed-point scale
823 *
824 * @param[in] SRC_DATA_TYPE SRC data type
825 * @param[in] DST_DATA_TYPE DST data type
826 * @param[in] M0 Number of src/dst rows
827 * @param[in] N0 Number of src/dst columns
828 * @param[in] DST_OFFSET Quantization offset
829 * @param[in] DST_SHIFT (unused)
830 * @param[in] DST_MULTIPLIER (unused)
831 * @param[in] src Input tile
832 * @param[in] dst_multipliers Output multipliers tile for the per-channel quantization
833 * @param[in] dst_shifts Output shift tile for the per-channel quantization
834 * @param[out] dst Output tile
835 */
836#define T_QUANTIZE8_PER_CHANNEL(SRC_DATA_TYPE, DST_DATA_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst_multipliers, dst_shifts, dst) \
837 ({ \
838 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
839 { \
840 LOOP_UNROLLING(int, _n0, 0, 1, N0, \
841 { \
842 SRC_DATA_TYPE _tmp = 0; \
843 SRC_DATA_TYPE _src = src[_m0].s[_n0]; \
844 SRC_DATA_TYPE _dst_multiplier = dst_multipliers[0].s[_n0]; \
845 SRC_DATA_TYPE _dst_shift = dst_shifts[0].s[_n0]; \
846 _src *= select((SRC_DATA_TYPE)1, ((SRC_DATA_TYPE)1 << (SRC_DATA_TYPE)(-_dst_shift)), ((SRC_DATA_TYPE)_dst_shift < (SRC_DATA_TYPE)0)); \
847 SRC_DATA_TYPE overflow = _src == _dst_multiplier && _src == INT_MIN; \
848 long a_64 = (long)(_src); \
849 long b_64 = (long)(_dst_multiplier); \
850 long ab_64 = a_64 * b_64; \
851 long mask1 = 1 << 30; \
852 long mask2 = 1 - (1 << 30); \
853 long is_positive_or_zero = ab_64 >= 0; \
854 long nudge = select(mask2, mask1, is_positive_or_zero); \
855 SRC_DATA_TYPE ab_x2_high32 = CONVERT((ab_64 + nudge) / (long)(1ll << 31), SRC_DATA_TYPE); \
856 _tmp = select(ab_x2_high32, (SRC_DATA_TYPE)INT_MAX, overflow); \
857 if(_dst_shift >= 0) \
858 { \
859 long mask = ((((int)1) << _dst_shift) - (int)1); \
860 long threshold = _tmp < (int)0 ? (mask >> 1) + (long)1 : (mask >> 1) + 0; \
861 _tmp = (_tmp & mask) > threshold ? (_tmp >> _dst_shift) + (int)1 : (_tmp >> _dst_shift); \
862 } \
863 _tmp += DST_OFFSET; \
864 dst[_m0].s[_n0] = CONVERT_SAT(_tmp, DST_DATA_TYPE); \
865 }) \
866 }) \
867 })
868
869/** Quantized the 8-bit tile with fixed-point scale for asymmetric
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000870 *
871 * @param[in] SRC_DATA_TYPE SRC data type
872 * @param[in] DST_DATA_TYPE DST data type
873 * @param[in] M0 Number of src/dst rows
874 * @param[in] N0 Number of src/dst columns
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100875 * @param[in] DST_OFFSET Quantization offset used for both the per-tensor and per-channel quantization
876 * @param[in] DST_SHIFT Quantization shift for the per-tensor quantization
877 * @param[in] DST_MULTIPLIER Quantization multiplier for the per-tensor quantization
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000878 * @param[in] src Input tile
879 * @param[out] dst Output tile
880 */
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100881#define T_QUANTIZE8_ASYMMETRIC(SRC_DATA_TYPE, DST_DATA_TYPE, M0, N0, DST_OFFSET, DST_SHIFT, DST_MULTIPLIER, src, dst) \
882 ({ \
883 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
884 { \
885 LOOP_UNROLLING(int, _n0, 0, 1, N0, \
886 { \
887 SRC_DATA_TYPE _tmp = 0; \
888 SRC_DATA_TYPE _src = src[_m0].s[_n0]; \
889 _src *= select((SRC_DATA_TYPE)1, ((SRC_DATA_TYPE)1 << (SRC_DATA_TYPE)(-DST_SHIFT)), ((SRC_DATA_TYPE)DST_SHIFT < (SRC_DATA_TYPE)0)); \
890 SRC_DATA_TYPE overflow = _src == DST_MULTIPLIER && _src == INT_MIN; \
891 long a_64 = (long)(_src); \
892 long b_64 = (long)(DST_MULTIPLIER); \
893 long ab_64 = a_64 * b_64; \
894 long mask1 = 1 << 30; \
895 long mask2 = 1 - (1 << 30); \
896 long is_positive_or_zero = ab_64 >= 0; \
897 long nudge = select(mask2, mask1, is_positive_or_zero); \
898 SRC_DATA_TYPE ab_x2_high32 = CONVERT((ab_64 + nudge) / (long)(1ll << 31), SRC_DATA_TYPE); \
899 _tmp = select(ab_x2_high32, (SRC_DATA_TYPE)INT_MAX, overflow); \
900 if(DST_SHIFT >= 0) \
901 { \
902 long mask = ((((int)1) << DST_SHIFT) - (int)1); \
903 long threshold = _tmp < (int)0 ? (mask >> 1) + (long)1 : (mask >> 1) + 0; \
904 _tmp = (_tmp & mask) > threshold ? (_tmp >> DST_SHIFT) + (int)1 : (_tmp >> DST_SHIFT); \
905 } \
906 _tmp += DST_OFFSET; \
907 dst[_m0].s[_n0] = CONVERT_SAT(_tmp, DST_DATA_TYPE); \
908 }) \
909 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000910 })
911
912/** Conditional rowset (memset by row)
913 *
914 * @note Set the row to VALUE_TO_SET if the corresponding mask == 0
915 *
916 * @param[in] DATA_TYPE Data type
917 * @param[in] M0 Number of LHS rows
918 * @param[in] N0 Number of LHS columns
919 * @param[in] VALUE_TO_SET Value to set the row
920 * @param[in, out] a Input/output tile
921 * @param[out] mask Mask to check for setting the row to VALUE_TO_SET
922 */
923#define T_ROWSET_MASK(DATA_TYPE, M0, N0, VALUE_TO_SET, a, mask) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100924 ({ \
925 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
926 { \
927 LOOP_UNROLLING(int, _n0, 0, 1, N0, \
928 { \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000929 a[_m0].s[_n0] = select((DATA_TYPE)(a[_m0].s[_n0]), (DATA_TYPE)(VALUE_TO_SET), (SELECT_DATA_TYPE(DATA_TYPE))(mask[_m0].v == (DATA_TYPE)0)); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100930 }) \
931 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000932 })
933
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100934/** Element-wise activation for floating point types
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000935 *
936 * @note Performs: activation(LHS) = DST
937 *
938 * @param[in] DATA_TYPE SRC/DST data type
939 * @param[in] M0 Number of SRC/DST rows
940 * @param[in] N0 Number of SRC/DST columns
941 * @param[in] ACTIVATION_TYPE Activation type
942 * @param[in] A_VAL A value used for the activation (e.g. tanh_op, brelu,..)
943 * @param[in] B_VAL B value used for the activation (e.g. tanh_op, brelu,..)
944 * @param[out] src SRC tile
945 * @param[out] dst DST tile
946 */
947#define T_ACTIVATION(DATA_TYPE, M0, N0, ACTIVATION_TYPE, A_VAL, B_VAL, src, dst) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100948 ({ \
949 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
950 { \
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000951 dst[_m0].v = ACTIVATION(ACTIVATION_TYPE, DATA_TYPE, N0, src[_m0].v, A_VAL, B_VAL); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +0100952 }) \
Gian Marco Iodicea8903c82021-03-24 14:48:22 +0000953 })
954
Gian Marco Iodice8155c022021-04-16 15:08:59 +0100955// RELU Activation
956#define relu_op_quantized(DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) (max((DATA_TYPE)ZERO_VALUE, x))
957// Bounded RELU Activation
958#define brelu_op_quantized(DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) (min((DATA_TYPE)A_VAL, max((DATA_TYPE)ZERO_VALUE, x)))
959// Lower Upper Bounded RELU Activation
960#define lu_brelu_op_quantized(DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) (min(max(x, (DATA_TYPE)B_VAL), (DATA_TYPE)A_VAL))
961// Hard Swish Activation
962#define hard_swish_op_quantized(DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) (x * ((min(max((DATA_TYPE)(x + (DATA_TYPE)3.f), (DATA_TYPE)0.f), (DATA_TYPE)6.f)) * (DATA_TYPE)0.166666667f))
963// Identity Activation
964#define identity_op_quantized(DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) (x)
965
966#define ACT_OP_QUANTIZED(op, DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) op##_op_quantized(DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x)
967#define ACTIVATION_QUANTIZED(op, DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x) ACT_OP_QUANTIZED(op, DATA_TYPE, VEC_SIZE, ZERO_VALUE, A_VAL, B_VAL, x)
968
969/** Element-wise activation for quantized types
970 *
971 * @note Performs: activation(LHS) = DST
972 *
973 * @param[in] DATA_TYPE SRC/DST data type
974 * @param[in] M0 Number of SRC/DST rows
975 * @param[in] N0 Number of SRC/DST columns
976 * @param[in] ACTIVATION_TYPE Activation type
977 * @param[in] ZERO_VALUE The zero value to consider in the computation
978 * @param[in] A_VAL A value used for the activation (e.g. tanh_op, brelu,..)
979 * @param[in] B_VAL B value used for the activation (e.g. tanh_op, brelu,..)
980 * @param[out] src SRC tile
981 * @param[out] dst DST tile
982 */
983#define T_ACTIVATION_QUANTIZED(DATA_TYPE, M0, N0, ACTIVATION_TYPE, ZERO_VALUE, A_VAL, B_VAL, src, dst) \
984 ({ \
985 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
986 { \
987 dst[_m0].v = ACTIVATION_QUANTIZED(ACTIVATION_TYPE, DATA_TYPE, N0, ZERO_VALUE, A_VAL, B_VAL, src[_m0].v); \
988 }) \
989 })
990
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +0000991/** Element-wise addition with a constant value
992 *
993 * @note Performs: LHS + constant = DST
994 *
995 * @param[in] DATA_TYPE LHS/RHS/DST data type
996 * @param[in] M0 Number of LHS rows
997 * @param[in] N0 Number of LHS columns
998 * @param[in] lhs LHS tile
999 * @param[in] rhs_constant Constant value
1000 * @param[out] dst DST tile
1001 */
1002#define T_ADD_CONSTANT(DATA_TYPE, M0, N0, lhs, rhs_constant, dst) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001003 ({ \
1004 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
1005 { \
Ramy Elgammal451c3092022-02-01 23:01:27 +00001006 LOOP_UNROLLING(int, _n0, 0, 1, N0, \
1007 { \
1008 dst[_m0].s[_n0] = lhs[_m0].s[_n0] + rhs_constant; \
1009 }) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001010 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001011 })
1012
1013/** Element-wise addition with RHS broadcasted (RHS has the X dimension only)
1014 *
1015 * @note Performs: LHS + RHS[broadcasted] = DST
1016 * @note Both tiles must have same data type
1017 *
Giorgio Arena945ae9e2021-10-13 11:13:04 +01001018 * @param[in] DST_DATA_TYPE DST data type
1019 * @param[in] M0 Number of LHS rows
1020 * @param[in] N0 Number of LHS columns
1021 * @param[in] lhs LHS tile
1022 * @param[in] rhs RHS tile
1023 * @param[out] dst DST tile
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001024 */
Giorgio Arena945ae9e2021-10-13 11:13:04 +01001025#define T_ADD_BROADCAST_X(DST_DATA_TYPE, M0, N0, lhs, rhs, dst) \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001026 ({ \
1027 LOOP_UNROLLING(int, _m0, 0, 1, M0, \
1028 { \
Giorgio Arena945ae9e2021-10-13 11:13:04 +01001029 dst[_m0].v = CONVERT(lhs[_m0].v, VEC_DATA_TYPE(DST_DATA_TYPE, N0)) + CONVERT(rhs[0].v, VEC_DATA_TYPE(DST_DATA_TYPE, N0)); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001030 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001031 })
1032
1033/** Matrix multiplication
1034 *
1035 * @note Performs: LHS X RHS + DST = DST
1036 *
1037 * @param[in] LHS_DATA_TYPE LHS tile data type
1038 * @param[in] RHS_DATA_TYPE RHS tile data type
1039 * @param[in] DST_DATA_TYPE RHS tile data type
1040 * @param[in] M0 Number of LHS rows
1041 * @param[in] N0 Number of RHS columns
1042 * @param[in] K0 Number of LHS columns
1043 * @param[in] LHS_LAYOUT LHS layout (T= transposed, NT= not transposed)
1044 * @param[in] RHS_LAYOUT RHS layout (T= transposed, NT= not transposed)
1045 * @param[in] lhs LHS tile
1046 * @param[in] rhs RHS tile
1047 * @param[in, out] dst DST tile
1048 */
1049#define T_MMUL(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, LHS_LAYOUT, RHS_LAYOUT, lhs, rhs, dst) T_MMUL_##LHS_LAYOUT##_##RHS_LAYOUT(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
Gian Marco Iodice8155c022021-04-16 15:08:59 +01001050#define T_MMUL_NT_T(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_##LHS_DATA_TYPE##_##RHS_DATA_TYPE##_##DST_DATA_TYPE(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
1051#define T_MMUL_NT_T_float_float_float(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_FLOAT(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
Giorgio Arena945ae9e2021-10-13 11:13:04 +01001052#define T_MMUL_NT_T_half_half_float(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_FLOAT(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
Gian Marco Iodice8155c022021-04-16 15:08:59 +01001053#define T_MMUL_NT_T_half_half_half(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_FLOAT(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
1054#define T_MMUL_NT_T_char_char_int(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_INTEGER8(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
1055#define T_MMUL_NT_T_uchar_uchar_uint(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_INTEGER8(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
1056#define T_MMUL_NT_T_uchar_uchar_int(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) T_MMUL_NT_T_INTEGER8(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst)
1057#define T_MMUL_NT_T_FLOAT(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001058 { \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001059 LOOP_UNROLLING(int, _m, 0, 1, M0, \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001060 { \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001061 LOOP_UNROLLING(int, _n, 0, 1, N0, \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001062 { \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001063 LOOP_UNROLLING(int, _k, 0, 1, K0, \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001064 { \
Giorgio Arena945ae9e2021-10-13 11:13:04 +01001065 dst[_m].s[_n] = fma((DST_DATA_TYPE)(lhs[_m].s[_k]), (DST_DATA_TYPE)(rhs[_n].s[_k]), dst[_m].s[_n]); \
Giorgio Arenabdd16d12021-05-13 16:58:51 +01001066 }) \
1067 }) \
1068 }) \
Gian Marco Iodice5c9eed82021-03-19 11:26:20 +00001069 }
Gian Marco Iodice8155c022021-04-16 15:08:59 +01001070
1071#define T_MMUL_NT_T_INTEGER8(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, M0, N0, K0, lhs, rhs, dst) \
1072 ({ \
1073 LOOP_UNROLLING(int, _m, 0, 1, M0, \
1074 { \
1075 LOOP_UNROLLING(int, _n, 0, 1, N0, \
1076 { \
1077 DOT_PRODUCT_INTEGER8(LHS_DATA_TYPE, RHS_DATA_TYPE, DST_DATA_TYPE, K0, (lhs[_m].v), (rhs[_n].v), dst[_m].s[_n]); \
1078 }) \
1079 }) \
Gian Marco Iodice561c1762021-04-16 15:08:59 +01001080 })
SiCong Lica364df2022-04-13 15:48:19 +01001081
1082#endif // ARM_COMPUTE_TILE_HELPERS_H