Skip to content

Commit e21515a

Browse files
committed
More tidy checks
Signed-off-by: cyy <cyyever@outlook.com>
1 parent 76c16e5 commit e21515a

File tree

71 files changed

+269
-284
lines changed

Some content is hidden

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

71 files changed

+269
-284
lines changed

.clang-tidy

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,60 @@ Checks: '
1010
clang-analyzer*,
1111
clang-diagnostic-missing-prototypes,
1212
cppcoreguidelines-init-variables,
13-
bugprone-argument-comment,
14-
misc-use-internal-linkage,
13+
bugprone*,
14+
-bugprone-crtp-constructor-accessibility,
15+
-bugprone-easily-swappable-parameters,
16+
-bugprone-exception-escape,
17+
-bugprone-implicit*,
18+
-bugprone-macro-parentheses,
19+
-bugprone-narrowing-conversions,
20+
-bugprone-reserved-identifier,
21+
-bugprone-signed-char-misuse,
22+
-bugprone-switch-missing-default-case,
23+
misc-*,
24+
-misc-confusable-identifiers,
25+
-misc-const-correctness,
26+
-misc-include-cleaner,
27+
-misc-no-recursion,
28+
-misc-non-private-member-variables-in-classes,
29+
-misc-use-anonymous-namespace,
30+
-misc-unused-parameters,
1531
modernize*,
16-
-modernize-use-auto,
17-
-modernize-use-constraints,
18-
-modernize-use-trailing-return-type,
1932
-modernize-avoid-c-arrays,
2033
-modernize-avoid-bind,
34+
-modernize-return-braced-init-list,
35+
-modernize-use-auto,
36+
-modernize-use-constraints,
2137
-modernize-use-designated-initializers,
22-
-modernize-use-ranges,
23-
-modernize-use-integer-sign-comparison
38+
-modernize-use-integer-sign-comparison,
2439
-modernize-use-nodiscard,
40+
-modernize-use-ranges,
41+
-modernize-use-trailing-return-type,
42+
-modernize-use-transparent-functors,
2543
performance*,
44+
-performance-enum-size,
45+
readability*,
46+
-readability-avoid-nested-conditional-operator,
47+
-readability-avoid-const-params-in-decls,
48+
-readability-avoid-unconditional-preprocessor-if,
49+
-readability-braces-around-statements,
50+
-readability-container-contains,
51+
-readability-convert-member-functions-to-static,
52+
-readability-else-after-return,
53+
-readability-function-cognitive-complexity,
54+
-readability-identifier-length,
55+
-readability-implicit-bool-conversion,
56+
-readability-isolate-declaration,
57+
-readability-make-member-function-const,
58+
-readability-magic-numbers,
59+
-readability-math-missing-parentheses,
60+
-readability-non-const-parameter,
61+
-readability-qualified-auto,
62+
-readability-uppercase-literal-suffix,
63+
-readability-redundant-access-specifiers,
64+
-readability-redundant-control-flow,
65+
-readability-simplify-boolean-expr,
66+
-readability-suspicious-call-argument,
2667
'
2768
CheckOptions:
2869
- key: facebook-cuda-safe-api-call-check.HandlerName

bench/BenchUtils.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ namespace fbgemm {
2222
static std::default_random_engine eng;
2323

2424
template <typename T>
25-
void randFill(aligned_vector<T>& vec, T low, T high, std::true_type) {
25+
void randFill(aligned_vector<T>& vec, T low, T high, std::true_type /*unused*/) {
2626
std::uniform_int_distribution<int> dis(low, high);
2727
std::generate(vec.begin(), vec.end(), [&] { return dis(eng); });
2828
}
2929

3030
template <typename T>
31-
void randFill(aligned_vector<T>& vec, T low, T high, std::false_type) {
31+
void randFill(aligned_vector<T>& vec, T low, T high, std::false_type /*unused*/) {
3232
std::uniform_real_distribution<T> dis(low, high);
3333
std::generate(vec.begin(), vec.end(), [&] { return dis(eng); });
3434
}
@@ -124,7 +124,7 @@ bool parseArgumentBool(
124124
}
125125

126126
#if defined(USE_MKL)
127-
void test_xerbla(char* srname, const int* info, int) {
127+
void test_xerbla(char* srname, const int* info, int /*unused*/) {
128128
// srname - name of the function that called xerbla
129129
// info - position of the invalid parameter in the parameter list
130130
// len - length of the name in bytes

bench/EmbeddingSpMDMBenchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ int main() {
408408
cout << "Mean ";
409409
}
410410
cout << input_dtype << " inputs";
411-
bool use_fp16_inputs = input_dtype == "fp16" ? true : false;
412-
bool use_bf16_inputs = input_dtype == "fp16" ? true : false;
411+
bool use_fp16_inputs = input_dtype == "fp16";
412+
bool use_bf16_inputs = input_dtype == "fp16";
413413
cout << (use_32_bit_indices ? " 32" : " 64") << " bit indices";
414414
if (prefetch) {
415415
cout << " with prefetching";

bench/GEMMsBenchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ performance_test(const int M, const int N, const int K, const bool timebreak) {
224224
}
225225
}
226226
if (flush) {
227-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
227+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
228228
}
229229
// printMatrix(matrix_op_t::NoTranspose, Bint8.data(), k, n, n, "B
230230
// unpacked");
@@ -312,7 +312,7 @@ performance_test(const int M, const int N, const int K, const bool timebreak) {
312312
}
313313
}
314314
if (flush) {
315-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
315+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
316316
}
317317
// printMatrix(matrix_op_t::NoTranspose, Bint8.data(), k, n, n, "B
318318
// unpacked");

bench/GEMMsTunableBenchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static void performance_test(
160160
}
161161
}
162162
if (flush) {
163-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
163+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
164164
}
165165

166166
#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN

bench/GroupwiseConvRequantizeBenchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static void performance_test() {
453453
}
454454

455455
if (flush) {
456-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
456+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
457457
}
458458

459459
// packedB.printPackedMatrix("bench B Packed");

bench/Im2ColFusedRequantizeBenchmark.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static void performance_test() {
289289
}
290290

291291
if (flush) {
292-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
292+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
293293
}
294294

295295
// packedB.printPackedMatrix("bench B Packed");

bench/PackedFloatInOutBenchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void performance_test() {
167167
ttot *= 1e9; // convert to ns
168168

169169
if (flush) {
170-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
170+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
171171
}
172172

173173
cout << setw(6) << m << ", " << setw(6) << n << ", " << setw(6) << k
@@ -269,7 +269,7 @@ static void performance_test() {
269269
}
270270
}
271271
if (flush) {
272-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
272+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
273273
}
274274
// printMatrix(matrix_op_t::NoTranspose, Bint8.data(), k, n, n, "B
275275
// unpacked");

bench/PackedRequantizeAcc16Benchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static void performance_test() {
160160
ttot *= 1e9; // convert to ns
161161

162162
if (flush) {
163-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
163+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
164164
}
165165
cout << setw(16) << runType << ", " << fixed << setw(5) << setprecision(1)
166166
<< nops / ttot << '\n';
@@ -414,7 +414,7 @@ static void performance_test() {
414414
}
415415

416416
if (flush) {
417-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
417+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
418418
}
419419
// printMatrix(matrix_op_t::NoTranspose, Bint8.data(), k, n, n, "B
420420
// unpacked");

bench/PackedRequantizeAcc32Benchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void performance_test() {
167167
ttot *= 1e9; // convert to ns
168168

169169
if (flush) {
170-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
170+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
171171
}
172172

173173
cout << setw(6) << m << ", " << setw(6) << n << ", " << setw(6) << k
@@ -300,7 +300,7 @@ static void performance_test() {
300300
}
301301
}
302302
if (flush) {
303-
((volatile char*)(llc.data()))[0] = llc.data()[0] + 1;
303+
((volatile char*)(llc.data()))[0] = llc[0] + 1;
304304
}
305305
// printMatrix(matrix_op_t::NoTranspose, Bint8.data(), k, n, n, "B
306306
// unpacked");

0 commit comments

Comments
 (0)