1/*******************************************************************************
2* Copyright 2018-2020 Intel Corporation
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*******************************************************************************/
16
17#ifndef CPU_CPU_BATCH_NORMALIZATION_UTILS_HPP
18#define CPU_CPU_BATCH_NORMALIZATION_UTILS_HPP
19
20#include "common/batch_normalization_pd.hpp"
21
22namespace dnnl {
23namespace impl {
24namespace cpu {
25namespace bnorm_utils {
26
27void cache_balance(size_t working_set_size, dim_t C_blks, dim_t N, int nthr,
28 dim_t &C_blks_per_iter, int64_t &iters);
29
30bool thread_balance(bool do_blocking, bool spatial_thr_allowed, bool is_nhwc,
31 int ithr, int nthr, dim_t N, dim_t C_blks, dim_t SP, int &C_ithr,
32 int &C_nthr, dim_t &C_blk_s, dim_t &C_blk_e, int &N_ithr, int &N_nthr,
33 dim_t &N_s, dim_t &N_e, int &S_ithr, int &S_nthr, dim_t &S_s,
34 dim_t &S_e);
35
36bool is_spatial_thr(const batch_normalization_pd_t *bdesc, bool is_nhwc,
37 int simd_w, int data_size);
38
39} // namespace bnorm_utils
40} // namespace cpu
41} // namespace impl
42} // namespace dnnl
43
44#endif
45