Skip to content

Commit

Permalink
Fix compiler warnings when compiling with clang 17. (#392)
Browse files Browse the repository at this point in the history
```In file included from cuda.cc:1:
cuco/static_map.cuh:842:74: error: use
      'template' keyword to treat 'rebind_alloc' as a dependent template name
  842 |   using slot_allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<
      |                                                                          ^
```

This fixes the instances of this error I've hit so far.

References: #128

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
AustinSchuh and pre-commit-ci[bot] authored Nov 14, 2023
1 parent 9783dbb commit b7514d2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion include/cuco/aow_storage.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class aow_storage : public detail::aow_storage_base<T, WindowSize, Extent> {
using base_type::num_windows;

/// Type of the allocator to (de)allocate windows
using allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<window_type>;
using allocator_type =
typename std::allocator_traits<Allocator>::template rebind_alloc<window_type>;
using window_deleter_type =
detail::custom_deleter<size_type, allocator_type>; ///< Type of window deleter
using ref_type = aow_storage_ref<value_type, window_size, extent_type>; ///< Storage ref type
Expand Down
7 changes: 4 additions & 3 deletions include/cuco/detail/open_addressing/open_addressing_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,10 @@ class open_addressing_impl {
cuda_stream_ref stream) const
{
std::size_t temp_storage_bytes = 0;
using temp_allocator_type = typename std::allocator_traits<allocator_type>::rebind_alloc<char>;
auto temp_allocator = temp_allocator_type{this->allocator()};
auto d_num_out = reinterpret_cast<size_type*>(
using temp_allocator_type =
typename std::allocator_traits<allocator_type>::template rebind_alloc<char>;
auto temp_allocator = temp_allocator_type{this->allocator()};
auto d_num_out = reinterpret_cast<size_type*>(
std::allocator_traits<temp_allocator_type>::allocate(temp_allocator, sizeof(size_type)));
CUCO_CUDA_TRY(cub::DeviceSelect::If(nullptr,
temp_storage_bytes,
Expand Down
7 changes: 4 additions & 3 deletions include/cuco/detail/static_map.inl
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@ std::pair<KeyOut, ValueOut> static_map<Key, Value, Scope, Allocator>::retrieve_a
auto zipped_out_begin = thrust::make_zip_iterator(thrust::make_tuple(keys_out, values_out));

std::size_t temp_storage_bytes = 0;
using temp_allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<char>;
auto temp_allocator = temp_allocator_type{slot_allocator_};
auto d_num_out = reinterpret_cast<std::size_t*>(
using temp_allocator_type =
typename std::allocator_traits<Allocator>::template rebind_alloc<char>;
auto temp_allocator = temp_allocator_type{slot_allocator_};
auto d_num_out = reinterpret_cast<std::size_t*>(
std::allocator_traits<temp_allocator_type>::allocate(temp_allocator, sizeof(std::size_t)));
cub::DeviceSelect::If(nullptr,
temp_storage_bytes,
Expand Down
2 changes: 1 addition & 1 deletion include/cuco/detail/storage/counter_storage.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class counter_storage : public storage_base<cuco::experimental::extent<SizeType,

using size_type = SizeType; ///< Size type
using value_type = cuda::atomic<size_type, Scope>; ///< Type of the counter
using allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<
using allocator_type = typename std::allocator_traits<Allocator>::template rebind_alloc<
value_type>; ///< Type of the allocator to (de)allocate counter
using counter_deleter_type =
custom_deleter<size_type, allocator_type>; ///< Type of counter deleter
Expand Down
4 changes: 2 additions & 2 deletions include/cuco/static_map.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,9 @@ class static_map {
using slot_type = pair_atomic_type; ///< Type of hash map slots
using atomic_ctr_type = cuda::atomic<std::size_t, Scope>; ///< Atomic counter type
using allocator_type = Allocator; ///< Allocator type
using slot_allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<
using slot_allocator_type = typename std::allocator_traits<Allocator>::template rebind_alloc<
pair_atomic_type>; ///< Type of the allocator to (de)allocate slots
using counter_allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<
using counter_allocator_type = typename std::allocator_traits<Allocator>::template rebind_alloc<
atomic_ctr_type>; ///< Type of the allocator to (de)allocate atomic counters

#if !defined(CUCO_HAS_INDEPENDENT_THREADS)
Expand Down

0 comments on commit b7514d2

Please sign in to comment.