Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default detail mrs: part7 #12970

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cpp/benchmarks/io/json/nested_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ void BM_NESTED_JSON(nvbench::state& state)
cudf::io::json::detail::device_parse_nested_json(
cudf::device_span<char const>{input->data(), static_cast<size_t>(input->size())},
default_options,
cudf::get_default_stream());
cudf::get_default_stream(),
rmm::mr::get_current_device_resource());
});

auto const time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value");
Expand Down Expand Up @@ -202,7 +203,7 @@ void BM_NESTED_JSON_DEPTH(nvbench::state& state)
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
// Allocate device-side temporary storage & run algorithm
cudf::io::json::detail::device_parse_nested_json(
input, default_options, cudf::get_default_stream());
input, default_options, cudf::get_default_stream(), rmm::mr::get_current_device_resource());
});

auto const time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value");
Expand Down
12 changes: 9 additions & 3 deletions cpp/src/io/json/json_column.cu
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ table_with_metadata device_parse_nested_json(device_span<SymbolT const> d_input,
// Parse the JSON and get the token stream
const auto [tokens_gpu, token_indices_gpu] = get_token_stream(d_input, options, stream);
// gpu tree generation
return get_tree_representation(tokens_gpu, token_indices_gpu, stream);
return get_tree_representation(
tokens_gpu, token_indices_gpu, stream, rmm::mr::get_current_device_resource());
}(); // IILE used to free memory of token data.
#ifdef NJP_DEBUG_PRINT
auto h_input = cudf::detail::make_host_vector_async(d_input, stream);
Expand All @@ -913,8 +914,13 @@ table_with_metadata device_parse_nested_json(device_span<SymbolT const> d_input,
return h_node_categories[0] == NC_LIST and h_node_categories[1] == NC_LIST;
}();

auto [gpu_col_id, gpu_row_offsets] = records_orient_tree_traversal(
d_input, gpu_tree, is_array_of_arrays, options.is_enabled_lines(), stream);
auto [gpu_col_id, gpu_row_offsets] =
records_orient_tree_traversal(d_input,
gpu_tree,
is_array_of_arrays,
options.is_enabled_lines(),
stream,
rmm::mr::get_current_device_resource());

device_json_column root_column(stream, mr);
root_column.type = json_col_t::ListColumn;
Expand Down
40 changes: 18 additions & 22 deletions cpp/src/io/json/nested_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,10 @@ void get_stack_context(device_span<SymbolT const> json_in,
* @return A tree representation of the input JSON string as vectors of node type, parent index,
* level, begin index, and end index in the input JSON string
*/
tree_meta_t get_tree_representation(
device_span<PdaTokenT const> tokens,
device_span<SymbolOffsetT const> token_indices,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
tree_meta_t get_tree_representation(device_span<PdaTokenT const> tokens,
device_span<SymbolOffsetT const> token_indices,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Traverse the tree representation of the JSON input in records orient format and populate
Expand All @@ -211,13 +210,12 @@ tree_meta_t get_tree_representation(
* @return A tuple of the output column indices and the row offsets within each column for each node
*/
std::tuple<rmm::device_uvector<NodeIndexT>, rmm::device_uvector<size_type>>
records_orient_tree_traversal(
device_span<SymbolT const> d_input,
tree_meta_t const& d_tree,
bool is_array_of_arrays,
bool is_enabled_lines,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
records_orient_tree_traversal(device_span<SymbolT const> d_input,
tree_meta_t const& d_tree,
bool is_array_of_arrays,
bool is_enabled_lines,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Searches for and selects nodes at level `row_array_children_level`. For each selected
Expand Down Expand Up @@ -258,11 +256,10 @@ reduce_to_column_tree(tree_meta_t& tree,
* All processing is done in device memory.
*
*/
table_with_metadata device_parse_nested_json(
device_span<SymbolT const> input,
cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
table_with_metadata device_parse_nested_json(device_span<SymbolT const> input,
cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Parses the given JSON string and generates table from the given input.
Expand All @@ -273,11 +270,10 @@ table_with_metadata device_parse_nested_json(
* @param mr Optional, resource with which to allocate
* @return The data parsed from the given JSON input
*/
table_with_metadata host_parse_nested_json(
device_span<SymbolT const> input,
cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
table_with_metadata host_parse_nested_json(device_span<SymbolT const> input,
cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

} // namespace detail

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/json/nested_json_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ void make_json_column(json_column& root_column,
cudf::io::json_reader_options const& options,
bool include_quote_char,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
rmm::mr::device_memory_resource* mr)
{
// Range of encapsulating function that parses to internal columnar data representation
CUDF_FUNC_RANGE();
Expand Down
8 changes: 5 additions & 3 deletions cpp/src/join/conditional_join.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,7 +56,8 @@ conditional_join(table_view const& left,
// with a corresponding NULL from the right.
case join_kind::LEFT_JOIN:
case join_kind::LEFT_ANTI_JOIN:
case join_kind::FULL_JOIN: return get_trivial_left_join_indices(left, stream);
case join_kind::FULL_JOIN:
return get_trivial_left_join_indices(left, stream, rmm::mr::get_current_device_resource());
// Inner and left semi joins return empty output because no matches can exist.
case join_kind::INNER_JOIN:
case join_kind::LEFT_SEMI_JOIN:
Expand All @@ -75,7 +76,8 @@ conditional_join(table_view const& left,
std::make_unique<rmm::device_uvector<size_type>>(0, stream, mr));
// Full joins need to return the trivial complement.
case join_kind::FULL_JOIN: {
auto ret_flipped = get_trivial_left_join_indices(right, stream);
auto ret_flipped =
get_trivial_left_join_indices(right, stream, rmm::mr::get_current_device_resource());
return std::pair(std::move(ret_flipped.second), std::move(ret_flipped.first));
}
default: CUDF_FAIL("Invalid join kind."); break;
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/join/cross_join.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,11 +37,10 @@ namespace detail {
*
* @param stream CUDA stream used for device memory operations and kernel launches
*/
std::unique_ptr<cudf::table> cross_join(
cudf::table_view const& left,
cudf::table_view const& right,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<cudf::table> cross_join(cudf::table_view const& left,
cudf::table_view const& right,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_EXPECTS(0 != left.num_columns(), "Left table is empty");
CUDF_EXPECTS(0 != right.num_columns(), "Right table is empty");
Expand Down
9 changes: 4 additions & 5 deletions cpp/src/join/join_common_utils.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -140,10 +140,9 @@ class pair_equality {
*/
std::pair<std::unique_ptr<rmm::device_uvector<size_type>>,
std::unique_ptr<rmm::device_uvector<size_type>>>
get_trivial_left_join_indices(
table_view const& left,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
get_trivial_left_join_indices(table_view const& left,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Builds the hash table based on the given `build_table`.
Expand Down
7 changes: 5 additions & 2 deletions cpp/src/join/mixed_join.cu
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ mixed_join(
// Left and full joins all return all the row indices from
// left with a corresponding NULL from the right.
case join_kind::LEFT_JOIN:
case join_kind::FULL_JOIN: return get_trivial_left_join_indices(left_conditional, stream);
case join_kind::FULL_JOIN:
return get_trivial_left_join_indices(
left_conditional, stream, rmm::mr::get_current_device_resource());
// Inner joins return empty output because no matches can exist.
case join_kind::INNER_JOIN:
return std::pair(std::make_unique<rmm::device_uvector<size_type>>(0, stream, mr),
Expand All @@ -96,7 +98,8 @@ mixed_join(
std::make_unique<rmm::device_uvector<size_type>>(0, stream, mr));
// Full joins need to return the trivial complement.
case join_kind::FULL_JOIN: {
auto ret_flipped = get_trivial_left_join_indices(right_conditional, stream);
auto ret_flipped = get_trivial_left_join_indices(
right_conditional, stream, rmm::mr::get_current_device_resource());
return std::pair(std::move(ret_flipped.second), std::move(ret_flipped.first));
}
default: CUDF_FAIL("Invalid join kind."); break;
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/join/mixed_join_semi.cu
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ std::unique_ptr<rmm::device_uvector<size_type>> mixed_join_semi(
// Anti and semi return all the row indices from left
// with a corresponding NULL from the right.
case join_kind::LEFT_ANTI_JOIN:
return get_trivial_left_join_indices(left_conditional, stream).first;
return get_trivial_left_join_indices(
left_conditional, stream, rmm::mr::get_current_device_resource())
.first;
// Inner and left semi joins return empty output because no matches can exist.
case join_kind::LEFT_SEMI_JOIN:
return std::make_unique<rmm::device_uvector<size_type>>(0, stream, mr);
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/join/semi_join.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,7 +45,7 @@ std::unique_ptr<rmm::device_uvector<cudf::size_type>> left_semi_anti_join(
cudf::table_view const& right_keys,
null_equality compare_nulls,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
rmm::mr::device_memory_resource* mr)
{
CUDF_EXPECTS(0 != left_keys.num_columns(), "Left table is empty");
CUDF_EXPECTS(0 != right_keys.num_columns(), "Right table is empty");
Expand Down
9 changes: 4 additions & 5 deletions cpp/src/lists/copying/concatenate.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -91,10 +91,9 @@ std::unique_ptr<column> merge_offsets(host_span<lists_column_view const> columns
/**
* @copydoc cudf::lists::detail::concatenate
*/
std::unique_ptr<column> concatenate(
host_span<column_view const> columns,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<column> concatenate(host_span<column_view const> columns,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
std::vector<lists_column_view> lists_columns;
lists_columns.reserve(columns.size());
Expand Down
5 changes: 3 additions & 2 deletions cpp/src/lists/reverse.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,7 +43,8 @@ std::unique_ptr<column> reverse(lists_column_view const& input,
auto const child = input.get_sliced_child(stream);

// The labels are also a map from each list element to its corresponding zero-based list index.
auto const labels = generate_labels(input, child.size(), stream);
auto const labels =
generate_labels(input, child.size(), stream, rmm::mr::get_current_device_resource());

// The offsets of the output lists column.
auto out_offsets = get_normalized_offsets(input, stream, mr);
Expand Down
44 changes: 25 additions & 19 deletions cpp/src/lists/set_operations.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -73,12 +73,14 @@ std::unique_ptr<column> have_overlap(lists_column_view const& lhs,
// - `reduce_by_key` with keys are rhs_labels and `logical_or` reduction on the existence reults
// computed in the previous step.

auto const lhs_child = lhs.get_sliced_child(stream);
auto const rhs_child = rhs.get_sliced_child(stream);
auto const lhs_labels = generate_labels(lhs, lhs_child.size(), stream);
auto const rhs_labels = generate_labels(rhs, rhs_child.size(), stream);
auto const lhs_table = table_view{{lhs_labels->view(), lhs_child}};
auto const rhs_table = table_view{{rhs_labels->view(), rhs_child}};
auto const lhs_child = lhs.get_sliced_child(stream);
auto const rhs_child = rhs.get_sliced_child(stream);
auto const lhs_labels =
generate_labels(lhs, lhs_child.size(), stream, rmm::mr::get_current_device_resource());
auto const rhs_labels =
generate_labels(rhs, rhs_child.size(), stream, rmm::mr::get_current_device_resource());
auto const lhs_table = table_view{{lhs_labels->view(), lhs_child}};
auto const rhs_table = table_view{{rhs_labels->view(), rhs_child}};

// Check existence for each row of the rhs_table in lhs_table.
auto const contained =
Expand Down Expand Up @@ -140,12 +142,14 @@ std::unique_ptr<column> intersect_distinct(lists_column_view const& lhs,
// - Extract rows of the rhs table using the existence results computed in the previous step.
// - Remove duplicate rows, and build the output lists.

auto const lhs_child = lhs.get_sliced_child(stream);
auto const rhs_child = rhs.get_sliced_child(stream);
auto const lhs_labels = generate_labels(lhs, lhs_child.size(), stream);
auto const rhs_labels = generate_labels(rhs, rhs_child.size(), stream);
auto const lhs_table = table_view{{lhs_labels->view(), lhs_child}};
auto const rhs_table = table_view{{rhs_labels->view(), rhs_child}};
auto const lhs_child = lhs.get_sliced_child(stream);
auto const rhs_child = rhs.get_sliced_child(stream);
auto const lhs_labels =
generate_labels(lhs, lhs_child.size(), stream, rmm::mr::get_current_device_resource());
auto const rhs_labels =
generate_labels(rhs, rhs_child.size(), stream, rmm::mr::get_current_device_resource());
auto const lhs_table = table_view{{lhs_labels->view(), lhs_child}};
auto const rhs_table = table_view{{rhs_labels->view(), rhs_child}};

auto const contained =
cudf::detail::contains(lhs_table, rhs_table, nulls_equal, nans_equal, stream);
Expand Down Expand Up @@ -215,12 +219,14 @@ std::unique_ptr<column> difference_distinct(lists_column_view const& lhs,
// - Extract rows of the lhs table using that difference results.
// - Remove duplicate rows, and build the output lists.

auto const lhs_child = lhs.get_sliced_child(stream);
auto const rhs_child = rhs.get_sliced_child(stream);
auto const lhs_labels = generate_labels(lhs, lhs_child.size(), stream);
auto const rhs_labels = generate_labels(rhs, rhs_child.size(), stream);
auto const lhs_table = table_view{{lhs_labels->view(), lhs_child}};
auto const rhs_table = table_view{{rhs_labels->view(), rhs_child}};
auto const lhs_child = lhs.get_sliced_child(stream);
auto const rhs_child = rhs.get_sliced_child(stream);
auto const lhs_labels =
generate_labels(lhs, lhs_child.size(), stream, rmm::mr::get_current_device_resource());
auto const rhs_labels =
generate_labels(rhs, rhs_child.size(), stream, rmm::mr::get_current_device_resource());
auto const lhs_table = table_view{{lhs_labels->view(), lhs_child}};
auto const rhs_table = table_view{{rhs_labels->view(), rhs_child}};

auto const contained =
cudf::detail::contains(rhs_table, lhs_table, nulls_equal, nans_equal, stream);
Expand Down
7 changes: 4 additions & 3 deletions cpp/src/lists/stream_compaction/distinct.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,8 +46,9 @@ std::unique_ptr<column> distinct(lists_column_view const& input,

if (input.is_empty()) { return empty_like(input.parent()); }

auto const child = input.get_sliced_child(stream);
auto const labels = generate_labels(input, child.size(), stream);
auto const child = input.get_sliced_child(stream);
auto const labels =
generate_labels(input, child.size(), stream, rmm::mr::get_current_device_resource());

auto const distinct_table =
cudf::detail::stable_distinct(table_view{{labels->view(), child}}, // input table
Expand Down
Loading