Skip to content

Commit 0b1bf84

Browse files
committed
style: apply clang-format 11
1 parent 14f5895 commit 0b1bf84

File tree

74 files changed

+470
-484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+470
-484
lines changed

src/common/dnnl_thread.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ static inline void parallel_nd(dim_t D0, dim_t D1, dim_t D2, dim_t D3, dim_t D4,
658658
/* parallel_nd_in_omp section */
659659

660660
template <typename... Args>
661-
void parallel_nd_in_omp(Args &&... args) {
661+
void parallel_nd_in_omp(Args &&...args) {
662662
#if DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_SEQ
663663
for_nd(0, 1, utils::forward<Args>(args)...);
664664
#elif DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_OMP

src/common/stack_checker.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2021 Intel Corporation
2+
* Copyright 2021-2022 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -130,7 +130,7 @@ namespace stack_checker {
130130
template <typename F, typename... Targs>
131131
struct thread_args_t {
132132
thread_args_t() = delete;
133-
thread_args_t(const F &func, const Targs &... func_args)
133+
thread_args_t(const F &func, const Targs &...func_args)
134134
: func(func)
135135
, func_args(std::forward<Targs>(func_args)...)
136136
, func_retval {} {}
@@ -149,7 +149,7 @@ constexpr size_t get_number_args() {
149149
template <size_t i>
150150
struct executor_t {
151151
template <typename T, typename... Targs>
152-
static void execute(T &thread_args, Targs &... unpacked_func_args) {
152+
static void execute(T &thread_args, Targs &...unpacked_func_args) {
153153
const auto &func_args = thread_args.func_args;
154154
constexpr size_t idx = get_number_args<decltype(func_args)>() - i;
155155
executor_t<i - 1>::execute(thread_args,
@@ -161,7 +161,7 @@ struct executor_t {
161161
template <>
162162
struct executor_t<0> {
163163
template <typename T, typename... Targs>
164-
static void execute(T &thread_args, Targs &... unpacked_func_args) {
164+
static void execute(T &thread_args, Targs &...unpacked_func_args) {
165165
thread_args.func_retval
166166
= thread_args.func(std::forward<Targs>(unpacked_func_args)...);
167167
}
@@ -172,7 +172,7 @@ struct stack_checker_t {
172172

173173
template <typename F, typename... Targs>
174174
typename cpp_compat::invoke_result<F *, Targs...>::type check(
175-
const F &func, const Targs &... func_args) {
175+
const F &func, const Targs &...func_args) {
176176

177177
auto thread_args = utils::make_unique<thread_args_t<F, const Targs...>>(
178178
func, std::forward<const Targs>(func_args)...);

src/common/utils.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ inline typename remove_reference<T>::type zero() {
160160
}
161161

162162
template <typename T, typename... Args>
163-
std::unique_ptr<T> make_unique(Args &&... args) {
163+
std::unique_ptr<T> make_unique(Args &&...args) {
164164
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
165165
}
166166

@@ -367,7 +367,7 @@ inline T nd_iterator_init(T start) {
367367
return start;
368368
}
369369
template <typename T, typename U, typename W, typename... Args>
370-
inline T nd_iterator_init(T start, U &x, const W &X, Args &&... tuple) {
370+
inline T nd_iterator_init(T start, U &x, const W &X, Args &&...tuple) {
371371
start = nd_iterator_init(start, utils::forward<Args>(tuple)...);
372372
x = start % X;
373373
return start / X;
@@ -377,7 +377,7 @@ inline bool nd_iterator_step() {
377377
return true;
378378
}
379379
template <typename U, typename W, typename... Args>
380-
inline bool nd_iterator_step(U &x, const W &X, Args &&... tuple) {
380+
inline bool nd_iterator_step(U &x, const W &X, Args &&...tuple) {
381381
if (nd_iterator_step(utils::forward<Args>(tuple)...)) {
382382
if (++x - X == 0) {
383383
x = 0;
@@ -403,7 +403,7 @@ inline bool nd_iterator_jump(U &cur, const U end, W &x, const Y &X) {
403403
}
404404
template <typename U, typename W, typename Y, typename... Args>
405405
inline bool nd_iterator_jump(
406-
U &cur, const U end, W &x, const Y &X, Args &&... tuple) {
406+
U &cur, const U end, W &x, const Y &X, Args &&...tuple) {
407407
if (nd_iterator_jump(cur, end, utils::forward<Args>(tuple)...)) {
408408
if (++x - X == 0) {
409409
x = 0;
@@ -418,7 +418,7 @@ constexpr T pick(size_t i, const T &x0) {
418418
return x0;
419419
}
420420
template <typename T, typename... Args>
421-
constexpr T pick(size_t i, const T &x0, Args &&... args) {
421+
constexpr T pick(size_t i, const T &x0, Args &&...args) {
422422
return i == 0 ? x0 : pick(i - 1, utils::forward<Args>(args)...);
423423
}
424424

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

512512
template <typename... Args>
513-
std::string format(const char *fmt, Args &&... args) {
513+
std::string format(const char *fmt, Args &&...args) {
514514
return format_impl(fmt, format_cvt_impl(std::forward<Args>(args))...);
515515
}
516516

src/cpu/aarch64/jit_sve_512_conv_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,9 +4150,9 @@ status_t jit_sve_512_conv_bwd_weights_kernel_f32::init_conf(
41504150
&& (kernel_size < L2_cache_size / 2);
41514151
}
41524152

4153-
jcp.harness = use_nxc_harness
4154-
? harness_nxc
4155-
: ndims == 5 ? harness_3d_reduction : harness_mb_reduction;
4153+
jcp.harness = use_nxc_harness ? harness_nxc
4154+
: ndims == 5 ? harness_3d_reduction
4155+
: harness_mb_reduction;
41564156
if (jcp.dilate_h == 0 && jcp.ndims == 4 && jcp.oh > min_oh_reduce
41574157
&& jcp.ver == ver_fma && !jcp.is_hw_transp && !is_data_layout_nxc)
41584158
jcp.harness = harness_2d_reduction; // 2d harness with oh reduction

src/cpu/aarch64/jit_sve_512_core_x8s8s32x_deconvolution.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,15 +845,15 @@ void jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::kh_loop(int ur_w,
845845
}
846846
}
847847
template <cpu_isa_t isa>
848-
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_tail_size() const
849-
noexcept {
848+
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_tail_size()
849+
const noexcept {
850850
return jcp.is_depthwise ? jcp.ngroups % jcp.ch_block
851851
: jcp.oc_without_padding % jcp.oc_block;
852852
}
853853

854854
template <cpu_isa_t isa>
855-
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_blocking_size() const
856-
noexcept {
855+
int jit_sve_512_core_x8s8s32x_deconv_fwd_kernel<isa>::get_blocking_size()
856+
const noexcept {
857857
return jcp.is_depthwise ? jcp.ch_block : jcp.oc_block;
858858
}
859859

src/cpu/aarch64/jit_sve_512_x8s8s32x_conv_kernel.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,13 @@ void jit_sve_512_x8s8s32x_fwd_kernel::store_output(
268268
auto re = get_offset(aux_output_offset);
269269

270270
auto reg_tmp_adr = ((j % 4) == 0) ? reg_tmp0_adr
271-
: ((j % 4) == 1)
272-
? reg_tmp1_adr
273-
: ((j % 4) == 2) ? reg_tmp2_adr : reg_tmp3_adr;
271+
: ((j % 4) == 1) ? reg_tmp1_adr
272+
: ((j % 4) == 2) ? reg_tmp2_adr
273+
: reg_tmp3_adr;
274274
auto reg_tmp_imm = ((j % 4) == 0) ? reg_tmp0_imm
275-
: ((j % 4) == 1)
276-
? reg_tmp1_imm
277-
: ((j % 4) == 2) ? reg_tmp2_imm : reg_tmp3_imm;
275+
: ((j % 4) == 1) ? reg_tmp1_imm
276+
: ((j % 4) == 2) ? reg_tmp2_imm
277+
: reg_tmp3_imm;
278278
add_imm(reg_tmp_adr, base, re, reg_tmp_imm);
279279

280280
auto vmm = vmm_out(j, k);
@@ -570,15 +570,13 @@ void jit_sve_512_x8s8s32x_fwd_kernel::compute_ker(int ur_w, int pad_l,
570570
auto reg_tmp_adr = ((jj % 4) == 0)
571571
? reg_tmp0_adr
572572
: ((jj % 4) == 1) ? reg_tmp1_adr
573-
: ((jj % 4) == 2)
574-
? reg_tmp2_adr
575-
: reg_tmp3_adr;
573+
: ((jj % 4) == 2) ? reg_tmp2_adr
574+
: reg_tmp3_adr;
576575
auto reg_tmp_imm = ((jj % 4) == 0)
577576
? reg_tmp0_imm
578577
: ((jj % 4) == 1) ? reg_tmp1_imm
579-
: ((jj % 4) == 2)
580-
? reg_tmp2_imm
581-
: reg_tmp3_imm;
578+
: ((jj % 4) == 2) ? reg_tmp2_imm
579+
: reg_tmp3_imm;
582580
add_imm(reg_tmp_adr, base, re, reg_tmp_imm);
583581
ld1rw(vmm_inp(jj, nb_oc_block).s, mask_all_one,
584582
ptr(reg_tmp_adr));

src/cpu/aarch64/xbyak_aarch64/xbyak_aarch64/xbyak_aarch64_code_array.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,10 @@ class CodeArray {
164164
PROTECT_RE = 2 // read/exec
165165
};
166166
explicit CodeArray(size_t maxSize, void *userPtr = 0, Allocator *allocator = 0)
167-
: type_(userPtr == AutoGrow ? AUTO_GROW : (userPtr == 0 || userPtr == DontSetProtectRWE) ? ALLOC_BUF : USER_BUF), alloc_(allocator ? allocator : (Allocator *)&defaultAllocator_), maxSize_(maxSize / CSIZE),
168-
top_(type_ == USER_BUF ? reinterpret_cast<uint32_t *>(userPtr) : alloc_->alloc((std::max<size_t>)(maxSize, CSIZE))), size_(0), isCalledCalcJmpAddress_(false) {
167+
: type_(userPtr == AutoGrow ? AUTO_GROW
168+
: (userPtr == 0 || userPtr == DontSetProtectRWE) ? ALLOC_BUF
169+
: USER_BUF),
170+
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) {
169171
if (maxSize_ > 0 && top_ == 0)
170172
throw Error(ERR_CANT_ALLOC);
171173
if ((type_ == ALLOC_BUF && userPtr != DontSetProtectRWE && useProtect()) && !setProtectMode(PROTECT_RWE, false)) {

src/cpu/nchw_pooling.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,10 @@ status_t nchw_pooling_bwd_t<data_type::f32>::execute_backward(
465465
auto b_c = ws_d.blocking_desc().inner_nblks == 0
466466
? 1
467467
: ws_d.blocking_desc().inner_blks[0];
468-
auto ws_offset = (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
469-
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
470-
: ws_d.blk_off(mb, c / b_c, ow))
468+
auto ws_offset
469+
= (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
470+
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
471+
: ws_d.blk_off(mb, c / b_c, ow))
471472
+ c % b_c;
472473

473474
const int index = ws_d.data_type() == data_type::u8
@@ -623,9 +624,10 @@ status_t nchw_pooling_bwd_t<d_type>::execute_backward(
623624
auto b_c = ws_d.blocking_desc().inner_nblks == 0
624625
? 1
625626
: ws_d.blocking_desc().inner_blks[0];
626-
auto ws_offset = (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
627-
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
628-
: ws_d.blk_off(mb, c / b_c, ow))
627+
auto ws_offset
628+
= (is_3d ? ws_d.blk_off(mb, c / b_c, od, oh, ow)
629+
: is_2d ? ws_d.blk_off(mb, c / b_c, oh, ow)
630+
: ws_d.blk_off(mb, c / b_c, ow))
629631
+ c % b_c;
630632

631633
const int index = ws_d.data_type() == data_type::u8

src/cpu/reorder/simple_reorder.hpp

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,14 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
253253
for (dim_t w = 0; w < W; w++) {
254254
auto i = w_depth
255255
? input[input_d.blk_off<!w_groups>(g, oc, ic, d, h, w)]
256-
: w_height ? input[input_d.blk_off<!w_groups>(
257-
g, oc, ic, h, w)]
258-
: input[input_d.blk_off<!w_groups>(
259-
g, oc, ic, w)];
260-
auto &o = w_depth
261-
? output[output_d.blk_off<!w_groups>(
262-
g, oc, ic, d, h, w)]
263-
: w_height ? output[output_d.blk_off<!w_groups>(
264-
g, oc, ic, h, w)]
265-
: output[output_d.blk_off<!w_groups>(
266-
g, oc, ic, w)];
256+
: w_height
257+
? input[input_d.blk_off<!w_groups>(g, oc, ic, h, w)]
258+
: input[input_d.blk_off<!w_groups>(g, oc, ic, w)];
259+
auto &o = w_depth ? output[output_d.blk_off<!w_groups>(
260+
g, oc, ic, d, h, w)]
261+
: w_height
262+
? output[output_d.blk_off<!w_groups>(g, oc, ic, h, w)]
263+
: output[output_d.blk_off<!w_groups>(g, oc, ic, w)];
267264
const size_t os_off
268265
= (g * OC + oc) * oc_stride + ic * ic_stride;
269266
const float s = src_scales[src_scales_mask == 0 ? 0 : os_off];
@@ -388,11 +385,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
388385
? 4
389386
: utils::one_of(tag_traits<tag_o>::inner_blks, ib::_2c8b4c,
390387
ib::_2b8a4b)
391-
? 8
392-
: 16;
388+
? 8
389+
: 16;
393390
constexpr dim_t ocblksize
394-
= tag_traits<tag_o>::inner_blks == ib::_4b32a4b
395-
? 32
391+
= tag_traits<tag_o>::inner_blks == ib::_4b32a4b ? 32
396392
: tag_traits<tag_o>::inner_blks == ib::_4b64a4b ? 64
397393
: icblksize;
398394

@@ -486,10 +482,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
486482
});
487483

488484
#define wei_blk_off(md, g, o, i, d, h, w) \
489-
(is_0d ? (md).blk_off<!w_groups>(g, o, i) \
490-
: is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
491-
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
492-
: (md).blk_off<!w_groups>(g, o, i, h, w))
485+
(is_0d ? (md).blk_off<!w_groups>(g, o, i) \
486+
: is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
487+
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
488+
: (md).blk_off<!w_groups>(g, o, i, h, w))
493489
parallel_nd(G, NB_OC, [&](dim_t g, dim_t O) {
494490
for_(dim_t I = 0; I < NB_IC; I++)
495491
for_(dim_t d = 0; d < D; d++)
@@ -631,9 +627,9 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
631627
}
632628

633629
#define wei_blk_off(md, g, o, i, d, h, w) \
634-
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
635-
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
636-
: (md).blk_off<!w_groups>(g, o, i, h, w))
630+
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
631+
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
632+
: (md).blk_off<!w_groups>(g, o, i, h, w))
637633

638634
parallel_nd(G, NB_OC, [&](dim_t g, dim_t O) {
639635
for_(dim_t I = 0; I < IC; I++)
@@ -753,8 +749,8 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
753749
? 64
754750
: utils::one_of(
755751
tag_traits<tag_o>::inner_blks, ib::_16a4b, ib::_16b4c)
756-
? 4
757-
: 1;
752+
? 4
753+
: 1;
758754
assert(ic_blksize != 1);
759755

760756
const auto &plain_d = order_keep ? input_d : output_d;
@@ -812,9 +808,9 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
812808
}
813809

814810
#define wei_blk_off(md, g, o, i, d, h, w) \
815-
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
816-
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
817-
: (md).blk_off<!w_groups>(g, o, i, h, w))
811+
(is_1d ? (md).blk_off<!w_groups>(g, o, i, w) \
812+
: is_3d ? (md).blk_off<!w_groups>(g, o, i, d, h, w) \
813+
: (md).blk_off<!w_groups>(g, o, i, h, w))
818814

819815
parallel_nd(G, NB_OC, [&](dim_t g, dim_t O) {
820816
for_(dim_t I = 0; I < NB_IC; I++)
@@ -910,14 +906,14 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
910906
? 64
911907
: (utils::one_of(tag_traits<tag_o>::inner_blks, ib::_16a48b4a,
912908
ib::_16b48c4b))
913-
? 48
914-
: (utils::one_of(tag_traits<tag_o>::inner_blks,
915-
ib::_16a32b4a, ib::_16b32c4b))
916-
? 32
917-
: (utils::one_of(tag_traits<tag_o>::inner_blks,
918-
ib::_16a16b4a, ib::_16b16c4b))
919-
? 16
920-
: 1;
909+
? 48
910+
: (utils::one_of(tag_traits<tag_o>::inner_blks, ib::_16a32b4a,
911+
ib::_16b32c4b))
912+
? 32
913+
: (utils::one_of(tag_traits<tag_o>::inner_blks, ib::_16a16b4a,
914+
ib::_16b16c4b))
915+
? 16
916+
: 1;
921917
assert(D1_blksize != 1);
922918

923919
const auto &plain_d = order_keep ? input_d : output_d;
@@ -1094,8 +1090,8 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
10941090
= utils::one_of(tag_o, format_tag::Goihw4g, format_tag::Goiw4g)
10951091
? 4
10961092
: utils::one_of(tag_o, format_tag::Goihw8g, format_tag::Goiw8g)
1097-
? 8
1098-
: 16;
1093+
? 8
1094+
: 16;
10991095

11001096
const auto &dims = input_d.dims();
11011097
const auto &pdims = output_d.padded_dims();
@@ -1498,8 +1494,9 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
14981494
};
14991495

15001496
#define data_blk_off(md, n, c, d, h, w) \
1501-
(is_1d ? (md).blk_off(n, c, w) \
1502-
: is_3d ? (md).blk_off(n, c, d, h, w) : (md).blk_off(n, c, h, w))
1497+
(is_1d ? (md).blk_off(n, c, w) \
1498+
: is_3d ? (md).blk_off(n, c, d, h, w) \
1499+
: (md).blk_off(n, c, h, w))
15031500

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

16411638
#define off(md, h0, h1, m0, m1, m2) \
1642-
(ndims >= 6 ? (md).blk_off(h0, h1, m0, m1, m2) \
1643-
: ndims >= 5 ? (md).blk_off(h0, h1, m1, m2) \
1644-
: ndims >= 4 \
1645-
? (md).blk_off(h0, h1, m2) \
1646-
: /* ndims >= 3 ? */ (md).blk_off(h0, h1))
1639+
(ndims >= 6 ? (md).blk_off(h0, h1, m0, m1, m2) \
1640+
: ndims >= 5 ? (md).blk_off(h0, h1, m1, m2) \
1641+
: ndims >= 4 ? (md).blk_off(h0, h1, m2) \
1642+
: /* ndims >= 3 ? */ (md).blk_off(h0, h1))
16471643

16481644
const int i_mult = order_keep ? blksize : 1;
16491645
const int o_mult = order_keep ? 1 : blksize;
@@ -1848,10 +1844,10 @@ struct simple_reorder_impl<SIMPLE_REORDER_TEMPL_CALL,
18481844

18491845
#define off(md, g, h0, h1, m0, m1, m2) \
18501846
(ndims >= 5 + with_g ? (md).blk_off<!with_g>(g, h0, h1, m0, m1, m2) \
1851-
: ndims >= 4 + with_g \
1852-
? (md).blk_off<!with_g>(g, h0, h1, m1, m2) \
1853-
: /* ndims >= 3 + with_g ? */ (md) \
1854-
.blk_off<!with_g>(g, h0, h1, m2))
1847+
: ndims >= 4 + with_g \
1848+
? (md).blk_off<!with_g>(g, h0, h1, m1, m2) \
1849+
: /* ndims >= 3 + with_g ? */ (md).blk_off<!with_g>( \
1850+
g, h0, h1, m2))
18551851

18561852
parallel_nd(G, NB_H0, NB_H1, M0, M1, M2,
18571853
[&](dim_t g, dim_t nb_h0, dim_t nb_h1, dim_t m0, dim_t m1,

0 commit comments

Comments
 (0)