Skip to content

Commit

Permalink
Remove default detail mrs: part5 (#12968)
Browse files Browse the repository at this point in the history
This is the fifth PR in a sequence removing default mr parameters in detail APIs. Contributes to #12944.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - MithunR (https://github.com/mythrocks)

URL: #12968
  • Loading branch information
vyasr authored Mar 21, 2023
1 parent 84ac1d5 commit 6547d96
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 118 deletions.
18 changes: 8 additions & 10 deletions cpp/include/cudf/detail/reshape.hpp
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 @@ -30,21 +30,19 @@ namespace detail {
*
* @param stream CUDA stream used for device memory operations and kernel launches
*/
std::unique_ptr<table> tile(
table_view const& input,
size_type count,
rmm::cuda_stream_view,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<table> tile(table_view const& input,
size_type count,
rmm::cuda_stream_view,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc cudf::interleave_columns
*
* @param stream CUDA stream used for device memory operations and kernel launches
*/
std::unique_ptr<column> interleave_columns(
table_view const& input,
rmm::cuda_stream_view,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> interleave_columns(table_view const& input,
rmm::cuda_stream_view,
rmm::mr::device_memory_resource* mr);

} // namespace detail
} // namespace cudf
4 changes: 2 additions & 2 deletions cpp/include/cudf/io/detail/csv.hpp
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 @@ -56,7 +56,7 @@ void write_csv(data_sink* sink,
host_span<std::string const> column_names,
csv_writer_options const& options,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
rmm::mr::device_memory_resource* mr);

} // namespace csv
} // namespace detail
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/io/detail/tokenize_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ std::pair<rmm::device_uvector<PdaTokenT>, rmm::device_uvector<SymbolOffsetT>> ge
device_span<SymbolT const> json_in,
cudf::io::json_reader_options const& options,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
rmm::mr::device_memory_resource* mr);

} // namespace detail

Expand Down
20 changes: 9 additions & 11 deletions cpp/include/cudf/lists/detail/combine.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 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 @@ -27,22 +27,20 @@ namespace detail {
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::unique_ptr<column> concatenate_rows(
table_view const& input,
concatenate_null_policy null_policy,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> concatenate_rows(table_view const& input,
concatenate_null_policy null_policy,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc cudf::lists::concatenate_list_elements
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::unique_ptr<column> concatenate_list_elements(
column_view const& input,
concatenate_null_policy null_policy,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> concatenate_list_elements(column_view const& input,
concatenate_null_policy null_policy,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

} // namespace detail
} // namespace lists
Expand Down
54 changes: 25 additions & 29 deletions cpp/include/cudf/lists/detail/set_operations.hpp
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 @@ -30,52 +30,48 @@ namespace cudf::lists::detail {
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::unique_ptr<column> have_overlap(
lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> have_overlap(lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc cudf::list::intersect_distinct
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::unique_ptr<column> intersect_distinct(
lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> intersect_distinct(lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc cudf::list::union_distinct
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::unique_ptr<column> union_distinct(
lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> union_distinct(lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc cudf::list::difference_distinct
*
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
std::unique_ptr<column> difference_distinct(
lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> difference_distinct(lists_column_view const& lhs,
lists_column_view const& rhs,
null_equality nulls_equal,
nan_equality nans_equal,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/** @} */ // end of group
} // namespace cudf::lists::detail
56 changes: 25 additions & 31 deletions cpp/src/copying/get_element.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 {

struct get_element_functor {
template <typename T, std::enable_if_t<is_fixed_width<T>() && !is_fixed_point<T>()>* p = nullptr>
std::unique_ptr<scalar> operator()(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<scalar> operator()(column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
auto s = make_fixed_width_scalar(data_type(type_to_id<T>()), stream, mr);

Expand All @@ -61,11 +60,10 @@ struct get_element_functor {
}

template <typename T, std::enable_if_t<std::is_same_v<T, string_view>>* p = nullptr>
std::unique_ptr<scalar> operator()(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<scalar> operator()(column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
auto device_col = column_device_view::create(input, stream);

Expand All @@ -86,11 +84,10 @@ struct get_element_functor {
}

template <typename T, std::enable_if_t<std::is_same_v<T, dictionary32>>* p = nullptr>
std::unique_ptr<scalar> operator()(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<scalar> operator()(column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
auto dict_view = dictionary_column_view(input);
auto indices_iter = detail::indexalator_factory::make_input_iterator(dict_view.indices());
Expand Down Expand Up @@ -122,11 +119,10 @@ struct get_element_functor {
}

template <typename T, std::enable_if_t<std::is_same_v<T, list_view>>* p = nullptr>
std::unique_ptr<scalar> operator()(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<scalar> operator()(column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
bool valid = is_element_valid_sync(input, index, stream);
auto const child_col_idx = lists_column_view::child_column_index;
Expand All @@ -147,11 +143,10 @@ struct get_element_functor {
}

template <typename T, std::enable_if_t<cudf::is_fixed_point<T>()>* p = nullptr>
std::unique_ptr<scalar> operator()(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<scalar> operator()(column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
using Type = typename T::rep;

Expand All @@ -178,11 +173,10 @@ struct get_element_functor {
}

template <typename T, std::enable_if_t<std::is_same_v<T, struct_view>>* p = nullptr>
std::unique_ptr<scalar> operator()(
column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<scalar> operator()(column_view const& input,
size_type index,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
bool valid = is_element_valid_sync(input, index, stream);
auto row_contents =
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/filling/fill.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-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 @@ -104,11 +104,10 @@ struct out_of_place_fill_range_dispatch {

template <typename T,
CUDF_ENABLE_IF(cudf::is_rep_layout_compatible<T>() or cudf::is_fixed_point<T>())>
std::unique_ptr<cudf::column> operator()(
cudf::size_type begin,
cudf::size_type end,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<cudf::column> operator()(cudf::size_type begin,
cudf::size_type end,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_EXPECTS(input.type() == value.type(), "Data type mismatch.");
auto p_ret = std::make_unique<cudf::column>(input, stream, mr);
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/filling/sequence.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 @@ -134,11 +134,10 @@ std::unique_ptr<column> sequence(size_type size,
return type_dispatcher(init.type(), sequence_functor{}, size, init, step, stream, mr);
}

std::unique_ptr<column> sequence(
size_type size,
scalar const& init,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<column> sequence(size_type size,
scalar const& init,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_EXPECTS(size >= 0, "size must be >= 0");
CUDF_EXPECTS(is_numeric(init.type()), "init scalar type must be numeric");
Expand Down
9 changes: 4 additions & 5 deletions cpp/src/io/csv/durations.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 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 @@ -28,10 +28,9 @@ namespace io {
namespace detail {
namespace csv {

std::unique_ptr<column> pandas_format_durations(
column_view const& durations,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<column> pandas_format_durations(column_view const& durations,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

} // namespace csv
} // namespace detail
Expand Down
3 changes: 2 additions & 1 deletion 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,

auto gpu_tree = [&]() {
// Parse the JSON and get the token stream
const auto [tokens_gpu, token_indices_gpu] = get_token_stream(d_input, options, stream);
const auto [tokens_gpu, token_indices_gpu] =
get_token_stream(d_input, options, stream, rmm::mr::get_current_device_resource());
// gpu tree generation
return get_tree_representation(
tokens_gpu, token_indices_gpu, stream, rmm::mr::get_current_device_resource());
Expand Down
7 changes: 5 additions & 2 deletions cpp/src/lists/set_operations.cu
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,11 @@ std::unique_ptr<column> union_distinct(lists_column_view const& lhs,

// Algorithm: `return distinct(concatenate_rows(lhs, rhs))`.

auto const union_col = lists::detail::concatenate_rows(
table_view{{lhs.parent(), rhs.parent()}}, concatenate_null_policy::NULLIFY_OUTPUT_ROW, stream);
auto const union_col =
lists::detail::concatenate_rows(table_view{{lhs.parent(), rhs.parent()}},
concatenate_null_policy::NULLIFY_OUTPUT_ROW,
stream,
rmm::mr::get_current_device_resource());

return cudf::lists::detail::distinct(
lists_column_view{union_col->view()}, nulls_equal, nans_equal, stream, mr);
Expand Down
Loading

0 comments on commit 6547d96

Please sign in to comment.