From 49fa9960e0f251a93ed5b9c4fdc17889530fc4ea Mon Sep 17 00:00:00 2001 From: Elias Stehle <3958403+elstehle@users.noreply.github.com> Date: Mon, 4 Apr 2022 02:28:30 -0700 Subject: [PATCH] renaming key-value store op to stack_op --- cpp/src/io/fst/logical_stack.cuh | 45 ++++++++++++-------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/cpp/src/io/fst/logical_stack.cuh b/cpp/src/io/fst/logical_stack.cuh index 60a038a394c..30f28a48788 100644 --- a/cpp/src/io/fst/logical_stack.cuh +++ b/cpp/src/io/fst/logical_stack.cuh @@ -217,43 +217,32 @@ struct RemapEmptyStack { }; /** - * @brief Function object to return only the key part from a KeyValueOp instance. + * @brief Function object to return only the stack_level part from a StackOp instance. */ -struct KVOpToKey { - template - constexpr CUDF_HOST_DEVICE KeyT operator()(KeyValueOp const& kv_op) const - { - return kv_op.key; - } -}; - -/** - * @brief Function object to return only the value part from a KeyValueOp instance. - */ -struct KVOpToValue { - template - constexpr CUDF_HOST_DEVICE ValueT operator()(KeyValueOp const& kv_op) const +struct StackOpToStackLevel { + template + constexpr CUDF_HOST_DEVICE StackLevelT operator()(StackOp const& kv_op) const { - return kv_op.value; + return kv_op.stack_level; } }; /** - * @brief Retrieves an iterator that returns only the `key` part from a KeyValueOp iterator. + * @brief Retrieves an iterator that returns only the `stack_level` part from a StackOp iterator. */ -template -auto get_key_it(KeyValueOpItT it) +template +auto get_stack_level_it(StackOpItT it) { - return thrust::make_transform_iterator(it, KVOpToKey{}); + return thrust::make_transform_iterator(it, StackOpToStackLevel{}); } /** - * @brief Retrieves an iterator that returns only the `value` part from a KeyValueOp iterator. + * @brief Retrieves an iterator that returns only the `value` part from a StackOp iterator. */ -template -auto get_value_it(KeyValueOpItT it) +template +auto get_value_it(StackOpItT it) { - return thrust::make_transform_iterator(it, KVOpToValue{}); + return thrust::make_transform_iterator(it, StackOpToStackSymbol{}); } } // namespace detail @@ -444,9 +433,9 @@ void sparse_stack_op_to_top_of_stack(StackSymbolItT d_symbols, // Dump info on stack operations: (stack level change + symbol) -> (absolute stack level + symbol) test::print::print_array(num_symbols_in, stream, - get_key_it(stack_symbols_in), + get_stack_level_it(stack_symbols_in), get_value_it(stack_symbols_in), - get_key_it(d_kv_operations.Current()), + get_stack_level_it(d_kv_operations.Current()), get_value_it(d_kv_operations.Current())); // Stable radix sort, sorting by stack level of the operations @@ -481,9 +470,9 @@ void sparse_stack_op_to_top_of_stack(StackSymbolItT d_symbols, // operation) test::print::print_array(num_symbols_in, stream, - get_key_it(kv_ops_scan_in), + get_stack_level_it(kv_ops_scan_in), get_value_it(kv_ops_scan_in), - get_key_it(kv_ops_scan_out), + get_stack_level_it(kv_ops_scan_out), get_value_it(kv_ops_scan_out)); // Fill the output tape with read-symbol