1010#include < cudf/detail/nvtx/ranges.hpp>
1111#include < cudf/detail/row_operator/hashing.cuh>
1212#include < cudf/detail/scatter.hpp>
13+ #include < cudf/detail/utilities/buffer_factories.hpp>
1314#include < cudf/detail/utilities/cuda.cuh>
1415#include < cudf/detail/utilities/grid_1d.cuh>
1516#include < cudf/detail/utilities/integer_utils.hpp>
@@ -368,7 +369,7 @@ void copy_block_partitions_impl(InputIter const input,
368369 CUDF_CUDA_TRY (cudaGetLastError ());
369370}
370371
371- rmm::device_uvector <size_type> compute_gather_map (size_type num_rows,
372+ cuda::device_buffer <size_type> compute_gather_map (size_type num_rows,
372373 size_type num_partitions,
373374 size_type const * row_partition_numbers,
374375 size_type const * row_partition_offset,
@@ -378,10 +379,11 @@ rmm::device_uvector<size_type> compute_gather_map(size_type num_rows,
378379 cuda::stream_ref stream)
379380{
380381 auto sequence = cuda::counting_iterator<cudf::size_type>{0 };
381- rmm::device_uvector<size_type> gather_map (num_rows, stream);
382+ cuda::device_buffer<size_type> gather_map (
383+ stream, cudf::get_current_device_resource_ref (), num_rows, cuda::no_init);
382384
383385 copy_block_partitions_impl (sequence,
384- gather_map.begin (),
386+ gather_map.data (),
385387 num_rows,
386388 num_partitions,
387389 row_partition_numbers,
@@ -480,7 +482,8 @@ std::pair<std::unique_ptr<table>, std::vector<size_type>> hash_partition_table_g
480482 CUDF_EXPECTS (num_partitions < std::numeric_limits<size_type>::max (),
481483 " num_partitions exceeds cudf's supported limit" );
482484
483- auto row_partition_numbers = rmm::device_uvector<size_type>(num_rows, stream);
485+ cuda::device_buffer<size_type> row_partition_numbers (
486+ stream, cudf::get_current_device_resource_ref (), num_rows, cuda::no_init);
484487
485488 // Compute partition number for each row
486489 if (is_power_two (num_partitions)) {
@@ -506,7 +509,7 @@ std::pair<std::unique_ptr<table>, std::vector<size_type>> hash_partition_table_g
506509 // Build histogram via cub::DeviceHistogram::HistogramEven.
507510 // HistogramEven writes num_partitions bins; the extra element is used by the exclusive scan
508511 // below to produce the total row count as the last offset. Zero-initialize to avoid UB.
509- auto histogram = cudf::detail::make_zeroed_device_uvector_async <size_type>(
512+ auto histogram = cudf::detail::make_zeroed_device_buffer_async <size_type>(
510513 num_partitions + 1 , stream, cudf::get_current_device_resource_ref ());
511514 {
512515 auto const num_levels = num_partitions + 1 ;
@@ -547,7 +550,8 @@ std::pair<std::unique_ptr<table>, std::vector<size_type>> hash_partition_table_g
547550 auto const pinned_offsets = cudf::detail::make_pinned_vector_async (histogram, stream);
548551
549552 // Build scatter map: atomically increment partition offsets
550- rmm::device_uvector<size_type> scatter_map (num_rows, stream);
553+ cuda::device_buffer<size_type> scatter_map (
554+ stream, cudf::get_current_device_resource_ref (), num_rows, cuda::no_init);
551555 thrust::transform (
552556 rmm::exec_policy_nosync (stream, cudf::get_current_device_resource_ref ()),
553557 row_partition_numbers.begin (),
@@ -606,7 +610,7 @@ std::pair<std::unique_ptr<table>, std::vector<size_type>> hash_partition_table(
606610 std::size_t const grid_size = util::div_rounding_up_safe (num_rows, rows_per_block);
607611
608612 // Allocate array to hold which partition each row belongs to
609- auto row_partition_numbers = rmm::device_uvector <size_type>(num_rows, stream, temp_mr);
613+ cuda::device_buffer <size_type> row_partition_numbers ( stream, temp_mr, num_rows, cuda::no_init );
610614
611615 // Array to hold the size of each partition computed by each block
612616 // i.e., { {block0 partition0 size, block1 partition0 size, ...},
@@ -615,17 +619,17 @@ std::pair<std::unique_ptr<table>, std::vector<size_type>> hash_partition_table(
615619 // {block0 partition(num_partitions-1) size, block1
616620 // partition(num_partitions -1) size, ...} }
617621 auto block_partition_sizes =
618- rmm::device_uvector <size_type>(grid_size * num_partitions, stream, temp_mr );
622+ cuda::device_buffer <size_type>(stream, temp_mr, grid_size * num_partitions, cuda::no_init );
619623
620624 auto scanned_block_partition_sizes =
621- rmm::device_uvector <size_type>(grid_size * num_partitions, stream, temp_mr );
625+ cuda::device_buffer <size_type>(stream, temp_mr, grid_size * num_partitions, cuda::no_init );
622626
623627 // Holds the total number of rows in each partition
624628 auto global_partition_sizes =
625- cudf::detail::make_zeroed_device_uvector_async <size_type>(num_partitions, stream, temp_mr);
629+ cudf::detail::make_zeroed_device_buffer_async <size_type>(num_partitions, stream, temp_mr);
626630
627631 auto row_partition_offset =
628- cudf::detail::make_zeroed_device_uvector_async <size_type>(num_rows, stream, temp_mr);
632+ cudf::detail::make_zeroed_device_buffer_async <size_type>(num_rows, stream, temp_mr);
629633
630634 // If the number of partitions is a power of two, we can compute the partition
631635 // number of each row more efficiently with bitwise operations
@@ -784,7 +788,8 @@ struct dispatch_map_type {
784788 requires(is_index_type<MapType>())
785789 {
786790 // Build a histogram of the number of rows in each partition
787- rmm::device_uvector<size_type> histogram (num_partitions + 1 , stream);
791+ cuda::device_buffer<size_type> histogram (
792+ stream, cudf::get_current_device_resource_ref (), num_partitions + 1 , cuda::no_init);
788793 std::size_t temp_storage_bytes{};
789794 std::size_t const num_levels = num_partitions + 1 ;
790795 size_type const lower_level = 0 ;
@@ -824,7 +829,8 @@ struct dispatch_map_type {
824829
825830 // Unfortunately need to materialize the scatter map because
826831 // `detail::scatter` requires multiple passes through the iterator
827- rmm::device_uvector<size_type> scatter_map (partition_map.size (), stream);
832+ cuda::device_buffer<size_type> scatter_map (
833+ stream, cudf::get_current_device_resource_ref (), partition_map.size (), cuda::no_init);
828834
829835 // For each `partition_map[i]`, atomically increment the corresponding
830836 // partition offset to determine `i`s location in the output
0 commit comments