-
Notifications
You must be signed in to change notification settings - Fork 231
Add .clang-tidy and fix clang-tidy warnings #857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 58 commits
debe302
86e7859
b9f7b42
d7f1a32
8d3a311
97f5571
39f067e
d9b9ab4
f65249b
118593a
401f2ae
573dd36
be95503
7c2653d
d108e80
d4ee0d4
7aafe38
b7b4300
6143ffa
2419b1c
507176a
3820f1b
2580056
633261a
0390808
973bc99
c2402b6
27fbde4
c476742
a1162b1
fb46f80
77fdc94
c54c513
a4e0d9a
a6a0cab
a12bb90
2b1b49d
b149037
2d410e3
1811fe3
d236810
5c21ec4
afc9e76
86fcffd
b808afd
9543e3f
e8e1eae
b26b9aa
7fb12d2
2c28eee
c0c71a9
111a2f4
70b85c2
7ac76e6
9dcbae6
1cfa493
41790ff
514a4f1
d3d2b08
a859235
0ac66e1
fe1d70d
fbf1c9c
6f760b1
8d743a8
397962b
87959ec
cca3880
496474f
6f4d739
8459c72
5b91598
3bfaa55
b7ea38c
098e08a
c1f9872
20528cb
ce3b3ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| Checks: 'clang-diagnostic-*, | ||
| clang-analyzer-*, | ||
| cppcoreguidelines-*, | ||
| modernize-*, | ||
| bugprone-*, | ||
| performance-*, | ||
| readability-*, | ||
| llvm-*, | ||
| -modernize-use-trailing-return-type, | ||
| -cppcoreguidelines-macro-usage' | ||
| WarningsAsErrors: '' | ||
| HeaderFilterRegex: '' | ||
| AnalyzeTemporaryDtors: false | ||
| FormatStyle: none | ||
| CheckOptions: | ||
| - key: cert-dcl16-c.NewSuffixes | ||
| value: 'L;LL;LU;LLU' | ||
| - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||
| value: '0' | ||
| - key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons | ||
| value: '0' | ||
| - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors | ||
| value: '1' | ||
| - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
| value: '1' | ||
| - key: google-readability-braces-around-statements.ShortStatementLines | ||
| value: '1' | ||
| - key: google-readability-function-size.StatementThreshold | ||
| value: '800' | ||
| - key: google-readability-namespace-comments.ShortNamespaceLines | ||
| value: '10' | ||
| - key: google-readability-namespace-comments.SpacesBeforeComments | ||
| value: '2' | ||
| - key: llvm-else-after-return.WarnOnConditionVariables | ||
| value: '0' | ||
| - key: llvm-else-after-return.WarnOnUnfixable | ||
| value: '0' | ||
| - key: llvm-qualified-auto.AddConstToQualified | ||
| value: '0' | ||
| - key: modernize-loop-convert.MaxCopySize | ||
| value: '16' | ||
| - key: modernize-loop-convert.MinConfidence | ||
| value: reasonable | ||
| - key: modernize-loop-convert.NamingStyle | ||
| value: CamelCase | ||
| - key: modernize-pass-by-value.IncludeStyle | ||
| value: llvm | ||
| - key: modernize-replace-auto-ptr.IncludeStyle | ||
| value: llvm | ||
| - key: modernize-use-nullptr.NullMacros | ||
| value: 'NULL' | ||
| - key: readability-identifier-length.IgnoredParameterNames | ||
| value: 'mr|os' | ||
| - key: readability-identifier-length.IgnoredVariableNames | ||
| value: 'mr|_' | ||
| - key: readability-function-cognitive-complexity.IgnoreMacros | ||
| value: '1' | ||
| - key: bugprone-easily-swappable-parameters.IgnoredParameterNames | ||
| value: 'alignment' | ||
| ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,6 @@ | |
|
|
||
| #include <benchmarks/utilities/cxxopts.hpp> | ||
|
|
||
| #include <benchmark/benchmark.h> | ||
|
|
||
| #include <rmm/cuda_stream.hpp> | ||
| #include <rmm/cuda_stream_pool.hpp> | ||
| #include <rmm/device_uvector.hpp> | ||
|
|
@@ -31,15 +29,18 @@ | |
|
|
||
| #include <cuda_runtime_api.h> | ||
|
|
||
| #include <benchmark/benchmark.h> | ||
|
|
||
| #include <cstddef> | ||
|
|
||
| __global__ void compute_bound_kernel(int64_t* out) | ||
| { | ||
| clock_t clock_begin = clock64(); | ||
| clock_t clock_current = clock_begin; | ||
| auto const million{1'000'000}; | ||
|
|
||
| if (threadIdx.x == 0) { | ||
| while (clock_current - clock_begin < 1000000) { | ||
| if (threadIdx.x == 0) { // NOLINT(readability-static-accessed-through-instance) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wat. Is clang-tidy going to complain about every usage of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unsure about this. We can probably disable the rule for .cu files. In RMM there are so few .cu files that NOLINT isn't really a problem. |
||
| while (clock_current - clock_begin < million) { | ||
| clock_current = clock64(); | ||
| } | ||
| } | ||
|
|
@@ -69,26 +70,26 @@ static void run_test(std::size_t num_kernels, | |
| } | ||
| } | ||
|
|
||
| static void BM_MultiStreamAllocations(benchmark::State& state, MRFactoryFunc factory) | ||
| static void BM_MultiStreamAllocations(benchmark::State& state, MRFactoryFunc const& factory) | ||
| { | ||
| auto mr = factory(); | ||
|
|
||
| rmm::mr::set_current_device_resource(mr.get()); | ||
|
|
||
| auto num_streams = state.range(0); | ||
| auto num_kernels = state.range(1); | ||
| auto do_prewarm = state.range(2); | ||
| bool do_prewarm = state.range(2) != 0; | ||
|
|
||
| auto stream_pool = rmm::cuda_stream_pool(num_streams); | ||
|
|
||
| if (do_prewarm) { run_prewarm(stream_pool, mr.get()); } | ||
|
|
||
| for (auto _ : state) { | ||
| for (auto _ : state) { // NOLINT(clang-analyzer-deadcode.DeadStores) | ||
| run_test(num_kernels, stream_pool, mr.get()); | ||
| cudaDeviceSynchronize(); | ||
| } | ||
|
|
||
| state.SetItemsProcessed(state.iterations() * num_kernels); | ||
| state.SetItemsProcessed(static_cast<int64_t>(state.iterations() * num_kernels)); | ||
|
|
||
| rmm::mr::set_current_device_resource(nullptr); | ||
| } | ||
|
|
@@ -124,7 +125,7 @@ static void benchmark_range(benchmark::internal::Benchmark* b) | |
| ->Unit(benchmark::kMicrosecond); | ||
| } | ||
|
|
||
| MRFactoryFunc get_mr_factory(std::string resource_name) | ||
| MRFactoryFunc get_mr_factory(std::string const& resource_name) | ||
| { | ||
| if (resource_name == "cuda") { return &make_cuda; } | ||
| #ifdef RMM_CUDA_MALLOC_ASYNC_SUPPORT | ||
|
|
@@ -139,7 +140,7 @@ MRFactoryFunc get_mr_factory(std::string resource_name) | |
| RMM_FAIL(); | ||
| } | ||
|
|
||
| void declare_benchmark(std::string name) | ||
| void declare_benchmark(std::string const& name) | ||
| { | ||
| if (name == "cuda") { | ||
| BENCHMARK_CAPTURE(BM_MultiStreamAllocations, cuda, &make_cuda) // | ||
|
|
@@ -176,7 +177,7 @@ void declare_benchmark(std::string name) | |
| std::cout << "Error: invalid memory_resource name: " << name << std::endl; | ||
| } | ||
|
|
||
| void run_profile(std::string resource_name, int kernel_count, int stream_count, bool prewarm) | ||
| void run_profile(std::string const& resource_name, int kernel_count, int stream_count, bool prewarm) | ||
| { | ||
| auto mr_factory = get_mr_factory(resource_name); | ||
| auto mr = mr_factory(); | ||
|
|
@@ -228,7 +229,11 @@ int main(int argc, char** argv) | |
| auto num_kernels = args["kernels"].as<int>(); | ||
| auto num_streams = args["streams"].as<int>(); | ||
| auto prewarm = args["warm"].as<bool>(); | ||
| run_profile(resource_name, num_kernels, num_streams, prewarm); | ||
| try { | ||
| run_profile(resource_name, num_kernels, num_streams, prewarm); | ||
| } catch (std::exception const& e) { | ||
| std::cout << "Exception caught: " << e.what() << std::endl; | ||
| } | ||
| } else { | ||
| auto resource_names = std::vector<std::string>(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.