Skip to content

Commit

Permalink
Updating Clang Version to 11.0.0 (#6695)
Browse files Browse the repository at this point in the history
This resolves: #5187

PR description copied from: rapidsai/cuml#3121

Depends on: rapidsai/integration#304

This PR will upgrade the clang version required to 11.0.0 in order to enable us with running clang-tidy on .cu files, while running on cuda v11. See rapidsai/raft#88 for more details.

CI will not pass as the underlying conda-env still uses 8.0.1. Once we have the rapids-build-env meta package updated, this should pass.

-----

### Fixes from Clang 8.0.1 to Clang 11.0.0 (that are observed in delta)

* Missing spaces
* Incorrect alignment when ternary expression splits across multiple lines
* Comment alignment on macros
* Fixed where function signatures have line breaks
* Aligning macros
* Always left align pointer/reference
* Don't allow single line for loops

-----
To do list:

* [x] Update python file
* [x] Update conda environment files
* [x] Run formatter to apply all changes from upgrading
* [x] Add changes from #5187
* [x] Review list of new changes from 8.0.1 to 11; choose which to incorporate
* [x] Get working with RAPID compose

Authors:
  - Conor Hoekstra (https://github.com/codereport)

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Nghia Truong (https://github.com/ttnghia)
  - Mark Harris (https://github.com/harrism)
  - Dillon Cullinan (https://github.com/dillon-cullinan)

URL: #6695
  • Loading branch information
codereport authored Jul 7, 2021
1 parent d77ba82 commit 7721819
Show file tree
Hide file tree
Showing 166 changed files with 3,072 additions and 2,864 deletions.
4 changes: 2 additions & 2 deletions conda/environments/cudf_dev_cuda11.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ channels:
- rapidsai-nightly
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cupy>7.1.0,<10.0.0a0
- rmm=21.08.*
- cmake>=3.20.1
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/cudf_dev_cuda11.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ channels:
- rapidsai-nightly
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cupy>7.1.0,<10.0.0a0
- rmm=21.08.*
- cmake>=3.20.1
Expand Down
19 changes: 14 additions & 5 deletions cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
# This is deprecated
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
Expand All @@ -40,14 +46,14 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
Expand All @@ -57,7 +63,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand Down Expand Up @@ -139,14 +145,17 @@ SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/ast/transform_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ static void CustomRanges(benchmark::internal::Benchmark* b)
auto row_counts = std::vector<cudf::size_type>{100'000, 1'000'000, 10'000'000, 100'000'000};
auto operation_counts = std::vector<cudf::size_type>{1, 5, 10};
for (auto const& row_count : row_counts) {
for (auto const& operation_count : operation_counts) { b->Args({row_count, operation_count}); }
for (auto const& operation_count : operation_counts) {
b->Args({row_count, operation_count});
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/binaryop/binaryop_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ static void CustomRanges(benchmark::internal::Benchmark* b)
auto row_counts = std::vector<cudf::size_type>{100'000, 1'000'000, 10'000'000, 100'000'000};
auto operation_counts = std::vector<cudf::size_type>{1, 2, 5, 10};
for (auto const& row_count : row_counts) {
for (auto const& operation_count : operation_counts) { b->Args({row_count, operation_count}); }
for (auto const& operation_count : operation_counts) {
b->Args({row_count, operation_count});
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/common/generate_benchmark_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ T get_distribution_mean(distribution_params<T> const& dist)
auto const range_size = dist.lower_bound < dist.upper_bound
? dist.upper_bound - dist.lower_bound
: dist.lower_bound - dist.upper_bound;
auto const p = geometric_dist_p(range_size);
auto const p = geometric_dist_p(range_size);
if (dist.lower_bound < dist.upper_bound)
return dist.lower_bound + (1. / p);
else
Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/hashing/partition_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ static void CustomRanges(benchmark::internal::Benchmark* b)
{
for (int columns = 1; columns <= 256; columns *= 16) {
for (int partitions = 64; partitions <= 1024; partitions *= 2) {
for (int rows = 1 << 17; rows <= 1 << 21; rows *= 2) { b->Args({rows, columns, partitions}); }
for (int rows = 1 << 17; rows <= 1 << 21; rows *= 2) {
b->Args({rows, columns, partitions});
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion cpp/benchmarks/io/cuio_benchmark_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ std::vector<int> select_column_indexes(int num_cols, column_selection col_sel)
(col_sel == column_selection::SECOND_HALF) ? num_cols / 2 : 0);
break;
case column_selection::ALTERNATE:
for (size_t i = 0; i < col_idxs.size(); ++i) col_idxs[i] = 2 * i;
for (size_t i = 0; i < col_idxs.size(); ++i)
col_idxs[i] = 2 * i;
break;
}
return col_idxs;
Expand Down
20 changes: 10 additions & 10 deletions cpp/benchmarks/iterator/iterator_benchmark.cu
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ inline auto reduce_by_cub(OutputIterator result, InputIterator d_in, int num_ite

// -----------------------------------------------------------------------------
template <typename T>
void raw_stream_bench_cub(cudf::column_view &col, rmm::device_uvector<T> &result)
void raw_stream_bench_cub(cudf::column_view& col, rmm::device_uvector<T>& result)
{
// std::cout << "raw stream cub: " << "\t";

Expand All @@ -73,7 +73,7 @@ void raw_stream_bench_cub(cudf::column_view &col, rmm::device_uvector<T> &result
};

template <typename T, bool has_null>
void iterator_bench_cub(cudf::column_view &col, rmm::device_uvector<T> &result)
void iterator_bench_cub(cudf::column_view& col, rmm::device_uvector<T>& result)
{
// std::cout << "iterator cub " << ( (has_null) ? "<true>: " : "<false>: " ) << "\t";

Expand All @@ -91,7 +91,7 @@ void iterator_bench_cub(cudf::column_view &col, rmm::device_uvector<T> &result)

// -----------------------------------------------------------------------------
template <typename T>
void raw_stream_bench_thrust(cudf::column_view &col, rmm::device_uvector<T> &result)
void raw_stream_bench_thrust(cudf::column_view& col, rmm::device_uvector<T>& result)
{
// std::cout << "raw stream thust: " << "\t\t";

Expand All @@ -102,7 +102,7 @@ void raw_stream_bench_thrust(cudf::column_view &col, rmm::device_uvector<T> &res
}

template <typename T, bool has_null>
void iterator_bench_thrust(cudf::column_view &col, rmm::device_uvector<T> &result)
void iterator_bench_thrust(cudf::column_view& col, rmm::device_uvector<T>& result)
{
// std::cout << "iterator thust " << ( (has_null) ? "<true>: " : "<false>: " ) << "\t";

Expand All @@ -124,7 +124,7 @@ class Iterator : public cudf::benchmark {
};

template <class TypeParam, bool cub_or_thrust, bool raw_or_iterator>
void BM_iterator(benchmark::State &state)
void BM_iterator(benchmark::State& state)
{
const cudf::size_type column_size{(cudf::size_type)state.range(0)};
using T = TypeParam;
Expand Down Expand Up @@ -165,8 +165,8 @@ __device__ thrust::pair<T, bool> operator+(thrust::pair<T, bool> lhs, thrust::pa
}
// -----------------------------------------------------------------------------
template <typename T, bool has_null>
void pair_iterator_bench_cub(cudf::column_view &col,
rmm::device_uvector<thrust::pair<T, bool>> &result)
void pair_iterator_bench_cub(cudf::column_view& col,
rmm::device_uvector<thrust::pair<T, bool>>& result)
{
thrust::pair<T, bool> init{0, false};
auto d_col = cudf::column_device_view::create(col);
Expand All @@ -176,8 +176,8 @@ void pair_iterator_bench_cub(cudf::column_view &col,
}

template <typename T, bool has_null>
void pair_iterator_bench_thrust(cudf::column_view &col,
rmm::device_uvector<thrust::pair<T, bool>> &result)
void pair_iterator_bench_thrust(cudf::column_view& col,
rmm::device_uvector<thrust::pair<T, bool>>& result)
{
thrust::pair<T, bool> init{0, false};
auto d_col = cudf::column_device_view::create(col);
Expand All @@ -187,7 +187,7 @@ void pair_iterator_bench_thrust(cudf::column_view &col,
}

template <class TypeParam, bool cub_or_thrust>
void BM_pair_iterator(benchmark::State &state)
void BM_pair_iterator(benchmark::State& state)
{
const cudf::size_type column_size{(cudf::size_type)state.range(0)};
using T = TypeParam;
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/reduction/anyall_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void BM_reduction_anyall(benchmark::State& state, std::unique_ptr<cudf::aggregat
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/reduction/dictionary_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void BM_reduction_dictionary(benchmark::State& state, std::unique_ptr<cudf::aggr
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/reduction/minmax_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void BM_reduction(benchmark::State& state)
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/reduction/reduce_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void BM_reduction(benchmark::State& state, std::unique_ptr<cudf::aggregation> co
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
3 changes: 2 additions & 1 deletion cpp/benchmarks/search/search_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ BENCHMARK_DEFINE_F(Search, Table)(::benchmark::State& state) { BM_table(state);
static void CustomArguments(benchmark::internal::Benchmark* b)
{
for (int num_cols = 1; num_cols <= 10; num_cols *= 2)
for (int col_size = 1000; col_size <= 100000000; col_size *= 10) b->Args({num_cols, col_size});
for (int col_size = 1000; col_size <= 100000000; col_size *= 10)
b->Args({num_cols, col_size});
}

BENCHMARK_REGISTER_F(Search, Table)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ constexpr cudf::size_type fifty_percent = 50;
void percent_range(benchmark::internal::Benchmark* b)
{
b->Unit(benchmark::kMillisecond);
for (int percent = 0; percent <= 100; percent += 10) b->Args({hundredM, percent});
for (int percent = 0; percent <= 100; percent += 10)
b->Args({hundredM, percent});
}

void size_range(benchmark::internal::Benchmark* b)
{
b->Unit(benchmark::kMillisecond);
for (int size = tenK; size <= hundredM; size *= 10) b->Args({size, fifty_percent});
for (int size = tenK; size <= hundredM; size *= 10)
b->Args({size, fifty_percent});
}

template <typename T>
Expand All @@ -64,9 +66,9 @@ void calculate_bandwidth(benchmark::State& state, cudf::size_type num_columns)
cudf::size_type const column_size_out = fraction * column_size;
int64_t const mask_size =
sizeof(bool) * column_size + cudf::bitmask_allocation_size_bytes(column_size);
int64_t const validity_bytes_in = (fraction >= 1.0f / 32)
? cudf::bitmask_allocation_size_bytes(column_size)
: 4 * column_size_out;
int64_t const validity_bytes_in = (fraction >= 1.0f / 32)
? cudf::bitmask_allocation_size_bytes(column_size)
: 4 * column_size_out;
int64_t const validity_bytes_out = cudf::bitmask_allocation_size_bytes(column_size_out);
int64_t const column_bytes_out = sizeof(T) * column_size_out;
int64_t const column_bytes_in = column_bytes_out; // we only read unmasked inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void BM_compaction(benchmark::State& state, cudf::duplicate_keep_option keep)
}

#define concat(a, b, c) a##b##c
#define get_keep(op) cudf::duplicate_keep_option::KEEP_##op
#define get_keep(op) cudf::duplicate_keep_option::KEEP_##op

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, keep) \
Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/string/extract_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ static void BM_extract(benchmark::State& state, int groups)
});

std::string pattern;
while (static_cast<int>(pattern.size()) < groups) { pattern += "(\\d+) "; }
while (static_cast<int>(pattern.size()) < groups) {
pattern += "(\\d+) ";
}

std::uniform_int_distribution<int> distribution(0, samples.size() - 1);
auto elements = cudf::detail::make_counting_transform_iterator(
Expand Down
3 changes: 2 additions & 1 deletion cpp/benchmarks/text/replace_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ static void BM_replace(benchmark::State& state)
std::default_random_engine generator;
std::uniform_int_distribution<int> tokens_dist(0, words.size() - 1);
std::string row; // build a row of random tokens
while (static_cast<int>(row.size()) < n_length) row += words[tokens_dist(generator)];
while (static_cast<int>(row.size()) < n_length)
row += words[tokens_dist(generator)];

std::uniform_int_distribution<int> position_dist(0, 16);

Expand Down
6 changes: 4 additions & 2 deletions cpp/benchmarks/text/subword_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ static std::string create_hash_vocab_file()
std::vector<std::pair<int, int>> coefficients(23, {65559, 0});
std::ofstream outfile(hash_file, std::ofstream::out);
outfile << "1\n0\n" << coefficients.size() << "\n";
for (auto c : coefficients) outfile << c.first << " " << c.second << "\n";
for (auto c : coefficients)
outfile << c.first << " " << c.second << "\n";
std::vector<uint64_t> hash_table(23, 0);
outfile << hash_table.size() << "\n";
hash_table[0] = 3015668L;
hash_table[1] = 6205475701751155871L;
hash_table[5] = 6358029;
hash_table[16] = 451412625363L;
hash_table[20] = 6206321707968235495L;
for (auto h : hash_table) outfile << h << "\n";
for (auto h : hash_table)
outfile << h << "\n";
outfile << "100\n101\n102\n\n";
return hash_file;
}
Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/type_dispatcher/type_dispatcher_benchmark.cu
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ __global__ void no_dispatching_kernel(T** A, cudf::size_type n_rows, cudf::size_
using F = Functor<T, functor_type>;
cudf::size_type index = blockIdx.x * blockDim.x + threadIdx.x;
while (index < n_rows) {
for (int c = 0; c < n_cols; c++) { A[c][index] = F::f(A[c][index]); }
for (int c = 0; c < n_cols; c++) {
A[c][index] = F::f(A[c][index]);
}
index += blockDim.x * gridDim.x;
}
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cudf/detail/copy_if_else.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ __launch_bounds__(block_size) __global__
RightIter rhs,
Filter filter,
mutable_column_device_view out,
size_type *__restrict__ const valid_count)
size_type* __restrict__ const valid_count)
{
const size_type tid = threadIdx.x + blockIdx.x * block_size;
const int warp_id = tid / warp_size;
Expand Down Expand Up @@ -166,7 +166,7 @@ std::unique_ptr<column> copy_if_else(
FilterFn filter,
cudf::data_type output_type,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource())
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
{
using Element =
typename thrust::tuple_element<0, typename thrust::iterator_traits<LeftIter>::value_type>::type;
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/cudf/detail/merge.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ struct tagged_element_relational_comparator {
{
}

__device__ weak_ordering compare(index_type lhs_tagged_index, index_type rhs_tagged_index) const
noexcept
__device__ weak_ordering compare(index_type lhs_tagged_index,
index_type rhs_tagged_index) const noexcept
{
side const l_side = thrust::get<0>(lhs_tagged_index);
side const r_side = thrust::get<0>(rhs_tagged_index);
Expand Down Expand Up @@ -117,8 +117,8 @@ struct row_lexicographic_tagged_comparator {
CUDF_EXPECTS(_lhs.num_columns() == _rhs.num_columns(), "Mismatched number of columns.");
}

__device__ bool operator()(index_type lhs_tagged_index, index_type rhs_tagged_index) const
noexcept
__device__ bool operator()(index_type lhs_tagged_index,
index_type rhs_tagged_index) const noexcept
{
for (size_type i = 0; i < _lhs.num_columns(); ++i) {
bool ascending = (_column_order == nullptr) or (_column_order[i] == order::ASCENDING);
Expand Down
Loading

0 comments on commit 7721819

Please sign in to comment.