// Copyright (c) 2018 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "include/include_all.cl" #if FP16_UNIT_USED #define UNIT_CVT_FUNC(val) convert_half(val) #else #define UNIT_CVT_FUNC(val) (val) #endif __attribute__((reqd_work_group_size(LWS, 1, 1))) KERNEL (mvn_gpu_bfyx_opt)(const __global UNIT_TYPE* input, __global UNIT_TYPE* output) { const uint data_set_idx = get_global_id(1); //in processing of which data set this WI participates? const uint workers_per_data_set = LWS; //how many WI participates in processing of one data set const uint in_data_set_idx = get_global_id(0); //this WI's id in group of items processing single data set const uint data_set_size = DATA_SET_SIZE; //how many elements are in one data set const uint data_sets_count = DATA_SETS_COUNT; //how many data sets are in the processing payload const uint data_set_offset = data_set_idx * data_set_size; const uint my_data_offset = data_set_offset + in_data_set_idx; float my_sum = 0.f; float tmp; __local float lg_storage[LWS]; //each WI reads ITEMS_NUM consecutive items from batch*feature for (uint i=0; i