1 | namespace dnnl { |
2 | namespace impl { |
3 | namespace gpu { |
4 | namespace ocl { |
5 | const char *gen9_wino_conv_fwd_data_2x3_kernel = R"==(/******************************************************************************* )==" "\n" |
6 | R"==(* Copyright 2020 Intel Corporation )==" "\n" |
7 | R"==(* )==" "\n" |
8 | R"==(* Licensed under the Apache License, Version 2.0 (the "License"); )==" "\n" |
9 | R"==(* you may not use this file except in compliance with the License. )==" "\n" |
10 | R"==(* You may obtain a copy of the License at )==" "\n" |
11 | R"==(* )==" "\n" |
12 | R"==(* http: )==" "\n" |
13 | R"==(* )==" "\n" |
14 | R"==(* Unless required by applicable law or agreed to in writing, software )==" "\n" |
15 | R"==(* distributed under the License is distributed on an "AS IS" BASIS, )==" "\n" |
16 | R"==(* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. )==" "\n" |
17 | R"==(* See the License for the specific language governing permissions and )==" "\n" |
18 | R"==(* limitations under the License. )==" "\n" |
19 | R"==(*******************************************************************************/ )==" "\n" |
20 | R"==(#include "gpu/ocl/ocl_post_ops.h" )==" "\n" |
21 | R"==(#include "gpu/ocl/ocl_types.h" )==" "\n" |
22 | R"==(#define BLOCK_SIZE OC_BLOCK )==" "\n" |
23 | R"==(#define BLOCKED_DATA_T CONCAT2(DATA_T, BLOCK_SIZE) )==" "\n" |
24 | R"==(#define BLOCKED_READ(ptr) vload16(0, ptr) )==" "\n" |
25 | R"==(#define BLOCKED_WRITE(data, ptr) \ )==" "\n" |
26 | R"==(do { \ )==" "\n" |
27 | R"==(BLOCKED_DATA_T result = data; \ )==" "\n" |
28 | R"==(unroll_for(int _i = 0; _i < BLOCK_SIZE; _i++) { \ )==" "\n" |
29 | R"==((ptr)[_i] = result[_i]; \ )==" "\n" |
30 | R"==(} \ )==" "\n" |
31 | R"==(} while (0) )==" "\n" |
32 | R"==(#define VECT_SIZE 4 )==" "\n" |
33 | R"==(#define VECT_DATA_T CONCAT2(DATA_T, VECT_SIZE) )==" "\n" |
34 | R"==(#define AS_VECT_DATA_T AS_DATA4_T )==" "\n" |
35 | R"==(#define AS_VECT_BLOCK_DATA_T AS_BLOCK_DATA4_T )==" "\n" |
36 | R"==(#define OC_OUTER_BLOCK OC_BLOCK )==" "\n" |
37 | R"==(#define IC_OUTER_BLOCK IC_BLOCK )==" "\n" |
38 | R"==(#define WINO_D (WINO_M + WINO_R - 1) )==" "\n" |
39 | R"==(#define VW WINO_IW )==" "\n" |
40 | R"==(#define VH WINO_IH )==" "\n" |
41 | R"==(#define VC WINO_IC )==" "\n" |
42 | R"==(#define MW WINO_OW )==" "\n" |
43 | R"==(#define MH WINO_OH )==" "\n" |
44 | R"==(#define MC WINO_OC )==" "\n" |
45 | R"==(static inline int off_nCdhw16c( )==" "\n" |
46 | R"==(int n, int c, int d, int h, int w, int C, int D, int H, int W) { )==" "\n" |
47 | R"==(int off = 0; )==" "\n" |
48 | R"==(off += n * (C / 16) * D * H * W * 16; )==" "\n" |
49 | R"==(off += (c / 16) * D * H * W * 16; )==" "\n" |
50 | R"==(off += d * H * W * 16; )==" "\n" |
51 | R"==(off += h * W * 16; )==" "\n" |
52 | R"==(off += w * 16; )==" "\n" |
53 | R"==(off += c % 16; )==" "\n" |
54 | R"==(return off; )==" "\n" |
55 | R"==(} )==" "\n" |
56 | R"==(static inline int off_NCdhw16n16c( )==" "\n" |
57 | R"==(int n, int c, int d, int h, int w, int C, int D, int H, int W) { )==" "\n" |
58 | R"==(int off = 0; )==" "\n" |
59 | R"==(off += (n / 16) * (C / 16) * D * H * W * 16 * 16; )==" "\n" |
60 | R"==(off += (c / 16) * D * H * W * 16 * 16; )==" "\n" |
61 | R"==(off += d * H * W * 16 * 16; )==" "\n" |
62 | R"==(off += h * W * 16 * 16; )==" "\n" |
63 | R"==(off += w * 16 * 16; )==" "\n" |
64 | R"==(off += (n % 16) * 16; )==" "\n" |
65 | R"==(off += (c % 16); )==" "\n" |
66 | R"==(return off; )==" "\n" |
67 | R"==(} )==" "\n" |
68 | R"==(static inline int off_gIOdhw16i16o(int g, int o, int i, int d, int h, int w, )==" "\n" |
69 | R"==(int O, int I, int D, int H, int W) { )==" "\n" |
70 | R"==(int off = 0; )==" "\n" |
71 | R"==(off += g * (I / 16) * (O / 16) * D * H * W * 16 * 16; )==" "\n" |
72 | R"==(off += (i / 16) * (O / 16) * D * H * W * 16 * 16; )==" "\n" |
73 | R"==(off += (o / 16) * D * H * W * 16 * 16; )==" "\n" |
74 | R"==(off += d * H * W * 16 * 16; )==" "\n" |
75 | R"==(off += h * W * 16 * 16; )==" "\n" |
76 | R"==(off += w * 16 * 16; )==" "\n" |
77 | R"==(off += (i % 16) * 16; )==" "\n" |
78 | R"==(off += (o % 16); )==" "\n" |
79 | R"==(return off; )==" "\n" |
80 | R"==(} )==" "\n" |
81 | R"==(static inline int src_off(int n, int c, int d, int h, int w) { )==" "\n" |
82 | R"==(if (SRC_W16C) return off_nCdhw16c(n, c, d, h, w, G * IC, 1, IH, IW); )==" "\n" |
83 | R"==(if (SRC_16N16C) return off_NCdhw16n16c(n, c, d, h, w, G * IC, 1, IH, IW); )==" "\n" |
84 | R"==(return 0; )==" "\n" |
85 | R"==(} )==" "\n" |
86 | R"==(static inline int wei_off(int g, int o, int i, int d, int h, int w) { )==" "\n" |
87 | R"==(return off_gIOdhw16i16o(g, o, i, d, h, w, OC, IC, 1, KH, KW); )==" "\n" |
88 | R"==(} )==" "\n" |
89 | R"==(static inline int U_off(int o, int i, int h, int z) { )==" "\n" |
90 | R"==(int off = z * KH * WINO_IC * WINO_OC; )==" "\n" |
91 | R"==(off += h * WINO_IC * WINO_OC; )==" "\n" |
92 | R"==(off += i * WINO_OC; )==" "\n" |
93 | R"==(off += o; )==" "\n" |
94 | R"==(return off; )==" "\n" |
95 | R"==(} )==" "\n" |
96 | R"==(static inline int V_off(int n, int i, int h, int w, int z) { )==" "\n" |
97 | R"==(int off = n * WINO_D * VW * VH * VC; )==" "\n" |
98 | R"==(off += z * VW * VH * VC; )==" "\n" |
99 | R"==(off += w * VH * VC; )==" "\n" |
100 | R"==(off += (h + PH) * VC; )==" "\n" |
101 | R"==(off += i; )==" "\n" |
102 | R"==(return off; )==" "\n" |
103 | R"==(} )==" "\n" |
104 | R"==(static inline int M_off(int n, int o, int h, int w, int z) { )==" "\n" |
105 | R"==(int off = n * WINO_D * MW * MH * MC; )==" "\n" |
106 | R"==(off += z * MW * MH * MC; )==" "\n" |
107 | R"==(off += w * MH * MC; )==" "\n" |
108 | R"==(off += h * MC; )==" "\n" |
109 | R"==(off += o; )==" "\n" |
110 | R"==(return off; )==" "\n" |
111 | R"==(} )==" "\n" |
112 | R"==(static inline int dst_off(int n, int c, int d, int h, int w) { )==" "\n" |
113 | R"==(if (DST_W16C) return off_nCdhw16c(n, c, d, h, w, G * OC, 1, OH, OW); )==" "\n" |
114 | R"==(if (DST_16N16C) return off_NCdhw16n16c(n, c, d, h, w, G * OC, 1, OH, OW); )==" "\n" |
115 | R"==(return 0; )==" "\n" |
116 | R"==(} )==" "\n" |
117 | R"==(__kernel void gen9_wino_wei_transform_2x3( )==" "\n" |
118 | R"==(__global DATA_T *U, const __global DATA_T *weights) { )==" "\n" |
119 | R"==(const uint weights_tile_width = WINO_M; )==" "\n" |
120 | R"==(const uint weights_tile_height = 1; )==" "\n" |
121 | R"==(const uint in_kw = get_global_id(0) * weights_tile_width; )==" "\n" |
122 | R"==(const uint in_kh = get_global_id(1) * weights_tile_height; )==" "\n" |
123 | R"==(const uint U_tile_width = WINO_D; )==" "\n" |
124 | R"==(const uint U_tile_height = 1; )==" "\n" |
125 | R"==(const uint out_kw = get_global_id(0) * U_tile_width; )==" "\n" |
126 | R"==(const uint out_kh = get_global_id(1) * U_tile_height; )==" "\n" |
127 | R"==(const uint ic = get_global_id(2) % WINO_IC; )==" "\n" |
128 | R"==(const uint oc = get_global_id(2) / WINO_IC; )==" "\n" |
129 | R"==(uint in_idx = wei_off(0, oc, ic, 0, in_kh, in_kw); )==" "\n" |
130 | R"==(bool is_valid = ic < IC || oc < OC; )==" "\n" |
131 | R"==(VECT_DATA_T tile; )==" "\n" |
132 | R"==(tile.x = is_valid ? weights[in_idx] : 0; )==" "\n" |
133 | R"==(in_idx += wei_off(0, 0, 0, 0, 0, 1); )==" "\n" |
134 | R"==(tile.y = is_valid ? weights[in_idx] : 0; )==" "\n" |
135 | R"==(in_idx += wei_off(0, 0, 0, 0, 0, 1); )==" "\n" |
136 | R"==(tile.z = is_valid ? weights[in_idx] : 0; )==" "\n" |
137 | R"==(uint out_idx = U_off(oc, ic, out_kh, out_kw); )==" "\n" |
138 | R"==(U[out_idx] = tile.x; )==" "\n" |
139 | R"==(out_idx += U_off(0, 0, 0, 1); )==" "\n" |
140 | R"==(U[out_idx] = (tile.x + tile.y + tile.z) / 2; )==" "\n" |
141 | R"==(out_idx += U_off(0, 0, 0, 1); )==" "\n" |
142 | R"==(U[out_idx] = (tile.x - tile.y + tile.z) / 2; )==" "\n" |
143 | R"==(out_idx += U_off(0, 0, 0, 1); )==" "\n" |
144 | R"==(U[out_idx] = tile.z; )==" "\n" |
145 | R"==(} )==" "\n" |
146 | R"==(__kernel void gen9_wino_src_transform_2x3( )==" "\n" |
147 | R"==(__global DATA_T *V, const __global DATA_T *src) { )==" "\n" |
148 | R"==(const uint tile_id_x = get_global_id(0); )==" "\n" |
149 | R"==(const uint tile_id_y = get_global_id(1); )==" "\n" |
150 | R"==(const uint stride_x = WINO_M; )==" "\n" |
151 | R"==(const uint stride_y = 1; )==" "\n" |
152 | R"==(const uint iw = tile_id_x * stride_x - PW; )==" "\n" |
153 | R"==(const uint ih = tile_id_y * stride_y - PH; )==" "\n" |
154 | R"==(const uint ic = (get_global_id(2) % (WINO_IC / IC_BLOCK)) * IC_BLOCK; )==" "\n" |
155 | R"==(const uint n = get_global_id(2) / (WINO_IC / IC_BLOCK); )==" "\n" |
156 | R"==(const bool w0 = iw < 0 || iw >= IW; )==" "\n" |
157 | R"==(const bool w1 = iw + 1 < 0 || iw + 1 >= IW; )==" "\n" |
158 | R"==(const bool w2 = iw + 2 < 0 || iw + 2 >= IW; )==" "\n" |
159 | R"==(const bool w3 = iw + 3 < 0 || iw + 3 >= IW; )==" "\n" |
160 | R"==(const bool h0 = ih < 0 || ih >= IH || ic > IC; )==" "\n" |
161 | R"==(BLOCKED_DATA_T d0, d1, d2, d3; )==" "\n" |
162 | R"==(int in_idx = src_off(n, ic, 0, ih, iw); )==" "\n" |
163 | R"==(d0 = (h0 || w0) ? 0 : BLOCKED_READ(&src[in_idx]); )==" "\n" |
164 | R"==(in_idx += src_off(0, 0, 0, 0, 1); )==" "\n" |
165 | R"==(d1 = (h0 || w1) ? 0 : BLOCKED_READ(&src[in_idx]); )==" "\n" |
166 | R"==(in_idx += src_off(0, 0, 0, 0, 1); )==" "\n" |
167 | R"==(d2 = (h0 || w2) ? 0 : BLOCKED_READ(&src[in_idx]); )==" "\n" |
168 | R"==(in_idx += src_off(0, 0, 0, 0, 1); )==" "\n" |
169 | R"==(d3 = (h0 || w3) ? 0 : BLOCKED_READ(&src[in_idx]); )==" "\n" |
170 | R"==(int out_idx = V_off(n, ic, ih, tile_id_x, 0); )==" "\n" |
171 | R"==(BLOCKED_WRITE(d0 - d2, &V[out_idx]); )==" "\n" |
172 | R"==(out_idx += V_off(0, 0, -PH, 0, 1); )==" "\n" |
173 | R"==(BLOCKED_WRITE(d1 + d2, &V[out_idx]); )==" "\n" |
174 | R"==(out_idx += V_off(0, 0, -PH, 0, 1); )==" "\n" |
175 | R"==(BLOCKED_WRITE(-d1 + d2, &V[out_idx]); )==" "\n" |
176 | R"==(out_idx += V_off(0, 0, -PH, 0, 1); )==" "\n" |
177 | R"==(BLOCKED_WRITE(d1 - d3, &V[out_idx]); )==" "\n" |
178 | R"==(} )==" "\n" |
179 | R"==(__kernel void gen9_wino_dst_transform_2x3(__global DATA_T *dst, )==" "\n" |
180 | R"==(const __global DATA_T *M, const __global DATA_T *bias POST_OP_ARGS) { )==" "\n" |
181 | R"==(const uint tile_id_x = get_global_id(0); )==" "\n" |
182 | R"==(const uint tile_id_y = get_global_id(1); )==" "\n" |
183 | R"==(const uint dst_tile_width_x = WINO_M; )==" "\n" |
184 | R"==(const uint dst_tile_width_y = 1; )==" "\n" |
185 | R"==(const uint ow = tile_id_x * dst_tile_width_x; )==" "\n" |
186 | R"==(const uint oh = tile_id_y * dst_tile_width_y; )==" "\n" |
187 | R"==(const uint oc = (get_global_id(2) % (OC / OC_BLOCK)) * OC_BLOCK; )==" "\n" |
188 | R"==(const uint n = get_global_id(2) / (OC / OC_BLOCK); )==" "\n" |
189 | R"==(BLOCKED_DATA_T m0, m1, m2, m3; )==" "\n" |
190 | R"==(int M_idx = M_off(n, oc, tile_id_y, tile_id_x, 0); )==" "\n" |
191 | R"==(m0 = BLOCKED_READ(&M[M_idx]); )==" "\n" |
192 | R"==(M_idx += M_off(0, 0, 0, 0, 1); )==" "\n" |
193 | R"==(m1 = BLOCKED_READ(&M[M_idx]); )==" "\n" |
194 | R"==(M_idx += M_off(0, 0, 0, 0, 1); )==" "\n" |
195 | R"==(m2 = BLOCKED_READ(&M[M_idx]); )==" "\n" |
196 | R"==(M_idx += M_off(0, 0, 0, 0, 1); )==" "\n" |
197 | R"==(m3 = BLOCKED_READ(&M[M_idx]); )==" "\n" |
198 | R"==(BLOCKED_DATA_T C1 = m0 + m1 + m2; )==" "\n" |
199 | R"==(BLOCKED_DATA_T C2 = m1 - m2 - m3; )==" "\n" |
200 | R"==(if (WITH_BIAS || WITH_POST_OP) { )==" "\n" |
201 | R"==(const int c_size = WINO_M * OC_BLOCK; )==" "\n" |
202 | R"==(DATA_T C[c_size]; )==" "\n" |
203 | R"==(BLOCKED_WRITE(C1, &C[0]); )==" "\n" |
204 | R"==(BLOCKED_WRITE(C2, &C[OC_BLOCK]); )==" "\n" |
205 | R"==(if (WITH_BIAS) { )==" "\n" |
206 | R"==(for (int oc_outer = 0; oc_outer < OC_BLOCK; oc_outer++) { )==" "\n" |
207 | R"==(for (int ow_block = 0; ow_block < WINO_M; ow_block++) { )==" "\n" |
208 | R"==(const int c_off = ow_block * OC_BLOCK + oc_outer; )==" "\n" |
209 | R"==(const int bc_off = oc + oc_outer; )==" "\n" |
210 | R"==(C[c_off] += (OC_WO_PADDING % OC_BLOCK == 0 )==" "\n" |
211 | R"==(|| bc_off < OC_WO_PADDING) )==" "\n" |
212 | R"==(? bias[bc_off] )==" "\n" |
213 | R"==(: DATA_ZERO; )==" "\n" |
214 | R"==(} )==" "\n" |
215 | R"==(} )==" "\n" |
216 | R"==(} )==" "\n" |
217 | R"==(DATA_T S[c_size]; )==" "\n" |
218 | R"==(if (WITH_SUM) { )==" "\n" |
219 | R"==(BLOCKED_DATA_T S1, S2; )==" "\n" |
220 | R"==(int dst_idx = dst_off(n, oc, 0, oh, ow); )==" "\n" |
221 | R"==(S1 = BLOCKED_READ(&dst[dst_idx]); )==" "\n" |
222 | R"==(if (OW % WINO_M == 0 || ow < OW - 1) { )==" "\n" |
223 | R"==(dst_idx += dst_off(0, 0, 0, 0, 1); )==" "\n" |
224 | R"==(S2 = BLOCKED_READ(&dst[dst_idx]); )==" "\n" |
225 | R"==(} else { )==" "\n" |
226 | R"==(S2 = 0; )==" "\n" |
227 | R"==(} )==" "\n" |
228 | R"==(BLOCKED_WRITE(S1, &S[0]); )==" "\n" |
229 | R"==(BLOCKED_WRITE(S2, &S[OC_BLOCK]); )==" "\n" |
230 | R"==(} )==" "\n" |
231 | R"==(for (int didx = 0; didx < c_size; ++didx) { )==" "\n" |
232 | R"==(float accum = CONVERT_FLOAT_T(C[didx]); )==" "\n" |
233 | R"==(float sum = CONVERT_FLOAT_T(S[didx]); )==" "\n" |
234 | R"==(int po_oc = oc + c_size % OC_BLOCK; )==" "\n" |
235 | R"==(APPLY_POST_OPS_SERIAL_BINARY_2D( )==" "\n" |
236 | R"==(C, DATA_T, S, DATA_T, n, 1, po_oc, 1); )==" "\n" |
237 | R"==(C[didx] = TO_DATA_T(accum); )==" "\n" |
238 | R"==(} )==" "\n" |
239 | R"==(C1 = BLOCKED_READ(&C[0]); )==" "\n" |
240 | R"==(C2 = BLOCKED_READ(&C[OC_BLOCK]); )==" "\n" |
241 | R"==(} )==" "\n" |
242 | R"==(int dst_idx = dst_off(n, oc, 0, oh, ow); )==" "\n" |
243 | R"==(BLOCKED_WRITE(C1, &dst[dst_idx]); )==" "\n" |
244 | R"==(if (OW % WINO_M == 0 || ow < OW - 1) { )==" "\n" |
245 | R"==(dst_idx += dst_off(0, 0, 0, 0, 1); )==" "\n" |
246 | R"==(BLOCKED_WRITE(C2, &dst[dst_idx]); )==" "\n" |
247 | R"==(} )==" "\n" |
248 | R"==(} )==" "\n" |
249 | R"==(__attribute__((reqd_work_group_size(8, 1, 1))) __kernel void )==" "\n" |
250 | R"==(gen9_wino_conv_fwd_2x3(__global DATA_T *M, const __global DATA_T *V, )==" "\n" |
251 | R"==(const __global DATA_T *U_param) { )==" "\n" |
252 | R"==(const int VH_SIZE_VECT = V_off(0, 0, 1 - PH, 0, 0) / VECT_SIZE; )==" "\n" |
253 | R"==(const int MH_SIZE_VECT = M_off(0, 0, 1, 0, 0) / VECT_SIZE; )==" "\n" |
254 | R"==(const int U_IC_SIZE_VECT = U_off(0, 1, 0, 0) / VECT_SIZE; )==" "\n" |
255 | R"==(const int group_x = get_group_id(0); )==" "\n" |
256 | R"==(const int group_y = get_group_id(1); )==" "\n" |
257 | R"==(const int group_z = get_group_id(2); )==" "\n" |
258 | R"==(const int local_x = get_local_id(0); )==" "\n" |
259 | R"==(const int local_y = get_local_id(1); )==" "\n" |
260 | R"==(const int local_z = get_local_id(2); )==" "\n" |
261 | R"==(const int no_of_tiles_x = MW; )==" "\n" |
262 | R"==(const int no_of_tiles_y = MH; )==" "\n" |
263 | R"==(const int ow = (group_y * OH_BLOCK) / no_of_tiles_y; )==" "\n" |
264 | R"==(const int oh = (group_y * OH_BLOCK) % no_of_tiles_y; )==" "\n" |
265 | R"==(const int oc = group_x * WINO_OC_BLOCK )==" "\n" |
266 | R"==(+ local_x * VECT_SIZE; )==" "\n" |
267 | R"==(const int n = group_z / WINO_D; )==" "\n" |
268 | R"==(const int tile_w_offset = group_z % WINO_D; )==" "\n" |
269 | R"==(const int ih = oh - PH; )==" "\n" |
270 | R"==(const int iw = ow; )==" "\n" |
271 | R"==(const int ic = local_x * VECT_SIZE; )==" "\n" |
272 | R"==(VECT_DATA_T M0 = (VECT_DATA_T)(0.f); )==" "\n" |
273 | R"==(VECT_DATA_T M1 = (VECT_DATA_T)(0.f); )==" "\n" |
274 | R"==(VECT_DATA_T M2 = (VECT_DATA_T)(0.f); )==" "\n" |
275 | R"==(VECT_DATA_T M3 = (VECT_DATA_T)(0.f); )==" "\n" |
276 | R"==(VECT_DATA_T M4 = (VECT_DATA_T)(0.f); )==" "\n" |
277 | R"==(VECT_DATA_T M5 = (VECT_DATA_T)(0.f); )==" "\n" |
278 | R"==(VECT_DATA_T M6 = (VECT_DATA_T)(0.f); )==" "\n" |
279 | R"==(VECT_DATA_T M7 = (VECT_DATA_T)(0.f); )==" "\n" |
280 | R"==(const int M_idx = M_off(n, oc, oh, ow, tile_w_offset); )==" "\n" |
281 | R"==(__global VECT_DATA_T *dst = (__global VECT_DATA_T *)(M + M_idx); )==" "\n" |
282 | R"==(const int V_idx = V_off(n, ic, ih, iw, tile_w_offset); )==" "\n" |
283 | R"==(const __global VECT_DATA_T *V_tile = (__global VECT_DATA_T *)(V + V_idx); )==" "\n" |
284 | R"==(const int U_idx = U_off(oc, 0, 0, tile_w_offset); )==" "\n" |
285 | R"==(const __global VECT_DATA_T *U_tile )==" "\n" |
286 | R"==(= (__global VECT_DATA_T *)(U_param + U_idx); )==" "\n" |
287 | R"==(VECT_DATA_T a; )==" "\n" |
288 | R"==(for_(int kh = 0; kh < KH; kh++) )==" "\n" |
289 | R"==(for (int ic_idx = 0; ic_idx < WINO_IC; ic_idx += WINO_IC_BLOCK) { )==" "\n" |
290 | R"==(const VECT_DATA_T V0 = V_tile[0 * VH_SIZE_VECT]; )==" "\n" |
291 | R"==(const VECT_DATA_T V1 = V_tile[1 * VH_SIZE_VECT]; )==" "\n" |
292 | R"==(const VECT_DATA_T V2 = V_tile[2 * VH_SIZE_VECT]; )==" "\n" |
293 | R"==(const VECT_DATA_T V3 = V_tile[3 * VH_SIZE_VECT]; )==" "\n" |
294 | R"==(const VECT_DATA_T V4 = V_tile[4 * VH_SIZE_VECT]; )==" "\n" |
295 | R"==(const VECT_DATA_T V5 = V_tile[5 * VH_SIZE_VECT]; )==" "\n" |
296 | R"==(const VECT_DATA_T V6 = V_tile[6 * VH_SIZE_VECT]; )==" "\n" |
297 | R"==(const VECT_DATA_T V7 = V_tile[7 * VH_SIZE_VECT]; )==" "\n" |
298 | R"==(#define DOT_PRODUCT(_i, _j) \ )==" "\n" |
299 | R"==(do { \ )==" "\n" |
300 | R"==(a = AS_VECT_DATA_T( \ )==" "\n" |
301 | R"==(intel_sub_group_shuffle(AS_VECT_BLOCK_DATA_T(V##_i), _j)); \ )==" "\n" |
302 | R"==(M##_i = mad(a.x, U0, mad(a.y, U1, mad(a.z, U2, mad(a.w, U3, M##_i)))); \ )==" "\n" |
303 | R"==(} while (0) )==" "\n" |
304 | R"==(unroll_for(int j = 0; j < WINO_IC_BLOCK / VECT_SIZE; j++) { )==" "\n" |
305 | R"==(const VECT_DATA_T U0 = U_tile[0]; )==" "\n" |
306 | R"==(U_tile += U_IC_SIZE_VECT; )==" "\n" |
307 | R"==(const VECT_DATA_T U1 = U_tile[0]; )==" "\n" |
308 | R"==(U_tile += U_IC_SIZE_VECT; )==" "\n" |
309 | R"==(const VECT_DATA_T U2 = U_tile[0]; )==" "\n" |
310 | R"==(U_tile += U_IC_SIZE_VECT; )==" "\n" |
311 | R"==(const VECT_DATA_T U3 = U_tile[0]; )==" "\n" |
312 | R"==(U_tile += U_IC_SIZE_VECT; )==" "\n" |
313 | R"==(DOT_PRODUCT(0, j); )==" "\n" |
314 | R"==(DOT_PRODUCT(1, j); )==" "\n" |
315 | R"==(DOT_PRODUCT(2, j); )==" "\n" |
316 | R"==(DOT_PRODUCT(3, j); )==" "\n" |
317 | R"==(DOT_PRODUCT(4, j); )==" "\n" |
318 | R"==(DOT_PRODUCT(5, j); )==" "\n" |
319 | R"==(DOT_PRODUCT(6, j); )==" "\n" |
320 | R"==(DOT_PRODUCT(7, j); )==" "\n" |
321 | R"==(} )==" "\n" |
322 | R"==(#undef DOT_PRODUCT )==" "\n" |
323 | R"==(V_tile += WINO_IC_BLOCK / VECT_SIZE; )==" "\n" |
324 | R"==(} )==" "\n" |
325 | R"==(dst[0] = M0; )==" "\n" |
326 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
327 | R"==(dst[0] = M1; )==" "\n" |
328 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
329 | R"==(dst[0] = M2; )==" "\n" |
330 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
331 | R"==(dst[0] = M3; )==" "\n" |
332 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
333 | R"==(dst[0] = M4; )==" "\n" |
334 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
335 | R"==(dst[0] = M5; )==" "\n" |
336 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
337 | R"==(dst[0] = M6; )==" "\n" |
338 | R"==(dst += MH_SIZE_VECT; )==" "\n" |
339 | R"==(dst[0] = M7; )==" "\n" |
340 | R"==(} )==" "\n" |
341 | R"==()==" ; |
342 | } |
343 | } |
344 | } |
345 | } |