Skip to content

Commit 74effe6

Browse files
committed
Comments
1 parent d2e339b commit 74effe6

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

include/cuco/detail/trie/trie.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ __global__ void trie_lookup_kernel(
155155
auto key_start_pos = keys + offsets[key_id];
156156
auto key_length = offsets[key_id + 1] - offsets[key_id];
157157

158-
outputs[key_id] = ref.lookup_key(key_start_pos, key_length);
158+
outputs[key_id] = ref.lookup(key_start_pos, key_length);
159159
key_id += loop_stride;
160160
}
161161
}

include/cuco/detail/trie/trie_ref.inl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ class operator_impl<op::trie_lookup_tag, trie_ref<LabelType, Allocator, Operator
1717

1818
public:
1919
/**
20-
* @brief Lookup a single key in trie
20+
* @brief Lookup a single key
2121
*
22-
* @param key Iterator to first character of search key
22+
* @tparam KeyIt Device-accessible iterator whose `value_type` can be converted to trie's
23+
* `LabelType`
24+
*
25+
* @param key Iterator to first character of key
2326
* @param length Number of characters in key
2427
*
2528
* @return Index of key if it exists in trie, -1 otherwise
2629
*/
2730
template <typename KeyIt>
28-
[[nodiscard]] __device__ size_type lookup_key(KeyIt key, size_type length) const noexcept
31+
[[nodiscard]] __device__ size_type lookup(KeyIt key, size_type length) const noexcept
2932
{
3033
auto const& trie = static_cast<ref_type const&>(*this).trie_;
3134

@@ -50,6 +53,8 @@ class operator_impl<op::trie_lookup_tag, trie_ref<LabelType, Allocator, Operator
5053
/**
5154
* @brief Find position of last child of a node
5255
*
56+
* @tparam BitsetRef Device-accessible reference to bitset
57+
*
5358
* @param louds louds bitset of current level
5459
* @param node_id node index in current level
5560
*

include/cuco/trie.cuh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class trie {
3939
~trie() noexcept(false);
4040

4141
/**
42-
* @brief Insert new key into trie
42+
* @brief Insert a single key into trie
4343
*
4444
* @param key Key to insert
4545
*/
@@ -53,16 +53,22 @@ class trie {
5353
void build() noexcept(false);
5454

5555
/**
56-
* @brief Bulk lookup vector of keys
56+
* @brief For every pair (`offsets_begin[i]`, `offsets_begin[i + 1]`) in the range
57+
* `[offsets_begin, offsets_end)`, checks if the key defined by characters in the range
58+
* [`keys_begin[offsets_begin[i]]`, `keys_begin[offsets_begin[i + 1]]`) is present in trie.
59+
* Stores the index of key if it exists in trie (-1 otherwise) in `outputs_begin[i]`
5760
*
58-
* @tparam KeyIt Device-accessible iterator to individual characters of keys
59-
* @tparam OffsetIt Device-accessible iterator to positions of key boundaries
60-
* @tparam OutputIt Device-accessible iterator to lookup result
61+
* @tparam KeyIt Device-accessible iterator whose `value_type` can be converted to trie's
62+
* `LabelType`
63+
* @tparam OffsetIt Device-accessible iterator whose `value_type` can be converted to trie's
64+
* `size_type`
65+
* @tparam OutputIt Device-accessible iterator whose `value_type` can be constructed from boolean
66+
* type
6167
*
6268
* @param keys_begin Begin iterator to individual key characters
6369
* @param offsets_begin Begin iterator to offsets of key boundaries
6470
* @param offsets_end End iterator to offsets
65-
* @param outputs_begin Begin iterator to results
71+
* @param outputs_begin Begin iterator to lookup results
6672
* @param stream Stream to execute lookup kernel
6773
*/
6874
template <typename KeyIt, typename OffsetIt, typename OutputIt>

0 commit comments

Comments
 (0)