Skip to content

Commit

Permalink
style: apply clang-format 11
Browse files Browse the repository at this point in the history
  • Loading branch information
densamoilov committed Dec 29, 2022
1 parent 14f5895 commit 0b1bf84
Show file tree
Hide file tree
Showing 74 changed files with 470 additions and 484 deletions.
2 changes: 1 addition & 1 deletion src/common/dnnl_thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ static inline void parallel_nd(dim_t D0, dim_t D1, dim_t D2, dim_t D3, dim_t D4,
/* parallel_nd_in_omp section */

template <typename... Args>
void parallel_nd_in_omp(Args &&... args) {
void parallel_nd_in_omp(Args &&...args) {
#if DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_SEQ
for_nd(0, 1, utils::forward<Args>(args)...);
#elif DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_OMP
Expand Down
10 changes: 5 additions & 5 deletions src/common/stack_checker.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2021 Intel Corporation
* Copyright 2021-2022 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace stack_checker {
template <typename F, typename... Targs>
struct thread_args_t {
thread_args_t() = delete;
thread_args_t(const F &func, const Targs &... func_args)
thread_args_t(const F &func, const Targs &...func_args)
: func(func)
, func_args(std::forward<Targs>(func_args)...)
, func_retval {} {}
Expand All @@ -149,7 +149,7 @@ constexpr size_t get_number_args() {
template <size_t i>
struct executor_t {
template <typename T, typename... Targs>
static void execute(T &thread_args, Targs &... unpacked_func_args) {
static void execute(T &thread_args, Targs &...unpacked_func_args) {
const auto &func_args = thread_args.func_args;
constexpr size_t idx = get_number_args<decltype(func_args)>() - i;
executor_t<i - 1>::execute(thread_args,
Expand All @@ -161,7 +161,7 @@ struct executor_t {
template <>
struct executor_t<0> {
template <typename T, typename... Targs>
static void execute(T &thread_args, Targs &... unpacked_func_args) {
static void execute(T &thread_args, Targs &...unpacked_func_args) {
thread_args.func_retval
= thread_args.func(std::forward<Targs>(unpacked_func_args)...);
}
Expand All @@ -172,7 +172,7 @@ struct stack_checker_t {

template <typename F, typename... Targs>
typename cpp_compat::invoke_result<F *, Targs...>::type check(
const F &func, const Targs &... func_args) {
const F &func, const Targs &...func_args) {

auto thread_args = utils::make_unique<thread_args_t<F, const Targs...>>(
func, std::forward<const Targs>(func_args)...);
Expand Down
12 changes: 6 additions & 6 deletions src/common/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ inline typename remove_reference<T>::type zero() {
}

template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args &&... args) {
std::unique_ptr<T> make_unique(Args &&...args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

Expand Down Expand Up @@ -367,7 +367,7 @@ inline T nd_iterator_init(T start) {
return start;
}
template <typename T, typename U, typename W, typename... Args>
inline T nd_iterator_init(T start, U &x, const W &X, Args &&... tuple) {
inline T nd_iterator_init(T start, U &x, const W &X, Args &&...tuple) {
start = nd_iterator_init(start, utils::forward<Args>(tuple)...);
x = start % X;
return start / X;
Expand All @@ -377,7 +377,7 @@ inline bool nd_iterator_step() {
return true;
}
template <typename U, typename W, typename... Args>
inline bool nd_iterator_step(U &x, const W &X, Args &&... tuple) {
inline bool nd_iterator_step(U &x, const W &X, Args &&...tuple) {
if (nd_iterator_step(utils::forward<Args>(tuple)...)) {
if (++x - X == 0) {
x = 0;
Expand All @@ -403,7 +403,7 @@ inline bool nd_iterator_jump(U &cur, const U end, W &x, const Y &X) {
}
template <typename U, typename W, typename Y, typename... Args>
inline bool nd_iterator_jump(
U &cur, const U end, W &x, const Y &X, Args &&... tuple) {
U &cur, const U end, W &x, const Y &X, Args &&...tuple) {
if (nd_iterator_jump(cur, end, utils::forward<Args>(tuple)...)) {
if (++x - X == 0) {
x = 0;
Expand All @@ -418,7 +418,7 @@ constexpr T pick(size_t i, const T &x0) {
return x0;
}
template <typename T, typename... Args>
constexpr T pick(size_t i, const T &x0, Args &&... args) {
constexpr T pick(size_t i, const T &x0, Args &&...args) {
return i == 0 ? x0 : pick(i - 1, utils::forward<Args>(args)...);
}

Expand Down Expand Up @@ -510,7 +510,7 @@ std::string format_impl(const char *fmt, Args... args) {
}

template <typename... Args>
std::string format(const char *fmt, Args &&... args) {
std::string format(const char *fmt, Args &&...args) {
return format_impl(fmt, format_cvt_impl(std::forward<Args>(args))...);
}

Expand Down
6 changes: 3 additions & 3 deletions src/cpu/aarch64/jit_sve_512_conv_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4150,9 +4150,9 @@ status_t jit_sve_512_conv_bwd_weights_kernel_f32::init_conf(
&& (kernel_size < L2_cache_size / 2);
}

jcp.harness = use_nxc_harness
? harness_nxc
: ndims == 5 ? harness_3d_reduction : harness_mb_reduction;
jcp.harness = use_nxc_harness ? harness_nxc
: ndims == 5 ? harness_3d_reduction
: harness_mb_reduction;
if (jcp.dilate_h == 0 && jcp.ndims == 4 && jcp.oh > min_oh_reduce
&& jcp.ver == ver_fma && !jcp.is_hw_transp && !is_data_layout_nxc)
jcp.harness = harness_2d_reduction; // 2d harness with oh reduction
Expand Down
8 changes: 4 additions & 4 deletions src/cpu/aarch64/jit_sve_512_core_x8s8s32x_deconvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,15 @@ void jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::kh_loop(int ur_w,
}
}
template <cpu_isa_t isa>
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_tail_size() const
noexcept {
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_tail_size()
const noexcept {
return jcp.is_depthwise ? jcp.ngroups % jcp.ch_block
: jcp.oc_without_padding % jcp.oc_block;
}

template <cpu_isa_t isa>
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_blocking_size() const
noexcept {
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_blocking_size()
const noexcept {
return jcp.is_depthwise ? jcp.ch_block : jcp.oc_block;
}

Expand Down
22 changes: 10 additions & 12 deletions src/cpu/aarch64/jit_sve_512_x8s8s32x_conv_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ void jit_sve_512_x8s8s32x_fwd_kernel::store_output(
auto re = get_offset(aux_output_offset);

auto reg_tmp_adr = ((j % 4) == 0) ? reg_tmp0_adr
: ((j % 4) == 1)
? reg_tmp1_adr
: ((j % 4) == 2) ? reg_tmp2_adr : reg_tmp3_adr;
: ((j % 4) == 1) ? reg_tmp1_adr
: ((j % 4) == 2) ? reg_tmp2_adr
: reg_tmp3_adr;
auto reg_tmp_imm = ((j % 4) == 0) ? reg_tmp0_imm
: ((j % 4) == 1)
? reg_tmp1_imm
: ((j % 4) == 2) ? reg_tmp2_imm : reg_tmp3_imm;
: ((j % 4) == 1) ? reg_tmp1_imm
: ((j % 4) == 2) ? reg_tmp2_imm
: reg_tmp3_imm;
add_imm(reg_tmp_adr, base, re, reg_tmp_imm);

auto vmm = vmm_out(j, k);
Expand Down Expand Up @@ -570,15 +570,13 @@ void jit_sve_512_x8s8s32x_fwd_kernel::compute_ker(int ur_w, int pad_l,
auto reg_tmp_adr = ((jj % 4) == 0)
? reg_tmp0_adr
: ((jj % 4) == 1) ? reg_tmp1_adr
: ((jj % 4) == 2)
? reg_tmp2_adr
: reg_tmp3_adr;
: ((jj % 4) == 2) ? reg_tmp2_adr
: reg_tmp3_adr;
auto reg_tmp_imm = ((jj % 4) == 0)
? reg_tmp0_imm
: ((jj % 4) == 1) ? reg_tmp1_imm
: ((jj % 4) == 2)
? reg_tmp2_imm
: reg_tmp3_imm;
: ((jj % 4) == 2) ? reg_tmp2_imm
: reg_tmp3_imm;
add_imm(reg_tmp_adr, base, re, reg_tmp_imm);
ld1rw(vmm_inp(jj, nb_oc_block).s, mask_all_one,
ptr(reg_tmp_adr));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ class CodeArray {
PROTECT_RE = 2 // read/exec
};
explicit CodeArray(size_t maxSize, void *userPtr = 0, Allocator *allocator = 0)
: type_(userPtr == AutoGrow ? AUTO_GROW : (userPtr == 0 || userPtr == DontSetProtectRWE) ? ALLOC_BUF : USER_BUF), alloc_(allocator ? allocator : (Allocator *)&defaultAllocator_), maxSize_(maxSize / CSIZE),
top_(type_ == USER_BUF ? reinterpret_cast<uint32_t *>(userPtr) : alloc_->alloc((std::max<size_t>)(maxSize, CSIZE))), size_(0), isCalledCalcJmpAddress_(false) {
: type_(userPtr == AutoGrow ? AUTO_GROW
: (userPtr == 0 || userPtr == DontSetProtectRWE) ? ALLOC_BUF
: USER_BUF),
alloc_(allocator ? allocator : (Allocator *)&defaultAllocator_), maxSize_(maxSize / CSIZE), top_(type_ == USER_BUF ? reinterpret_cast<uint32_t *>(userPtr) : alloc_->alloc((std::max<size_t>)(maxSize, CSIZE))), size_(0), isCalledCalcJmpAddress_(false) {
if (maxSize_ > 0 && top_ == 0)
throw Error(ERR_CANT_ALLOC);
if ((type_ == ALLOC_BUF && userPtr != DontSetProtectRWE && useProtect()) && !setProtectMode(PROTECT_RWE, false)) {
Expand Down
14 changes: 8 additions & 6 deletions src/cpu/nchw_pooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,10 @@ status_t nchw_pooling_bwd_t<data_type::f32>::execute_backward(
auto b_c = ws_d.blocking_desc().inner_nblks == 0
? 1
: ws_d.blocking_desc().inner_blks[0];
auto ws_offset = (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
: ws_d.blk_off(mb, c / b_c, ow))
auto ws_offset
= (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
: ws_d.blk_off(mb, c / b_c, ow))
+ c % b_c;

const int index = ws_d.data_type() == data_type::u8
Expand Down Expand Up @@ -623,9 +624,10 @@ status_t nchw_pooling_bwd_t<d_type>::execute_backward(
auto b_c = ws_d.blocking_desc().inner_nblks == 0
? 1
: ws_d.blocking_desc().inner_blks[0];
auto ws_offset = (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
: ws_d.blk_off(mb, c / b_c, ow))
auto ws_offset
= (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
: ws_d.blk_off(mb, c / b_c, ow))
+ c % b_c;

const int index = ws_d.data_type() == data_type::u8
Expand Down
92 changes: 44 additions & 48 deletions src/cpu/reorder/simple_reorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,14 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
for (dim_t w = 0; w < W; w++) {
auto i = w_depth
? input[input_d.blk_off<!w_groups>(g, oc, ic, d, h, w)]
: w_height ? input[input_d.blk_off<!w_groups>(
g, oc, ic, h, w)]
: input[input_d.blk_off<!w_groups>(
g, oc, ic, w)];
auto &o = w_depth
? output[output_d.blk_off<!w_groups>(
g, oc, ic, d, h, w)]
: w_height ? output[output_d.blk_off<!w_groups>(
g, oc, ic, h, w)]
: output[output_d.blk_off<!w_groups>(
g, oc, ic, w)];
: w_height
? input[input_d.blk_off<!w_groups>(g, oc, ic, h, w)]
: input[input_d.blk_off<!w_groups>(g, oc, ic, w)];
auto &o = w_depth ? output[output_d.blk_off<!w_groups>(
g, oc, ic, d, h, w)]
: w_height
? output[output_d.blk_off<!w_groups>(g, oc, ic, h, w)]
: output[output_d.blk_off<!w_groups>(g, oc, ic, w)];
const size_t os_off
= (g * OC + oc) * oc_stride + ic * ic_stride;
const float s = src_scales[src_scales_mask == 0 ? 0 : os_off];
Expand Down Expand Up @@ -388,11 +385,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
? 4
: utils::one_of(tag_traits<tag_o>::inner_blks, ib::_2c8b4c,
ib::_2b8a4b)
? 8
: 16;
? 8
: 16;
constexpr dim_t ocblksize
= tag_traits<tag_o>::inner_blks == ib::_4b32a4b
? 32
= tag_traits<tag_o>::inner_blks == ib::_4b32a4b ? 32
: tag_traits<tag_o>::inner_blks == ib::_4b64a4b ? 64
: icblksize;

Expand Down Expand Up @@ -486,10 +482,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
});

#define wei_blk_off(md, g, o, i, d, h, w) \
(is_0d ? (md).blk_off<!w_groups>(g, o, i) \
: is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
: (md).blk_off<!w_groups>(g, o, i, h, w))
(is_0d ? (md).blk_off<!w_groups>(g, o, i) \
: is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
: (md).blk_off<!w_groups>(g, o, i, h, w))
parallel_nd(G, NB_OC, [&](dim_t g, dim_t O) {
for_(dim_t I = 0; I < NB_IC; I++)
for_(dim_t d = 0; d < D; d++)
Expand Down Expand Up @@ -631,9 +627,9 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
}

#define wei_blk_off(md, g, o, i, d, h, w) \
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
: (md).blk_off<!w_groups>(g, o, i, h, w))
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
: (md).blk_off<!w_groups>(g, o, i, h, w))

parallel_nd(G, NB_OC, [&](dim_t g, dim_t O) {
for_(dim_t I = 0; I < IC; I++)
Expand Down Expand Up @@ -753,8 +749,8 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
? 64
: utils::one_of(
tag_traits<tag_o>::inner_blks, ib::_16a4b, ib::_16b4c)
? 4
: 1;
? 4
: 1;
assert(ic_blksize != 1);

const auto &plain_d = order_keep ? input_d : output_d;
Expand Down Expand Up @@ -812,9 +808,9 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
}

#define wei_blk_off(md, g, o, i, d, h, w) \
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
: (md).blk_off<!w_groups>(g, o, i, h, w))
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
: (md).blk_off<!w_groups>(g, o, i, h, w))

parallel_nd(G, NB_OC, [&](dim_t g, dim_t O) {
for_(dim_t I = 0; I < NB_IC; I++)
Expand Down Expand Up @@ -910,14 +906,14 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
? 64
: (utils::one_of(tag_traits<tag_o>::inner_blks, ib::_16a48b4a,
ib::_16b48c4b))
? 48
: (utils::one_of(tag_traits<tag_o>::inner_blks,
ib::_16a32b4a, ib::_16b32c4b))
? 32
: (utils::one_of(tag_traits<tag_o>::inner_blks,
ib::_16a16b4a, ib::_16b16c4b))
? 16
: 1;
? 48
: (utils::one_of(tag_traits<tag_o>::inner_blks, ib::_16a32b4a,
ib::_16b32c4b))
? 32
: (utils::one_of(tag_traits<tag_o>::inner_blks, ib::_16a16b4a,
ib::_16b16c4b))
? 16
: 1;
assert(D1_blksize != 1);

const auto &plain_d = order_keep ? input_d : output_d;
Expand Down Expand Up @@ -1094,8 +1090,8 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
= utils::one_of(tag_o, format_tag::Goihw4g, format_tag::Goiw4g)
? 4
: utils::one_of(tag_o, format_tag::Goihw8g, format_tag::Goiw8g)
? 8
: 16;
? 8
: 16;

const auto &dims = input_d.dims();
const auto &pdims = output_d.padded_dims();
Expand Down Expand Up @@ -1498,8 +1494,9 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
};

#define data_blk_off(md, n, c, d, h, w) \
(is_1d ? (md).blk_off(n, c, w) \
: is_3d ? (md).blk_off(n, c, d, h, w) : (md).blk_off(n, c, h, w))
(is_1d ? (md).blk_off(n, c, w) \
: is_3d ? (md).blk_off(n, c, d, h, w) \
: (md).blk_off(n, c, h, w))

parallel_nd(dims[0], pdims[1] / blksize_16, D, H, W,
[&](dim_t n, dim_t nb_c, dim_t d, dim_t h, dim_t w) {
Expand Down Expand Up @@ -1639,11 +1636,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
};

#define off(md, h0, h1, m0, m1, m2) \
(ndims >= 6 ? (md).blk_off(h0, h1, m0, m1, m2) \
: ndims >= 5 ? (md).blk_off(h0, h1, m1, m2) \
: ndims >= 4 \
? (md).blk_off(h0, h1, m2) \
: /* ndims >= 3 ? */ (md).blk_off(h0, h1))
(ndims >= 6 ? (md).blk_off(h0, h1, m0, m1, m2) \
: ndims >= 5 ? (md).blk_off(h0, h1, m1, m2) \
: ndims >= 4 ? (md).blk_off(h0, h1, m2) \
: /* ndims >= 3 ? */ (md).blk_off(h0, h1))

const int i_mult = order_keep ? blksize : 1;
const int o_mult = order_keep ? 1 : blksize;
Expand Down Expand Up @@ -1848,10 +1844,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,

#define off(md, g, h0, h1, m0, m1, m2) \
(ndims >= 5 + with_g ? (md).blk_off<!with_g>(g, h0, h1, m0, m1, m2) \
: ndims >= 4 + with_g \
? (md).blk_off<!with_g>(g, h0, h1, m1, m2) \
: /* ndims >= 3 + with_g ? */ (md) \
.blk_off<!with_g>(g, h0, h1, m2))
: ndims >= 4 + with_g \
? (md).blk_off<!with_g>(g, h0, h1, m1, m2) \
: /* ndims >= 3 + with_g ? */ (md).blk_off<!with_g>( \
g, h0, h1, m2))

parallel_nd(G, NB_H0, NB_H1, M0, M1, M2,
[&](dim_t g, dim_t nb_h0, dim_t nb_h1, dim_t m0, dim_t m1,
Expand Down
Loading

0 comments on commit 0b1bf84

Please sign in to comment.