Skip to content
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

Updating Clang Version to 11.0.0 #814

Merged
merged 7 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ 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
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
# This is deprecated
AlwaysBreakAfterDefinitionReturnType: 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
codereport marked this conversation as resolved.
Show resolved Hide resolved
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: 2 additions & 2 deletions conda/environments/rmm_dev_cuda10.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ channels:
- rapidsai
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cmake>=3.20.1
- cmake-format=0.6.11
- flake8=3.8.3
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/rmm_dev_cuda10.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ channels:
- rapidsai
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cmake>=3.20.1
- cmake-format=0.6.11
- flake8=3.8.3
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/rmm_dev_cuda11.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ channels:
- rapidsai
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cmake>=3.20.1
- cmake-format=0.6.11
- flake8=3.8.3
Expand Down
16 changes: 8 additions & 8 deletions include/rmm/detail/aligned.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,27 @@ constexpr bool is_aligned(std::size_t v, std::size_t align_bytes) noexcept
* `alignment`.
*/
template <typename Alloc>
void *aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc)
void* aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc)
{
assert(is_pow2(alignment));

// allocate memory for bytes, plus potential alignment correction,
// plus store of the correction offset
std::size_t padded_allocation_size{bytes + alignment + sizeof(std::ptrdiff_t)};

char *const original = static_cast<char *>(alloc(padded_allocation_size));
char* const original = static_cast<char*>(alloc(padded_allocation_size));

// account for storage of offset immediately prior to the aligned pointer
void *aligned{original + sizeof(std::ptrdiff_t)};
void* aligned{original + sizeof(std::ptrdiff_t)};

// std::align modifies `aligned` to point to the first aligned location
std::align(alignment, bytes, aligned, padded_allocation_size);

// Compute the offset between the original and aligned pointers
std::ptrdiff_t offset = static_cast<char *>(aligned) - original;
std::ptrdiff_t offset = static_cast<char*>(aligned) - original;

// Store the offset immediately before the aligned pointer
*(static_cast<std::ptrdiff_t *>(aligned) - 1) = offset;
*(static_cast<std::ptrdiff_t*>(aligned) - 1) = offset;

return aligned;
}
Expand All @@ -160,14 +160,14 @@ void *aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc)
* @tparam Dealloc A unary callable type that deallocates memory.
*/
template <typename Dealloc>
void aligned_deallocate(void *p, std::size_t bytes, std::size_t alignment, Dealloc dealloc)
void aligned_deallocate(void* p, std::size_t bytes, std::size_t alignment, Dealloc dealloc)
{
(void)alignment;

// Get offset from the location immediately prior to the aligned pointer
std::ptrdiff_t const offset = *(reinterpret_cast<std::ptrdiff_t *>(p) - 1);
std::ptrdiff_t const offset = *(reinterpret_cast<std::ptrdiff_t*>(p) - 1);

void *const original = static_cast<char *>(p) - offset;
void* const original = static_cast<char*>(p) - offset;

dealloc(original);
}
Expand Down
2 changes: 1 addition & 1 deletion include/rmm/detail/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class out_of_range : public std::out_of_range {
} // namespace rmm

#define STRINGIFY_DETAIL(x) #x
#define RMM_STRINGIFY(x) STRINGIFY_DETAIL(x)
#define RMM_STRINGIFY(x) STRINGIFY_DETAIL(x)

/**
* @brief Macro for checking (pre-)conditions that throws an exception when
Expand Down
22 changes: 11 additions & 11 deletions include/rmm/device_scalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ class device_scalar {
~device_scalar() = default;

RMM_EXEC_CHECK_DISABLE
device_scalar(device_scalar &&) = default;
device_scalar(device_scalar&&) = default;

device_scalar &operator=(device_scalar &&) = default;
device_scalar& operator=(device_scalar&&) = default;

/**
* @brief Copy ctor is deleted as it doesn't allow a stream argument
*/
device_scalar(device_scalar const &) = delete;
device_scalar(device_scalar const&) = delete;

/**
* @brief Copy assignment is deleted as it doesn't allow a stream argument
*/
device_scalar &operator=(device_scalar const &) = delete;
device_scalar& operator=(device_scalar const&) = delete;

/**
* @brief Default constructor is deleted as it doesn't allow a stream argument
Expand All @@ -82,7 +82,7 @@ class device_scalar {
*/
explicit device_scalar(
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())
: _storage{1, stream, mr}
{
}
Expand All @@ -104,9 +104,9 @@ class device_scalar {
* @param mr Optional, resource with which to allocate.
*/
explicit device_scalar(
value_type const &initial_value,
value_type const& initial_value,
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())
: _storage{1, stream, mr}
{
set_value_async(initial_value, stream);
Expand All @@ -124,9 +124,9 @@ class device_scalar {
* @param stream The stream to use for the allocation and copy
* @param mr The resource to use for allocating the new `device_scalar`
*/
device_scalar(device_scalar const &other,
device_scalar(device_scalar const& other,
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())
: _storage{other._storage, stream, mr}
{
}
Expand Down Expand Up @@ -186,14 +186,14 @@ class device_scalar {
* @param v The host value which will be copied to device
* @param stream CUDA stream on which to perform the copy
*/
void set_value_async(value_type const &v, cuda_stream_view s)
void set_value_async(value_type const& v, cuda_stream_view s)
{
_storage.set_element_async(0, v, s);
}

// Disallow passing literals to set_value to avoid race conditions where the memory holding the
// literal can be freed before the async memcpy / memset executes.
void set_value_async(value_type &&, cuda_stream_view) = delete;
void set_value_async(value_type&&, cuda_stream_view) = delete;

/**
* @brief Sets the value of the `device_scalar` to zero on the specified stream.
Expand Down
10 changes: 5 additions & 5 deletions include/rmm/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ inline spdlog::logger& logger()
// The default is INFO, but it should be used sparingly, so that by default a log file is only
// output if there is important information, warnings, errors, and critical failures
// Log messages that require computation should only be used at level TRACE and DEBUG
#define RMM_LOG_TRACE(...) SPDLOG_LOGGER_TRACE(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_INFO(...) SPDLOG_LOGGER_INFO(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_WARN(...) SPDLOG_LOGGER_WARN(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_ERROR(...) SPDLOG_LOGGER_ERROR(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_TRACE(...) SPDLOG_LOGGER_TRACE(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_INFO(...) SPDLOG_LOGGER_INFO(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_WARN(...) SPDLOG_LOGGER_WARN(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_ERROR(...) SPDLOG_LOGGER_ERROR(&rmm::logger(), __VA_ARGS__)
#define RMM_LOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(&rmm::logger(), __VA_ARGS__)

} // namespace rmm
18 changes: 9 additions & 9 deletions include/rmm/mr/host/new_delete_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ namespace mr {
*---------------------------------------------------------------------------**/
class new_delete_resource final : public host_memory_resource {
public:
new_delete_resource() = default;
~new_delete_resource() = default;
new_delete_resource(new_delete_resource const &) = default;
new_delete_resource(new_delete_resource &&) = default;
new_delete_resource &operator=(new_delete_resource const &) = default;
new_delete_resource &operator=(new_delete_resource &&) = default;
new_delete_resource() = default;
~new_delete_resource() = default;
new_delete_resource(new_delete_resource const&) = default;
new_delete_resource(new_delete_resource&&) = default;
new_delete_resource& operator=(new_delete_resource const&) = default;
new_delete_resource& operator=(new_delete_resource&&) = default;
codereport marked this conversation as resolved.
Show resolved Hide resolved

private:
/**---------------------------------------------------------------------------*
Expand All @@ -52,7 +52,7 @@ class new_delete_resource final : public host_memory_resource {
* @param alignment Alignment of the allocation
* @return void* Pointer to the newly allocated memory
*---------------------------------------------------------------------------**/
void *do_allocate(std::size_t bytes,
void* do_allocate(std::size_t bytes,
std::size_t alignment = detail::RMM_DEFAULT_HOST_ALIGNMENT) override
{
// If the requested alignment isn't supported, use default
Expand Down Expand Up @@ -81,11 +81,11 @@ class new_delete_resource final : public host_memory_resource {
*`p`.
* @param stream Stream on which to perform deallocation
*---------------------------------------------------------------------------**/
void do_deallocate(void *p,
void do_deallocate(void* p,
std::size_t bytes,
std::size_t alignment = detail::RMM_DEFAULT_HOST_ALIGNMENT) override
{
detail::aligned_deallocate(p, bytes, alignment, [](void *p) { ::operator delete(p); });
detail::aligned_deallocate(p, bytes, alignment, [](void* p) { ::operator delete(p); });
}
};
} // namespace mr
Expand Down
20 changes: 10 additions & 10 deletions include/rmm/mr/host/pinned_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace mr {
*---------------------------------------------------------------------------**/
class pinned_memory_resource final : public host_memory_resource {
public:
pinned_memory_resource() = default;
~pinned_memory_resource() = default;
pinned_memory_resource(pinned_memory_resource const &) = default;
pinned_memory_resource(pinned_memory_resource &&) = default;
pinned_memory_resource &operator=(pinned_memory_resource const &) = default;
pinned_memory_resource &operator=(pinned_memory_resource &&) = default;
pinned_memory_resource() = default;
~pinned_memory_resource() = default;
pinned_memory_resource(pinned_memory_resource const&) = default;
pinned_memory_resource(pinned_memory_resource&&) = default;
pinned_memory_resource& operator=(pinned_memory_resource const&) = default;
pinned_memory_resource& operator=(pinned_memory_resource&&) = default;

private:
/**---------------------------------------------------------------------------*
Expand All @@ -53,7 +53,7 @@ class pinned_memory_resource final : public host_memory_resource {
* @param alignment Alignment of the allocation
* @return void* Pointer to the newly allocated memory
*---------------------------------------------------------------------------**/
void *do_allocate(std::size_t bytes, std::size_t alignment = alignof(std::max_align_t)) override
void* do_allocate(std::size_t bytes, std::size_t alignment = alignof(std::max_align_t)) override
{
// don't allocate anything if the user requested zero bytes
if (0 == bytes) { return nullptr; }
Expand All @@ -63,7 +63,7 @@ class pinned_memory_resource final : public host_memory_resource {
(detail::is_supported_alignment(alignment)) ? alignment : detail::RMM_DEFAULT_HOST_ALIGNMENT;

return detail::aligned_allocate(bytes, alignment, [](std::size_t size) {
void *p{nullptr};
void* p{nullptr};
auto status = cudaMallocHost(&p, size);
if (cudaSuccess != status) { throw std::bad_alloc{}; }
return p;
Expand All @@ -88,14 +88,14 @@ class pinned_memory_resource final : public host_memory_resource {
*`p`.
* @param stream Stream on which to perform deallocation
*---------------------------------------------------------------------------**/
void do_deallocate(void *p,
void do_deallocate(void* p,
std::size_t bytes,
std::size_t alignment = alignof(std::max_align_t)) override
{
(void)alignment;
if (nullptr == p) { return; }
detail::aligned_deallocate(
p, bytes, alignment, [](void *p) { RMM_ASSERT_CUDA_SUCCESS(cudaFreeHost(p)); });
p, bytes, alignment, [](void* p) { RMM_ASSERT_CUDA_SUCCESS(cudaFreeHost(p)); });
}
};
} // namespace mr
Expand Down
6 changes: 3 additions & 3 deletions include/rmm/thrust_rmm_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace rmm {

using par_t = decltype(thrust::cuda::par(*(new rmm::mr::thrust_allocator<char>())));
using deleter_t = std::function<void(par_t *)>;
using deleter_t = std::function<void(par_t*)>;
using exec_policy_t = std::unique_ptr<par_t, deleter_t>;

/**
Expand All @@ -40,8 +40,8 @@ using exec_policy_t = std::unique_ptr<par_t, deleter_t>;
[[deprecated("Use new exec_policy in rmm/exec_policy.hpp")]] inline exec_policy_t exec_policy(
cudaStream_t stream = 0)
{
auto *alloc = new rmm::mr::thrust_allocator<char>(cuda_stream_view{stream});
auto deleter = [alloc](par_t *pointer) {
auto* alloc = new rmm::mr::thrust_allocator<char>(cuda_stream_view{stream});
auto deleter = [alloc](par_t* pointer) {
delete alloc;
delete pointer;
};
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-clang-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import sys
import tempfile

EXPECTED_VERSION = "8.0.1"
EXPECTED_VERSION = "11.0.0"
VERSION_REGEX = re.compile(r"clang-format version ([0-9.]+)")
# NOTE: populate this list with more top-level dirs as we add more of them
# to the rmm repo
Expand Down
Loading