blob: 903e924a2fea304d8aa8590fbee226e254a985b9 [file] [log] [blame]
Giorgio Arena205eed82019-08-14 10:13:50 +01001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2019-2020 Arm Limited.
Giorgio Arena205eed82019-08-14 10:13:50 +01003 *
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#include "helpers.h"
25
Giorgio Arena93240222020-12-23 11:55:29 +000026#if defined(DATA_TYPE) && defined(VEC_SIZE) && defined(PAD_X_BEFORE) && defined(SRC_WIDTH) && defined(PAD_X_BEFORE_REMAINDER) && defined(VEC_SIZE_LEFTOVER_WRITE)
Giorgio Arena205eed82019-08-14 10:13:50 +010027
28#define VEC_TYPE VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
29#define VEC_INT VEC_DATA_TYPE(int, VEC_SIZE)
Giorgio Arena2d1a8352020-10-26 15:04:08 +000030#define VEC_SELECT SELECT_VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
31#define OFFSETS VEC_OFFS(SELECT_DATA_TYPE(DATA_TYPE), VEC_SIZE)
Giorgio Arena93240222020-12-23 11:55:29 +000032#define SCALAR_COND(x) CONVERT((VEC_SELECT)x == (VEC_SELECT)1, VEC_SELECT)
Giorgio Arena205eed82019-08-14 10:13:50 +010033
Giorgio Arena93240222020-12-23 11:55:29 +000034#if defined(CONST_VAL) && defined(VEC_SIZE_LEFTOVER_READ)
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010035/** Perform a pad operation when PaddingMode is CONSTANT
Giorgio Arena205eed82019-08-14 10:13:50 +010036 *
37 * @note Data type can be passed using the -DDATA_TYPE compile flag, e.g. -DDATA_TYPE=float
38 * @note Vector size must be passed using the -DVEC_SIZE compile flag, e.g. -DVEC_SIZE=4
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010039 * @note Constant value used to fill the pads must be passed using the -DCONST_VAL compile flag, e.g. -DCONST_VAL=1.27
40 * @note Pad to add to the left must be passed using the -DPAD_X_BEFORE compile flag, e.g. -DPAD_X_BEFORE=5
Giorgio Arena205eed82019-08-14 10:13:50 +010041 * @note Input tensor's width must be passed using the -DSRC_WIDTH compile flag, e.g. -DSRC_WIDTH=224
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010042 * @note In case pad left is more than the vector size, the number of threads to skip along the X axis must be passed using the
Giorgio Arena93240222020-12-23 11:55:29 +000043 * -DTHREADS_TO_SKIP_BEFORE compile flag, e.g. -DTHREADS_TO_SKIP_BEFORE=1. This is defined as (PAD_X_BEFORE / VEC_SIZE)
44 * @note In case pad left is more than the vector size, the thread from which to skip along the X axis for pad right must be passed using the
45 * -DTHREADS_TO_SKIP_AFTER compile flag, e.g. -THREADS_TO_SKIP_AFTER=1. This is defined as ((SRC_WIDTH + PAD_X_BEFORE) / VEC_SIZE)
Matthew Jacksonc2a60592019-08-30 15:19:42 +010046 * @note If pad also needs to be added to the top of the tensor, the following compile flags must be passed at compile time:
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010047 * -# -DPAD_Y_BEFORE: Pad to add to the top of the input tensor (e.g. -DPAD_Y_BEFORE=3)
Giorgio Arena205eed82019-08-14 10:13:50 +010048 * -# -DSRC_HEIGHT: Input tensor's height (e.g. -DSRC_HEIGHT=127)
Matthew Jacksonc2a60592019-08-30 15:19:42 +010049 * @note If pad also needs to be added to the depth of the tensor, the following compile flags must be passed at compile time:
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010050 * -# -DPAD_Z_BEFORE: Pad to add before the first plane of the input tensor (e.g. -DPAD_Z_BEFORE=3)
Giorgio Arena205eed82019-08-14 10:13:50 +010051 * -# -DSRC_DEPTH: Input tensor's depth (e.g. -DSRC_DEPTH=32)
Matthew Jacksonc2a60592019-08-30 15:19:42 +010052 * @note If pad also needs to be added to the batch of the tensor, the following compile flags must be passed at compile time:
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010053 * -# -DPAD_W_BEFORE: Pad to add before the first batch of the input tensor (e.g. -DPAD_W_BEFORE=3)
Matthew Jacksonc2a60592019-08-30 15:19:42 +010054 * -# -DSRC_BATCH: Input tensor's batch size (e.g. -DSRC_BATCH=4)
Giorgio Arena205eed82019-08-14 10:13:50 +010055 *
Michele Di Giorgiof6f78762020-07-06 11:27:21 +010056 * @param[in] src_ptr Pointer to the source image. Supported data types: All
Giorgio Arena205eed82019-08-14 10:13:50 +010057 * @param[in] src_stride_x Stride of the source image in X dimension (in bytes)
58 * @param[in] src_step_x src_stride_x * number of elements along X processed per workitem(in bytes)
59 * @param[in] src_stride_y Stride of the source image in Y dimension (in bytes)
60 * @param[in] src_step_y src_stride_y * number of elements along Y processed per workitem(in bytes)
61 * @param[in] src_stride_z Stride of the source image in Z dimension (in bytes)
62 * @param[in] src_step_z src_stride_z * number of elements along Z processed per workitem(in bytes)
63 * @param[in] src_offset_first_element_in_bytes The offset of the first element in the source image
64 * @param[out] dst_ptr Pointer to the destination image. Supported data types: same as @p src_ptr
65 * @param[in] dst_stride_x Stride of the destination image in X dimension (in bytes)
66 * @param[in] dst_step_x dst_stride_x * number of elements along X processed per workitem(in bytes)
67 * @param[in] dst_stride_y Stride of the destination image in Y dimension (in bytes)
68 * @param[in] dst_step_y dst_stride_y * number of elements along Y processed per workitem(in bytes)
69 * @param[in] dst_stride_z Stride of the destination image in Z dimension (in bytes)
70 * @param[in] dst_step_z dst_stride_z * number of elements along Z processed per workitem(in bytes)
71 * @param[in] dst_offset_first_element_in_bytes The offset of the first element in the destination image
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010072 * @param[in] batch (Optional) Batch index if 4D pad must be applied
Giorgio Arena205eed82019-08-14 10:13:50 +010073 */
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010074__kernel void pad_layer_constant(TENSOR3D_DECLARATION(src),
75 TENSOR3D_DECLARATION(dst)
76#if defined(PAD_W_BEFORE)
77 ,
78 uint batch
79#endif // defined(PAD_W_BEFORE)
80 )
Giorgio Arena205eed82019-08-14 10:13:50 +010081{
Giorgio Arena93240222020-12-23 11:55:29 +000082 Tensor3D dst = CONVERT_TO_TENSOR3D_STRUCT(dst);
Giorgio Arena205eed82019-08-14 10:13:50 +010083
Giorgio Arena93240222020-12-23 11:55:29 +000084 int x = get_global_id(0);
85 int y = get_global_id(1);
86 int z = get_global_id(2);
87
88 // If true, write only padding values; no reads performed
Matthew Jacksonc2a60592019-08-30 15:19:42 +010089 uint cond = 0;
Giorgio Arena93240222020-12-23 11:55:29 +000090#if defined(THREADS_TO_SKIP_BEFORE)
91 cond |= x < THREADS_TO_SKIP_BEFORE || x > THREADS_TO_SKIP_AFTER;
92#endif // defined(THREADS_TO_SKIP_BEFORE)
93#if defined(PAD_Y_BEFORE)
94 cond |= y < PAD_Y_BEFORE || y >= (SRC_HEIGHT + PAD_Y_BEFORE);
95#endif // defined(PAD_Y_BEFORE)
Giorgio Arena5c4a8e92019-08-28 17:55:07 +010096#if defined(PAD_Z_BEFORE)
97 cond |= z < PAD_Z_BEFORE || z >= (SRC_DEPTH + PAD_Z_BEFORE);
98#endif // defined(PAD_Z_BEFORE)
Giorgio Arena93240222020-12-23 11:55:29 +000099#if defined(PAD_W_BEFORE)
100 cond |= batch < PAD_W_BEFORE || batch >= (SRC_BATCH + PAD_W_BEFORE);
101#endif // defined(PAD_W_BEFORE)
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100102
Matthew Jacksonc2a60592019-08-30 15:19:42 +0100103 if(cond)
Giorgio Arena205eed82019-08-14 10:13:50 +0100104 {
Giorgio Arena93240222020-12-23 11:55:29 +0000105 VEC_TYPE const_vals0 = (VEC_TYPE)CONST_VAL;
106 STORE_VECTOR_SELECT(const_vals, DATA_TYPE, dst.ptr, VEC_SIZE, VEC_SIZE_LEFTOVER_WRITE, get_global_id(0) == (get_global_size(0) - 1));
Giorgio Arena205eed82019-08-14 10:13:50 +0100107 }
108 else
109 {
Giorgio Arena93240222020-12-23 11:55:29 +0000110 // Calculate input's coordinates based on output's
111 int w = 0;
112#if defined(THREADS_TO_SKIP_BEFORE)
113 x -= THREADS_TO_SKIP_BEFORE;
114#endif // defined(THREADS_TO_SKIP_BEFORE)
115#if defined(PAD_Y_BEFORE)
116 y -= PAD_Y_BEFORE;
117#endif // defined(PAD_Y_BEFORE)
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100118#if defined(PAD_Z_BEFORE)
Giorgio Arena93240222020-12-23 11:55:29 +0000119 z -= PAD_Z_BEFORE;
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100120#endif // defined(PAD_Z_BEFORE)
121#if defined(PAD_W_BEFORE)
Giorgio Arena93240222020-12-23 11:55:29 +0000122 w -= PAD_W_BEFORE * SRC_DEPTH;
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100123#endif // defined(PAD_W_BEFORE)
Giorgio Arena93240222020-12-23 11:55:29 +0000124 x *= VEC_SIZE;
125 x -= PAD_X_BEFORE_REMAINDER;
Giorgio Arena205eed82019-08-14 10:13:50 +0100126
Giorgio Arena93240222020-12-23 11:55:29 +0000127 // Check for out of bound reads and clamp X coordinate
128 uint cond_left = x < 0;
129 uint cond_right = (x + VEC_SIZE) > SRC_WIDTH;
130 x = clamp(x, 0, (SRC_WIDTH - VEC_SIZE));
Giorgio Arena205eed82019-08-14 10:13:50 +0100131
Giorgio Arena93240222020-12-23 11:55:29 +0000132 // Calculate input's address
133 __global uchar *src_addr = src_ptr + src_offset_first_element_in_bytes + x * src_stride_x + y * src_stride_y + z * src_stride_z + w * (int)src_stride_z;
134
135 // Read values and rotate them properly if they would have been across paddings
136 VEC_TYPE src_vals0 = VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)src_addr);
137 src_vals0 = select(src_vals0, ROTATE(src_vals0, VEC_SIZE, PAD_X_BEFORE_REMAINDER), SCALAR_COND(cond_left));
138 src_vals0 = select(src_vals0, ROTATE(src_vals0, VEC_SIZE, VEC_SIZE_LEFTOVER_READ), SCALAR_COND(cond_right));
139
140 // Check what values would be padding and replace them with the constant value
141 VEC_INT xs_out = (VEC_INT)(get_global_id(0) * VEC_SIZE) + VEC_OFFS(int, VEC_SIZE);
142 VEC_INT conds = xs_out < (VEC_INT)PAD_X_BEFORE || xs_out >= (VEC_INT)(SRC_WIDTH + PAD_X_BEFORE);
143 src_vals0 = select(src_vals0, (VEC_TYPE)CONST_VAL, CONVERT(conds, VEC_SELECT));
144
145 // Store values in bounds
146 STORE_VECTOR_SELECT(src_vals, DATA_TYPE, dst.ptr, VEC_SIZE, VEC_SIZE_LEFTOVER_WRITE, get_global_id(0) == (get_global_size(0) - 1));
Giorgio Arena205eed82019-08-14 10:13:50 +0100147 }
Giorgio Arena205eed82019-08-14 10:13:50 +0100148}
Giorgio Arena93240222020-12-23 11:55:29 +0000149#endif // defined(CONST_VAL) && defined(VEC_SIZE_LEFTOVER_READ)
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100150
Giorgio Arena93240222020-12-23 11:55:29 +0000151#if defined(IS_REFLECT) && defined(PAD_X_AFTER_REMAINDER) && defined(PAD_X_BEFORE_REMAINDER_REFL) && defined(PAD_X_AFTER_REMAINDER_REFL) && defined(AFTER_PAD_FACT_X)
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100152
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100153#define ROTATE_REVERSE(x, n) ROTATE(REVERSE(x, VEC_SIZE), VEC_SIZE, n)
154#define SYMM_REFL_LEFT(x, n0, n1) select(ROTATE_REVERSE(x, n1), ROTATE(x, VEC_SIZE, n0), OFFSETS >= (VEC_SELECT)n0)
155#define SYMM_REFL_RIGHT(x, n0, n1) select(ROTATE(x, VEC_SIZE, n0), ROTATE_REVERSE(x, n1), OFFSETS >= (VEC_SELECT)n0)
156
157/** Perform a pad operation when PaddingMode is SYMMETRIC
158 *
159 * @note Data type can be passed using the -DDATA_TYPE compile flag, e.g. -DDATA_TYPE=float
160 * @note Vector size must be passed using the -DVEC_SIZE compile flag, e.g. -DVEC_SIZE=4
161 * @note Constant value must be passed using the -DCONST_VAL compile flag, e.g. -DCONST_VAL=1.27
162 * @note Pad to add to the left must be passed using the -DPAD_X_BEFORE compile flag, e.g. -DPAD_X_BEFORE=5
163 * @note Input tensor's width must be passed using the -DSRC_WIDTH compile flag, e.g. -DSRC_WIDTH=224
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100164 * @note Number of values to the left when operating across left padding must be passed using the -DPAD_X_BEFORE_REMAINDER compile flag, e.g. -DPAD_X_BEFORE_REMAINDER=5
165 * @note Number of values to the left when operating across right padding must be passed using the -DPAD_X_AFTER_REMAINDER compile flag, e.g. -DPAD_X_AFTER_REMAINDER=6
166 * @note To rearrange the vectors properly, (PAD_X_BEFORE_REMAINDER + 1) must be passed when mode is REFLECT using the -DPAD_X_BEFORE_REMAINDER_REFL compile flag, e.g. -DPAD_X_BEFORE_REMAINDER=6
167 * @note To rearrange the vectors properly, (PAD_X_AFTER_REMAINDER - 1) must be passed using the -DPAD_X_AFTER_REMAINDER_REFL compile flag, e.g. -DPAD_X_AFTER_REMAINDER=5
168 * @note When after pad X, starting point to read backward from must be passed using the -DAFTER_PAD_FACT_X compile flag, e.g. -DAFTER_PAD_FACT_X=253
169 * @note If padding mode is REFLECT, the -DIS_REFLECT compile flag must be set to 1, else it must be set to 0
170 * @note If pad also needs to be added to the top of the tensor, the following compile flags must be passed at compile time:
171 * -# -DPAD_Y_BEFORE: Pad to add to the top of the input tensor (e.g. -DPAD_Y_BEFORE=3)
172 * -# -DSRC_HEIGHT: Input tensor's height (e.g. -DSRC_HEIGHT=127)
173 * @note If pad also needs to be added to the depth of the tensor, the following compile flags must be passed at compile time:
174 * -# -DPAD_Z_BEFORE: Pad to add before the first plane of the input tensor (e.g. -DPAD_Z_BEFORE=3)
175 * -# -DSRC_DEPTH: Input tensor's depth (e.g. -DSRC_DEPTH=32)
176 * @note If the starting point to read backward from is less than the output's last element accessed in the X, the following compile flags must be passed at compile time to avoid negative offsets:
177 * -# -DAFTER_PAD_REM: Defines how much to rotate the vector if the backward calculation attempted to read from a negative offset (e.g. -DAFTER_PAD_REM=3)
178 *
Michele Di Giorgiof6f78762020-07-06 11:27:21 +0100179 * @param[in] src_ptr Pointer to the source image. Supported data types: All
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100180 * @param[in] src_stride_x Stride of the source image in X dimension (in bytes)
181 * @param[in] src_step_x src_stride_x * number of elements along X processed per workitem(in bytes)
182 * @param[in] src_stride_y Stride of the source image in Y dimension (in bytes)
183 * @param[in] src_step_y src_stride_y * number of elements along Y processed per workitem(in bytes)
184 * @param[in] src_stride_z Stride of the source image in Z dimension (in bytes)
185 * @param[in] src_step_z src_stride_z * number of elements along Z processed per workitem(in bytes)
186 * @param[in] src_offset_first_element_in_bytes The offset of the first element in the source image
187 * @param[out] dst_ptr Pointer to the destination image. Supported data types: same as @p src_ptr
188 * @param[in] dst_stride_x Stride of the destination image in X dimension (in bytes)
189 * @param[in] dst_step_x dst_stride_x * number of elements along X processed per workitem(in bytes)
190 * @param[in] dst_stride_y Stride of the destination image in Y dimension (in bytes)
191 * @param[in] dst_step_y dst_stride_y * number of elements along Y processed per workitem(in bytes)
192 * @param[in] dst_stride_z Stride of the destination image in Z dimension (in bytes)
193 * @param[in] dst_step_z dst_stride_z * number of elements along Z processed per workitem(in bytes)
194 * @param[in] dst_offset_first_element_in_bytes The offset of the first element in the destination image
195 */
196__kernel void pad_layer_symmetric_reflect(TENSOR3D_DECLARATION(src),
197 TENSOR3D_DECLARATION(dst))
198{
199 // Get current thread position
200 const int x = get_global_id(0);
201 const int y = get_global_id(1);
202 const int z = get_global_id(2);
203
204 // Define conditions based on the thread X position w.r.t. pad left and right
205 const int x_out_first = x * VEC_SIZE;
206 const int x_out_last = x_out_first + VEC_SIZE;
207 const int is_before_pad_left = (x_out_last <= PAD_X_BEFORE);
208 const int is_across_pad_left = (x_out_first < PAD_X_BEFORE) && (x_out_last > PAD_X_BEFORE);
209 const int is_inside_input = (x_out_first >= PAD_X_BEFORE) && (x_out_last <= (SRC_WIDTH + PAD_X_BEFORE));
210 const int is_across_pad_right = (x_out_first < (SRC_WIDTH + PAD_X_BEFORE)) && (x_out_last > (SRC_WIDTH + PAD_X_BEFORE));
211 const int is_after_pad_right = (x_out_first >= (SRC_WIDTH + PAD_X_BEFORE));
212
213 // Calculate base pointers
214 __global uchar *src_addr = src_ptr + src_offset_first_element_in_bytes;
215 Tensor3D dst = CONVERT_TO_TENSOR3D_STRUCT(dst);
216
217 // Calculate input tensor's offset based on the defined conditions
218 int x_offset = 0;
219 x_offset = select(x_offset, PAD_X_BEFORE - x_out_last + IS_REFLECT, is_before_pad_left);
220 x_offset = select(x_offset, x_out_first - PAD_X_BEFORE, is_inside_input);
221 x_offset = select(x_offset, SRC_WIDTH - VEC_SIZE, is_across_pad_right);
222 x_offset = select(x_offset, AFTER_PAD_FACT_X - x_out_last, is_after_pad_right);
223
224#if defined(AFTER_PAD_REM)
225 int neg_offs = x_offset < 0;
226 x_offset = max(x_offset, 0);
227#endif // defined(AFTER_PAD_REM)
228
229 // Load input values from the computed offset
230 int y_in = y;
231 int z_in = z;
232#if defined(PAD_Y_BEFORE)
233 y_in = select(y - PAD_Y_BEFORE, PAD_Y_BEFORE - y + IS_REFLECT - 1, y < PAD_Y_BEFORE);
234 y_in = select(y_in, 2 * SRC_HEIGHT + PAD_Y_BEFORE - y - IS_REFLECT - 1, y >= (SRC_HEIGHT + PAD_Y_BEFORE));
235#endif // defined(PAD_Y_BEFORE)
236#if defined(PAD_Z_BEFORE)
237 z_in = select(z - PAD_Z_BEFORE, PAD_Z_BEFORE - z + IS_REFLECT - 1, z < PAD_Z_BEFORE);
238 z_in = select(z_in, 2 * SRC_DEPTH + PAD_Z_BEFORE - z - IS_REFLECT - 1, z >= (SRC_DEPTH + PAD_Z_BEFORE));
239#endif // defined(PAD_Y_BEFORE)
240
241 src_addr += x_offset * src_stride_x + y_in * src_step_y + z_in * src_step_z;
242
243#if SRC_WIDTH == 1
244 VSTORE(VEC_SIZE)
245 ((VEC_TYPE)(*(__global DATA_TYPE *)src_addr), 0, (__global DATA_TYPE *)dst.ptr);
246#else // SRC_WIDTH == 1
247
Giorgio Arena93240222020-12-23 11:55:29 +0000248 VEC_TYPE src_vals0 = VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)src_addr);
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100249
250 // Choose rearrangement policy based on the defined conditions
Giorgio Arena93240222020-12-23 11:55:29 +0000251 src_vals0 = select(src_vals0, SYMM_REFL_LEFT(src_vals0, PAD_X_BEFORE_REMAINDER, PAD_X_BEFORE_REMAINDER_REFL), SCALAR_COND(is_across_pad_left));
252 src_vals0 = select(src_vals0, SYMM_REFL_RIGHT(src_vals0, PAD_X_AFTER_REMAINDER, PAD_X_AFTER_REMAINDER_REFL), SCALAR_COND(is_across_pad_right));
253 src_vals0 = select(src_vals0, REVERSE(src_vals0, VEC_SIZE), SCALAR_COND((is_before_pad_left || is_after_pad_right)));
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100254#if defined(AFTER_PAD_REM)
Giorgio Arena93240222020-12-23 11:55:29 +0000255 src_vals0 = select(src_vals0, ROTATE(src_vals0, VEC_SIZE, AFTER_PAD_REM), SCALAR_COND(neg_offs));
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100256#endif // defined(AFTER_PAD_REM)
257
Giorgio Arena93240222020-12-23 11:55:29 +0000258 // Store values in bounds
259 STORE_VECTOR_SELECT(src_vals, DATA_TYPE, dst.ptr, VEC_SIZE, VEC_SIZE_LEFTOVER_WRITE, get_global_id(0) == (get_global_size(0) - 1));
Giorgio Arena5c4a8e92019-08-28 17:55:07 +0100260#endif // SRC_WIDTH == 1
261}
Giorgio Arena93240222020-12-23 11:55:29 +0000262#endif // defined(IS_REFLECT) && defined(PAD_X_AFTER_REMAINDER) && defined(PAD_X_BEFORE_REMAINDER_REFL) && defined(PAD_X_AFTER_REMAINDER_REFL) && defined(AFTER_PAD_FACT_X)
263#endif // defined(DATA_TYPE) && defined(VEC_SIZE) && defined(PAD_X_BEFORE) && defined(SRC_WIDTH) && defined(PAD_X_BEFORE_REMAINDER) && defined(VEC_SIZE_LEFTOVER_WRITE)