Skip to content

Commit 9feed37

Browse files
committed
Yet more fixes to make cuCollections compile with LLVM.
Most of the changes are just helping the compiler to parse the template syntax.
1 parent afe3456 commit 9feed37

File tree

13 files changed

+49
-45
lines changed

13 files changed

+49
-45
lines changed

include/cuco/detail/bloom_filter/bloom_filter.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ template <class Key, class Extent, cuda::thread_scope Scope, class Policy, class
163163

164164
template <class Key, class Extent, cuda::thread_scope Scope, class Policy, class Allocator>
165165
[[nodiscard]] __host__ constexpr
166-
typename bloom_filter<Key, Extent, Scope, Policy, Allocator>::ref_type<>
166+
typename bloom_filter<Key, Extent, Scope, Policy, Allocator>::template ref_type<>
167167
bloom_filter<Key, Extent, Scope, Policy, Allocator>::ref() const noexcept
168168
{
169169
return ref_;

include/cuco/detail/hyperloglog/hyperloglog.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ constexpr std::size_t hyperloglog<T, Scope, Hash, Allocator>::estimate(
119119
}
120120

121121
template <class T, cuda::thread_scope Scope, class Hash, class Allocator>
122-
constexpr typename hyperloglog<T, Scope, Hash, Allocator>::ref_type<>
122+
constexpr typename hyperloglog<T, Scope, Hash, Allocator>::template ref_type<>
123123
hyperloglog<T, Scope, Hash, Allocator>::ref() const noexcept
124124
{
125125
return {this->sketch(), this->hash_function()};

include/cuco/detail/open_addressing/open_addressing_impl.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ class open_addressing_impl {
12991299
*/
13001300
[[nodiscard]] constexpr key_type const& extract_key(value_type const& slot) const noexcept
13011301
{
1302-
if constexpr (this->has_payload) {
1302+
if constexpr (has_payload) {
13031303
return slot.first;
13041304
} else {
13051305
return slot;

include/cuco/detail/open_addressing/open_addressing_ref_impl.cuh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,15 @@ class open_addressing_ref_impl {
379379
auto const val = this->heterogeneous_value(value);
380380
auto const key = this->extract_key(val);
381381

382-
auto probing_iter = probing_scheme_.make_iterator<bucket_size>(key, storage_ref_.extent());
382+
auto probing_iter = probing_scheme_.template make_iterator<bucket_size>(key, storage_ref_.extent());
383383
auto const init_idx = *probing_iter;
384384

385385
while (true) {
386386
auto const bucket_slots = storage_ref_[*probing_iter];
387387

388388
for (auto& slot_content : bucket_slots) {
389389
auto const eq_res =
390-
this->predicate_.operator()<is_insert::YES>(key, this->extract_key(slot_content));
390+
this->predicate_.template operator()<is_insert::YES>(key, this->extract_key(slot_content));
391391

392392
if constexpr (not allows_duplicates) {
393393
// If the key is already in the container, return false
@@ -431,7 +431,7 @@ class open_addressing_ref_impl {
431431
auto const val = this->heterogeneous_value(value);
432432
auto const key = this->extract_key(val);
433433
auto probing_iter =
434-
probing_scheme_.make_iterator<bucket_size>(group, key, storage_ref_.extent());
434+
probing_scheme_.template make_iterator<bucket_size>(group, key, storage_ref_.extent());
435435
auto const init_idx = *probing_iter;
436436

437437
while (true) {
@@ -440,7 +440,7 @@ class open_addressing_ref_impl {
440440
auto const [state, intra_bucket_index] = [&]() {
441441
for (auto i = 0; i < bucket_size; ++i) {
442442
switch (
443-
this->predicate_.operator()<is_insert::YES>(key, this->extract_key(bucket_slots[i]))) {
443+
this->predicate_.template operator()<is_insert::YES>(key, this->extract_key(bucket_slots[i]))) {
444444
case detail::equal_result::AVAILABLE:
445445
return bucket_probing_results{detail::equal_result::AVAILABLE, i};
446446
case detail::equal_result::EQUAL: {
@@ -789,7 +789,7 @@ class open_addressing_ref_impl {
789789
[[nodiscard]] __device__ bool contains(ProbeKey const& key) const noexcept
790790
{
791791
static_assert(cg_size == 1, "Non-CG operation is incompatible with the current probing scheme");
792-
auto probing_iter = probing_scheme_.make_iterator<bucket_size>(key, storage_ref_.extent());
792+
auto probing_iter = probing_scheme_.template make_iterator<bucket_size>(key, storage_ref_.extent());
793793
auto const init_idx = *probing_iter;
794794

795795
while (true) {
@@ -798,7 +798,7 @@ class open_addressing_ref_impl {
798798

799799
for (auto i = 0; i < bucket_size; ++i) {
800800
switch (
801-
this->predicate_.operator()<is_insert::NO>(key, this->extract_key(bucket_slots[i]))) {
801+
this->predicate_.template operator()<is_insert::NO>(key, this->extract_key(bucket_slots[i]))) {
802802
case detail::equal_result::UNEQUAL: continue;
803803
case detail::equal_result::EMPTY: return false;
804804
case detail::equal_result::EQUAL: return true;
@@ -1534,7 +1534,7 @@ class open_addressing_ref_impl {
15341534
template <typename Value>
15351535
[[nodiscard]] __host__ __device__ constexpr auto extract_key(Value const& value) const noexcept
15361536
{
1537-
if constexpr (this->has_payload) {
1537+
if constexpr (has_payload) {
15381538
return thrust::raw_reference_cast(value).first;
15391539
} else {
15401540
return thrust::raw_reference_cast(value);
@@ -1570,7 +1570,7 @@ class open_addressing_ref_impl {
15701570
template <typename T>
15711571
[[nodiscard]] __device__ constexpr value_type native_value(T const& value) const noexcept
15721572
{
1573-
if constexpr (this->has_payload) {
1573+
if constexpr (has_payload) {
15741574
return {static_cast<key_type>(this->extract_key(value)), this->extract_payload(value)};
15751575
} else {
15761576
return static_cast<value_type>(value);
@@ -1590,7 +1590,7 @@ class open_addressing_ref_impl {
15901590
template <typename T>
15911591
[[nodiscard]] __device__ constexpr auto heterogeneous_value(T const& value) const noexcept
15921592
{
1593-
if constexpr (this->has_payload and not cuda::std::is_same_v<T, value_type>) {
1593+
if constexpr (has_payload and not cuda::std::is_same_v<T, value_type>) {
15941594
using mapped_type = decltype(this->empty_value_sentinel());
15951595
if constexpr (cuco::detail::is_cuda_std_pair_like<T>::value) {
15961596
return cuco::pair{cuda::std::get<0>(value),
@@ -1612,7 +1612,7 @@ class open_addressing_ref_impl {
16121612
*/
16131613
[[nodiscard]] __device__ constexpr value_type const erased_slot_sentinel() const noexcept
16141614
{
1615-
if constexpr (this->has_payload) {
1615+
if constexpr (has_payload) {
16161616
return cuco::pair{this->erased_key_sentinel(), this->empty_value_sentinel()};
16171617
} else {
16181618
return this->erased_key_sentinel();

include/cuco/detail/static_map.inl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ template <typename Hash, typename KeyEqual>
402402
__device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::insert(
403403
value_type const& insert_pair, Hash hash, KeyEqual key_equal) noexcept
404404
{
405-
auto current_slot{initial_slot(insert_pair.first, hash)};
405+
auto current_slot{this->initial_slot(insert_pair.first, hash)};
406406

407407
while (true) {
408408
key_type const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -439,7 +439,7 @@ __device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::i
439439

440440
// if we couldn't insert the key, but it wasn't a duplicate, then there must
441441
// have been some other key there, so we keep looking for a slot
442-
current_slot = next_slot(current_slot);
442+
current_slot = this->next_slot(current_slot);
443443
}
444444
}
445445

@@ -538,7 +538,7 @@ template <typename CG, typename Hash, typename KeyEqual>
538538
__device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::insert(
539539
CG const& g, value_type const& insert_pair, Hash hash, KeyEqual key_equal) noexcept
540540
{
541-
auto current_slot = initial_slot(g, insert_pair.first, hash);
541+
auto current_slot = this->initial_slot(g, insert_pair.first, hash);
542542

543543
while (true) {
544544
key_type const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -592,7 +592,7 @@ __device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::i
592592
// if there are no empty slots in the current bucket,
593593
// we move onto the next bucket
594594
else {
595-
current_slot = next_slot(g, current_slot);
595+
current_slot = this->next_slot(g, current_slot);
596596
}
597597
}
598598
}
@@ -602,7 +602,7 @@ template <typename Hash, typename KeyEqual>
602602
__device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::erase(
603603
key_type const& k, Hash hash, KeyEqual key_equal) noexcept
604604
{
605-
auto current_slot{initial_slot(k, hash)};
605+
auto current_slot{this->initial_slot(k, hash)};
606606

607607
value_type const insert_pair =
608608
make_pair<Key, Value>(this->get_erased_key_sentinel(), this->get_empty_value_sentinel());
@@ -641,7 +641,7 @@ __device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::e
641641
}
642642
}
643643

644-
current_slot = next_slot(current_slot);
644+
current_slot = this->next_slot(current_slot);
645645
}
646646
}
647647

@@ -650,7 +650,7 @@ template <typename CG, typename Hash, typename KeyEqual>
650650
__device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::erase(
651651
CG const& g, key_type const& k, Hash hash, KeyEqual key_equal) noexcept
652652
{
653-
auto current_slot = initial_slot(g, k, hash);
653+
auto current_slot = this->initial_slot(g, k, hash);
654654
value_type const insert_pair =
655655
make_pair<Key, Value>(this->get_erased_key_sentinel(), this->get_empty_value_sentinel());
656656

@@ -699,7 +699,7 @@ __device__ bool static_map<Key, Value, Scope, Allocator>::device_mutable_view::e
699699
// empty slot found, but key not found, must not be in the map
700700
if (g.ballot(slot_is_empty)) { return false; }
701701

702-
current_slot = next_slot(g, current_slot);
702+
current_slot = this->next_slot(g, current_slot);
703703
}
704704
}
705705

@@ -710,7 +710,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(Key const& k,
710710
Hash hash,
711711
KeyEqual key_equal) noexcept
712712
{
713-
auto current_slot = initial_slot(k, hash);
713+
auto current_slot = this->initial_slot(k, hash);
714714

715715
while (true) {
716716
auto const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -722,7 +722,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(Key const& k,
722722
// Key exists, return iterator to location
723723
if (key_equal(existing_key, k)) { return current_slot; }
724724

725-
current_slot = next_slot(current_slot);
725+
current_slot = this->next_slot(current_slot);
726726
}
727727
}
728728

@@ -733,7 +733,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(Key const& k,
733733
Hash hash,
734734
KeyEqual key_equal) const noexcept
735735
{
736-
auto current_slot = initial_slot(k, hash);
736+
auto current_slot = this->initial_slot(k, hash);
737737

738738
while (true) {
739739
auto const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -745,7 +745,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(Key const& k,
745745
// Key exists, return iterator to location
746746
if (key_equal(existing_key, k)) { return current_slot; }
747747

748-
current_slot = next_slot(current_slot);
748+
current_slot = this->next_slot(current_slot);
749749
}
750750
}
751751

@@ -757,7 +757,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(CG g,
757757
Hash hash,
758758
KeyEqual key_equal) noexcept
759759
{
760-
auto current_slot = initial_slot(g, k, hash);
760+
auto current_slot = this->initial_slot(g, k, hash);
761761

762762
while (true) {
763763
auto const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -783,7 +783,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(CG g,
783783

784784
// otherwise, all slots in the current bucket are full with other keys, so we move onto the
785785
// next bucket
786-
current_slot = next_slot(g, current_slot);
786+
current_slot = this->next_slot(g, current_slot);
787787
}
788788
}
789789

@@ -795,7 +795,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(CG g,
795795
Hash hash,
796796
KeyEqual key_equal) const noexcept
797797
{
798-
auto current_slot = initial_slot(g, k, hash);
798+
auto current_slot = this->initial_slot(g, k, hash);
799799

800800
while (true) {
801801
auto const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -823,7 +823,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::find(CG g,
823823
// otherwise, all slots in the current bucket are full with other keys,
824824
// so we move onto the next bucket in the current submap
825825

826-
current_slot = next_slot(g, current_slot);
826+
current_slot = this->next_slot(g, current_slot);
827827
}
828828
}
829829

@@ -832,7 +832,7 @@ template <typename ProbeKey, typename Hash, typename KeyEqual>
832832
__device__ bool static_map<Key, Value, Scope, Allocator>::device_view::contains(
833833
ProbeKey const& k, Hash hash, KeyEqual key_equal) const noexcept
834834
{
835-
auto current_slot = initial_slot(k, hash);
835+
auto current_slot = this->initial_slot(k, hash);
836836

837837
while (true) {
838838
auto const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -841,7 +841,7 @@ __device__ bool static_map<Key, Value, Scope, Allocator>::device_view::contains(
841841

842842
if (key_equal(existing_key, k)) { return true; }
843843

844-
current_slot = next_slot(current_slot);
844+
current_slot = this->next_slot(current_slot);
845845
}
846846
}
847847

@@ -853,7 +853,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::contains(CG const& g,
853853
Hash hash,
854854
KeyEqual key_equal) const noexcept
855855
{
856-
auto current_slot = initial_slot(g, k, hash);
856+
auto current_slot = this->initial_slot(g, k, hash);
857857

858858
while (true) {
859859
key_type const existing_key = current_slot->first.load(cuda::std::memory_order_relaxed);
@@ -872,7 +872,7 @@ static_map<Key, Value, Scope, Allocator>::device_view::contains(CG const& g,
872872

873873
// otherwise, all slots in the current bucket are full with other keys, so we move onto the
874874
// next bucket
875-
current_slot = next_slot(g, current_slot);
875+
current_slot = this->next_slot(g, current_slot);
876876
}
877877
}
878878
} // namespace cuco::legacy

include/cuco/detail/static_map/helpers.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void dispatch_insert_or_apply(
7575
Allocator,
7676
cuco::storage<1>>;
7777

78-
using shared_map_ref_type = typename shared_map_type::ref_type<>;
78+
using shared_map_ref_type = typename shared_map_type::template ref_type<>;
7979
auto constexpr bucket_extent =
8080
cuco::make_valid_extent<typename shared_map_ref_type::probing_scheme_type,
8181
typename shared_map_ref_type::storage_ref_type>(extent_type{});

include/cuco/detail/static_map/static_map_ref.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,9 @@ class operator_impl<
471471
{
472472
auto& ref_ = static_cast<ref_type&>(*this);
473473
if (ref_.erased_key_sentinel() != ref_.empty_key_sentinel()) {
474-
return ref_.impl_.insert<true>(group, value);
474+
return ref_.impl_.template insert<true>(group, value);
475475
} else {
476-
return ref_.impl_.insert<false>(group, value);
476+
return ref_.impl_.template insert<false>(group, value);
477477
}
478478
}
479479
};

include/cuco/detail/trie/dynamic_bitset/dynamic_bitset.cuh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ class dynamic_bitset {
8585
using size_type = std::size_t; ///< size type to specify bit index
8686
using word_type = uint64_t; ///< word type
8787
/// Type of the allocator to (de)allocate words
88-
using allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<word_type>;
88+
using allocator_type =
89+
typename std::allocator_traits<Allocator>::template rebind_alloc<word_type>;
8990

9091
/// Number of bits per block. Note this is a tradeoff between space efficiency and perf.
9192
static constexpr size_type words_per_block = 4;
@@ -326,9 +327,11 @@ class dynamic_bitset {
326327

327328
private:
328329
/// Type of the allocator to (de)allocate ranks
329-
using rank_allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<rank_type>;
330+
using rank_allocator_type =
331+
typename std::allocator_traits<Allocator>::template rebind_alloc<rank_type>;
330332
/// Type of the allocator to (de)allocate indices
331-
using size_allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<size_type>;
333+
using size_allocator_type =
334+
typename std::allocator_traits<Allocator>::template rebind_alloc<size_type>;
332335

333336
allocator_type allocator_; ///< Words allocator
334337
size_type n_bits_; ///< Number of bits dynamic_bitset currently holds

include/cuco/detail/trie/dynamic_bitset/dynamic_bitset.inl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ constexpr void dynamic_bitset<Allocator>::build_ranks_and_selects(
147147
thrust::raw_pointer_cast(words_.data()), bit_counts_begin, num_words, flip_bits);
148148

149149
std::size_t temp_storage_bytes = 0;
150-
using temp_allocator_type = typename std::allocator_traits<allocator_type>::rebind_alloc<char>;
151-
auto temp_allocator = temp_allocator_type{this->allocator_};
150+
using temp_allocator_type =
151+
typename std::allocator_traits<allocator_type>::template rebind_alloc<char>;
152+
auto temp_allocator = temp_allocator_type{this->allocator_};
152153

153154
CUCO_CUDA_TRY(cub::DeviceScan::ExclusiveSum(nullptr,
154155
temp_storage_bytes,

include/cuco/static_multimap.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ class static_multimap {
10311031
using pair_atomic_type =
10321032
cuco::pair<atomic_key_type,
10331033
atomic_mapped_type>; ///< Pair type of atomic key and atomic mapped value
1034-
using allocator_type = typename std::allocator_traits<Allocator>::rebind_alloc<
1034+
using allocator_type = typename std::allocator_traits<Allocator>::template rebind_alloc<
10351035
pair_atomic_type>; ///< Type of the allocator to (de)allocate slots
10361036
using probe_sequence_type =
10371037
cuco::legacy::detail::probe_sequence<ProbeSequence, Key, Value, Scope>; ///< Probe scheme type

0 commit comments

Comments
 (0)