Skip to content

Commit

Permalink
Misc coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
amukkara committed Sep 10, 2023
1 parent cdbabef commit cc7cce6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions include/cuco/detail/trie/trie_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class operator_impl<op::trie_lookup_tag, trie_ref<LabelType, Allocator, Operator
/**
* @brief Find position of last child of a node
*
* @param louds louds bitvector of current level
* @param louds louds bitset of current level
* @param node_id node index in current level
*
* @return Position of last child
*/
template <typename BitVectorRef>
[[nodiscard]] __device__ size_type get_last_child_position(BitVectorRef louds,
size_type& node_id) const noexcept
template <typename BitsetRef>
[[nodiscard]] __device__ size_type last_child_position(BitsetRef louds,
size_type& node_id) const noexcept
{
size_type node_pos = 0;
if (node_id != 0) {
Expand Down Expand Up @@ -85,7 +85,7 @@ class operator_impl<op::trie_lookup_tag, trie_ref<LabelType, Allocator, Operator
auto const& trie = static_cast<ref_type const&>(*this).trie_;
auto louds = trie->louds_refs_ptr_[level_id];

auto end = get_last_child_position(louds, node_id); // Position of last child
auto end = last_child_position(louds, node_id); // Position of last child
auto begin = node_id; // Position of first child, initialized after find_last_child call

auto& level = trie->d_levels_ptr_[level_id];
Expand Down
4 changes: 2 additions & 2 deletions include/cuco/trie.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ class trie {
level* d_levels_ptr_; ///< Device-side array of levels

using bitset_ref = detail::dynamic_bitset<>::ref_type; ///< Read ref
thrust::device_vector<bitset_ref> louds_refs_; ///< refs to per-level louds bitvectors
thrust::device_vector<bitset_ref> outs_refs_; ///< refs to per-level outs bitvectors
thrust::device_vector<bitset_ref> louds_refs_; ///< refs to per-level louds bitsets
thrust::device_vector<bitset_ref> outs_refs_; ///< refs to per-level outs bitsets

bitset_ref* louds_refs_ptr_; ///< Raw pointer to d_louds_refs_
bitset_ref* outs_refs_ptr_; ///< Raw pointer to d_outs_refs_
Expand Down
16 changes: 8 additions & 8 deletions tests/trie/lookup_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
#include <catch2/catch_test_macros.hpp>

struct valid_key {
valid_key(uint64_t num_keys) : num_keys_(num_keys) {}
__host__ __device__ bool operator()(uint64_t x) const { return x < num_keys_; }
const uint64_t num_keys_;
valid_key(size_t num_keys) : num_keys_(num_keys) {}
__host__ __device__ bool operator()(size_t x) const { return x < num_keys_; }
const size_t num_keys_;
};

template <typename KeyType>
void generate_keys(thrust::host_vector<KeyType>& keys,
thrust::host_vector<uint64_t>& offsets,
thrust::host_vector<size_t>& offsets,
size_t num_keys,
size_t max_key_value,
size_t max_key_length)
Expand All @@ -58,7 +58,7 @@ TEST_CASE("Lookup test", "")
std::size_t max_key_value = 1000;
std::size_t max_key_length = 32;
thrust::host_vector<KeyType> keys;
thrust::host_vector<uint64_t> offsets;
thrust::host_vector<size_t> offsets;

generate_keys(keys, offsets, num_keys, max_key_value, max_key_length);

Expand Down Expand Up @@ -97,9 +97,9 @@ TEST_CASE("Lookup test", "")
trie.build();

{
thrust::device_vector<uint64_t> lookup_result(num_keys, -1lu);
thrust::device_vector<KeyType> device_keys = keys;
thrust::device_vector<uint64_t> device_offsets = offsets;
thrust::device_vector<size_t> lookup_result(num_keys, -1lu);
thrust::device_vector<KeyType> device_keys = keys;
thrust::device_vector<size_t> device_offsets = offsets;

trie.lookup(
device_keys.begin(), device_offsets.begin(), device_offsets.end(), lookup_result.begin());
Expand Down

0 comments on commit cc7cce6

Please sign in to comment.