1 // Copyright (c) 2016-2017 Intel Corporation
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
16 #include "include/include_all.cl"
18 KERNEL (reorder_weights_image_2d_c4_fyx_b)(const __global INPUT0_TYPE* input, write_only image2d_t output)
20 const unsigned o = get_global_id(0);
21 const unsigned iyx = get_global_id(1);
22 const unsigned x = iyx % INPUT0_SIZE_X;
23 const unsigned y = (iyx / INPUT0_SIZE_X) % INPUT0_SIZE_Y;
24 const unsigned i = y / INPUT0_SIZE_Y;
26 MAKE_VECTOR_TYPE(UNIT_TYPE, 4) input_val = (MAKE_VECTOR_TYPE(UNIT_TYPE, 4))(UNIT_VAL_ZERO, UNIT_VAL_ZERO, UNIT_VAL_ZERO, UNIT_VAL_ZERO);
28 const int2 coord = (int2)(iyx, o);
29 uint input_idx = o * INPUT0_OFM_PITCH + iyx*4;
31 input_val.s0 = TO_OUTPUT_TYPE(input[input_idx]);
32 if(iyx*4 + 1 < INPUT0_OFM_PITCH)
33 input_val.s1 = TO_OUTPUT_TYPE(input[input_idx+1]);
34 if(iyx*4 + 2 < INPUT0_OFM_PITCH)
35 input_val.s2 = TO_OUTPUT_TYPE(input[input_idx+2]);
36 if(iyx*4 + 3 < INPUT0_OFM_PITCH)
37 input_val.s3 = TO_OUTPUT_TYPE(input[input_idx+3]);
38 IMAGE_WRITE(output, coord, input_val);