Skip to content

Commit 414acfa

Browse files
committed
all: clang-format: apply LambdaBodyIndentation=OuterScope
1 parent 8e5a57f commit 414acfa

File tree

294 files changed

+6500
-7000
lines changed

Some content is hidden

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

294 files changed

+6500
-7000
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ IndentPPDirectives: None
8383
IndentWidth: 4
8484
IndentWrappedFunctionNames: false
8585
KeepEmptyLinesAtTheStartOfBlocks: true
86+
LambdaBodyIndentation : OuterScope
8687
MacroBlockBegin: ''
8788
MacroBlockEnd: ''
8889
MaxEmptyLinesToKeep: 1

examples/rnn_training_f32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ void simple_net(engine::kind engine_kind) {
172172

173173
// Create auxiliary f32 memory descriptor
174174
// based on user- supplied dimensions and layout.
175-
auto formatted_md = [=](const memory::dims &dimensions,
176-
memory::format_tag layout) {
175+
auto formatted_md
176+
= [=](const memory::dims &dimensions, memory::format_tag layout) {
177177
return memory::desc {{dimensions}, memory::data_type::f32, layout};
178178
};
179179
// Create auxiliary generic f32 memory descriptor

examples/ukernels/cpu_brgemm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ void brgemm_example() {
121121
// Initialize binary_add.
122122
std::generate(
123123
binary_add_user_data.begin(), binary_add_user_data.end(), []() {
124-
static int i = 3;
125-
return i++ % 6;
126-
});
124+
static int i = 3;
125+
return i++ % 6;
126+
});
127127
// Initialize B scales.
128128
std::generate(B_scales_user_data.begin(), B_scales_user_data.end(), []() {
129129
static int i = 4;

src/common/cache_utils.hpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,20 +289,19 @@ struct lru_cache_t final : public cache_t<K, O, C, key_merge> {
289289
auto it = std::min_element(cache_mapper().begin(),
290290
cache_mapper().end(),
291291
[&](const v_t &left, const v_t &right) {
292-
// By default, load() and operator T use sequentially
293-
// consistent memory ordering, which enforces writing
294-
// the timestamps into registers in the same exact order
295-
// they are read from the CPU cache line. Since eviction
296-
// is performed under a write lock, this order is not
297-
// important, therefore we can safely use the weakest
298-
// memory ordering (relaxed). This brings about a few
299-
// microseconds performance improvement for default
300-
// cache capacity.
301-
return left.second.timestamp_.load(
302-
std::memory_order_relaxed)
303-
< right.second.timestamp_.load(
304-
std::memory_order_relaxed);
305-
});
292+
// By default, load() and operator T use sequentially
293+
// consistent memory ordering, which enforces writing
294+
// the timestamps into registers in the same exact order
295+
// they are read from the CPU cache line. Since eviction
296+
// is performed under a write lock, this order is not
297+
// important, therefore we can safely use the weakest
298+
// memory ordering (relaxed). This brings about a few
299+
// microseconds performance improvement for default
300+
// cache capacity.
301+
return left.second.timestamp_.load(std::memory_order_relaxed)
302+
< right.second.timestamp_.load(
303+
std::memory_order_relaxed);
304+
});
306305
auto res = cache_mapper().erase(it->first);
307306
MAYBE_UNUSED(res);
308307
assert(res);

src/common/dnnl_thread.hpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -306,23 +306,20 @@ static inline void parallel(int nthr, const std::function<void(int, int)> &f) {
306306
#endif
307307
}
308308
#elif DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_TBB
309-
tbb::parallel_for(
310-
0, nthr,
311-
[&](int ithr) {
309+
tbb::parallel_for(0, nthr, [&](int ithr) {
312310
#if defined(DNNL_ENABLE_ITT_TASKS)
313-
bool mark_task = itt::primitive_task_get_current_kind()
314-
== primitive_kind::undefined;
315-
if (mark_task && itt_enable)
316-
itt::primitive_task_start(task_primitive_kind,
317-
task_primitive_info, task_primitive_log_kind);
311+
bool mark_task = itt::primitive_task_get_current_kind()
312+
== primitive_kind::undefined;
313+
if (mark_task && itt_enable)
314+
itt::primitive_task_start(task_primitive_kind, task_primitive_info,
315+
task_primitive_log_kind);
318316
#endif
319-
f(ithr, nthr);
317+
f(ithr, nthr);
320318
#if defined(DNNL_ENABLE_ITT_TASKS)
321-
if (mark_task && itt_enable)
322-
itt::primitive_task_end(task_primitive_log_kind);
319+
if (mark_task && itt_enable)
320+
itt::primitive_task_end(task_primitive_log_kind);
323321
#endif
324-
},
325-
tbb::static_partitioner());
322+
}, tbb::static_partitioner());
326323
#elif DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_THREADPOOL
327324
using namespace dnnl::impl::threadpool_utils;
328325
dnnl::threadpool_interop::threadpool_iface *tp = get_active_threadpool();

src/common/memory_desc_wrapper.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ struct memory_desc_wrapper : public c_compatible {
240240

241241
auto calculate_size
242242
= [ndims, &pdims](int cmask, size_t buff_data_size) {
243-
assert(utils::one_of(cmask, 1, 2, 3, 5, 13, 27));
244-
dim_t prod = 1;
245-
for (int d = 0; d < ndims; ++d)
246-
if (cmask & (1 << d)) { prod *= pdims[d]; }
247-
return (size_t)prod * buff_data_size;
248-
};
243+
assert(utils::one_of(cmask, 1, 2, 3, 5, 13, 27));
244+
dim_t prod = 1;
245+
for (int d = 0; d < ndims; ++d)
246+
if (cmask & (1 << d)) { prod *= pdims[d]; }
247+
return (size_t)prod * buff_data_size;
248+
};
249249

250250
if (flag == compensation_conv_s8s8) {
251251
return calculate_size(extra().compensation_mask,

src/common/memory_zero_pad.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,40 +93,40 @@ void typed_zero_pad_blk(const memory_desc_wrapper &m_d, void *data_handle) {
9393
if (c_tail_s) {
9494
parallel_nd(A, B, D, E, F,
9595
[=](dim_t a, dim_t b, dim_t d, dim_t e, dim_t f) {
96-
auto x = &data[m_d.blk_off(a, b, C - 1, d, e, f)];
97-
if (blk_kind == c)
98-
zeroize_tail(x, c_tail_s);
99-
else if (blk_kind == bc)
100-
zeroize_tail_inner(x, c_tail_s);
101-
else if (blk_kind == cb)
102-
zeroize_tail_outer(x, c_tail_s);
103-
});
96+
auto x = &data[m_d.blk_off(a, b, C - 1, d, e, f)];
97+
if (blk_kind == c)
98+
zeroize_tail(x, c_tail_s);
99+
else if (blk_kind == bc)
100+
zeroize_tail_inner(x, c_tail_s);
101+
else if (blk_kind == cb)
102+
zeroize_tail_outer(x, c_tail_s);
103+
});
104104
}
105105

106106
if (b_tail_s) {
107107
parallel_nd(A, C, D, E, F,
108108
[=](dim_t a, dim_t c, dim_t d, dim_t e, dim_t f) {
109-
auto x = &data[m_d.blk_off(a, B - 1, c, d, e, f)];
110-
if (blk_kind == b)
111-
zeroize_tail(x, b_tail_s);
112-
else if (blk_kind == ab || blk_kind == cb)
113-
zeroize_tail_inner(x, b_tail_s);
114-
else if (blk_kind == ba || blk_kind == bc)
115-
zeroize_tail_outer(x, b_tail_s);
116-
});
109+
auto x = &data[m_d.blk_off(a, B - 1, c, d, e, f)];
110+
if (blk_kind == b)
111+
zeroize_tail(x, b_tail_s);
112+
else if (blk_kind == ab || blk_kind == cb)
113+
zeroize_tail_inner(x, b_tail_s);
114+
else if (blk_kind == ba || blk_kind == bc)
115+
zeroize_tail_outer(x, b_tail_s);
116+
});
117117
}
118118

119119
if (a_tail_s) {
120120
parallel_nd(B, C, D, E, F,
121121
[=](dim_t b, dim_t c, dim_t d, dim_t e, dim_t f) {
122-
auto x = &data[m_d.blk_off(A - 1, b, c, d, e, f)];
123-
if (blk_kind == a)
124-
zeroize_tail(x, a_tail_s);
125-
else if (blk_kind == ba)
126-
zeroize_tail_inner(x, a_tail_s);
127-
else if (blk_kind == ab)
128-
zeroize_tail_outer(x, a_tail_s);
129-
});
122+
auto x = &data[m_d.blk_off(A - 1, b, c, d, e, f)];
123+
if (blk_kind == a)
124+
zeroize_tail(x, a_tail_s);
125+
else if (blk_kind == ba)
126+
zeroize_tail_inner(x, a_tail_s);
127+
else if (blk_kind == ab)
128+
zeroize_tail_outer(x, a_tail_s);
129+
});
130130
}
131131
}
132132

src/common/type_helpers.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,10 +1212,10 @@ inline status_t memory_desc_init_by_blocking_desc(
12121212

12131213
utils::simultaneous_sort(
12141214
mblk.strides, ou_blocks, perm, ndims, [](stride_t a, stride_t b) {
1215-
if (utils::one_of(DNNL_RUNTIME_DIM_VAL, a, b))
1216-
return DNNL_RUNTIME_DIM_VAL;
1217-
return b - a;
1218-
});
1215+
if (utils::one_of(DNNL_RUNTIME_DIM_VAL, a, b))
1216+
return DNNL_RUNTIME_DIM_VAL;
1217+
return b - a;
1218+
});
12191219

12201220
dim_t stride = block_size;
12211221
for (int _d = ndims - 1; _d >= 0; --_d) {

src/common/verbose.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -446,20 +446,20 @@ std::string md2fmt_tag_str(const memory_desc_t *md) {
446446
// output tag: acdb
447447
std::sort(sort_keys.begin(), sort_keys.end(),
448448
[](const sort_key_t &left, const sort_key_t &right) {
449-
if (left.stride_order < right.stride_order) return false;
450-
if (left.stride_order == right.stride_order) {
451-
// WLOG, we can assume a dimension of size 1 has the same
452-
// stride as the next outermost dimension. Sort the one with
453-
// the non-unit outer block as the outer dimension. Multiple
454-
// dimensions of size 1 with the same stride is ambiguous.
455-
if (left.outer_block < right.outer_block) return false;
456-
if (left.outer_block == right.outer_block)
457-
// Sort 1x1x... outer blocks to (arbitrarily) list them
458-
// in alphabetical order.
459-
return left.idx < right.idx;
460-
}
461-
return true;
462-
});
449+
if (left.stride_order < right.stride_order) return false;
450+
if (left.stride_order == right.stride_order) {
451+
// WLOG, we can assume a dimension of size 1 has the same
452+
// stride as the next outermost dimension. Sort the one with
453+
// the non-unit outer block as the outer dimension. Multiple
454+
// dimensions of size 1 with the same stride is ambiguous.
455+
if (left.outer_block < right.outer_block) return false;
456+
if (left.outer_block == right.outer_block)
457+
// Sort 1x1x... outer blocks to (arbitrarily) list them
458+
// in alphabetical order.
459+
return left.idx < right.idx;
460+
}
461+
return true;
462+
});
463463

464464
char dim_chars[DNNL_MAX_NDIMS + 1];
465465
for (int i = 0; i < mdw.ndims(); ++i)

src/cpu/aarch64/cpu_barrier.hpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ namespace simple_barrier {
3333

3434
#define CTX_ALIGNMENT 4096
3535

36-
STRUCT_ALIGN(
37-
CTX_ALIGNMENT, struct ctx_t {
38-
enum { CACHE_LINE_SIZE = 256 };
39-
volatile size_t ctr;
40-
char pad1[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
41-
volatile size_t sense;
42-
char pad2[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
43-
});
36+
STRUCT_ALIGN(CTX_ALIGNMENT, struct ctx_t {
37+
enum { CACHE_LINE_SIZE = 256 };
38+
volatile size_t ctr;
39+
char pad1[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
40+
volatile size_t sense;
41+
char pad2[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
42+
});
4443

4544
/* TODO: remove ctx_64_t once batch normalization switches to barrier-less
4645
* implementation.
@@ -49,14 +48,13 @@ STRUCT_ALIGN(
4948
* stable with page alignment compared to cache line size alignment.
5049
* Batch normalization (that creates C / simd_w barriers) degrades with page
5150
* alignment due to significant overhead of ctx_init in case of mb=1. */
52-
STRUCT_ALIGN(
53-
256, struct ctx_64_t {
54-
enum { CACHE_LINE_SIZE = 256 };
55-
volatile size_t ctr;
56-
char pad1[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
57-
volatile size_t sense;
58-
char pad2[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
59-
});
51+
STRUCT_ALIGN(256, struct ctx_64_t {
52+
enum { CACHE_LINE_SIZE = 256 };
53+
volatile size_t ctr;
54+
char pad1[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
55+
volatile size_t sense;
56+
char pad2[CACHE_LINE_SIZE - 1 * sizeof(size_t)];
57+
});
6058

6159
template <typename ctx_t>
6260
inline void ctx_init(ctx_t *ctx) {

0 commit comments

Comments
 (0)