Skip to content

Commit

Permalink
Merge branch 'branch-25.02' into 17482
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar authored Dec 18, 2024
2 parents 328a3cc + f3caf09 commit 3b4ec4c
Show file tree
Hide file tree
Showing 85 changed files with 1,656 additions and 2,801 deletions.
6 changes: 4 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ rapids_cpm_init()

# Not using rapids-cmake since we never want to find, always download.
CPMAddPackage(
NAME rapids_logger GITHUB_REPOSITORY rapidsai/rapids-logger GIT_SHALLOW TRUE GIT_TAG
NAME rapids_logger GITHUB_REPOSITORY rapidsai/rapids-logger GIT_SHALLOW FALSE GIT_TAG
c510947ae9d3a67530cfe3e5eaccb5a3b8ea0e55 VERSION c510947ae9d3a67530cfe3e5eaccb5a3b8ea0e55
)
rapids_make_logger(cudf EXPORT_SET cudf-exports)
Expand Down Expand Up @@ -916,7 +916,9 @@ if(CUDF_LARGE_STRINGS_DISABLED)
endif()

# Define logging level
target_compile_definitions(cudf PRIVATE "CUDF_LOG_ACTIVE_LEVEL=${LIBCUDF_LOGGING_LEVEL}")
target_compile_definitions(
cudf PRIVATE "CUDF_LOG_ACTIVE_LEVEL=CUDF_LOG_LEVEL_${LIBCUDF_LOGGING_LEVEL}"
)

# Enable remote IO through KvikIO
target_compile_definitions(cudf PRIVATE $<$<BOOL:${CUDF_KVIKIO_REMOTE_IO}>:CUDF_KVIKIO_REMOTE_IO>)
Expand Down
8 changes: 3 additions & 5 deletions cpp/cmake/thirdparty/get_nanoarrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@

# This function finds nanoarrow and sets any additional necessary environment variables.
function(find_and_configure_nanoarrow)
include(${rapids-cmake-dir}/cpm/package_override.cmake)

set(cudf_patch_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/patches")
rapids_cpm_package_override("${cudf_patch_dir}/nanoarrow_override.json")

if(NOT BUILD_SHARED_LIBS)
set(_exclude_from_all EXCLUDE_FROM_ALL FALSE)
else()
Expand All @@ -31,6 +26,9 @@ function(find_and_configure_nanoarrow)
nanoarrow 0.6.0.dev
GLOBAL_TARGETS nanoarrow
CPM_ARGS
GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git
GIT_TAG 1e2664a70ec14907409cadcceb14d79b9670bcdb
GIT_SHALLOW FALSE
OPTIONS "BUILD_SHARED_LIBS OFF" "NANOARROW_NAMESPACE cudf" ${_exclude_from_all}
)
set_target_properties(nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down
38 changes: 0 additions & 38 deletions cpp/cmake/thirdparty/patches/nanoarrow_clang_tidy_compliance.diff

This file was deleted.

18 changes: 0 additions & 18 deletions cpp/cmake/thirdparty/patches/nanoarrow_override.json

This file was deleted.

12 changes: 6 additions & 6 deletions cpp/include/cudf/column/column_device_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class alignas(16) column_device_view : public detail::column_device_view_base {
* @return string_view instance representing this element at this index
*/
template <typename T, CUDF_ENABLE_IF(std::is_same_v<T, string_view>)>
__device__ [[nodiscard]] T element(size_type element_index) const noexcept
[[nodiscard]] __device__ T element(size_type element_index) const noexcept
{
size_type index = element_index + offset(); // account for this view's _offset
char const* d_strings = static_cast<char const*>(_data);
Expand Down Expand Up @@ -503,7 +503,7 @@ class alignas(16) column_device_view : public detail::column_device_view_base {
* @return dictionary32 instance representing this element at this index
*/
template <typename T, CUDF_ENABLE_IF(std::is_same_v<T, dictionary32>)>
__device__ [[nodiscard]] T element(size_type element_index) const noexcept
[[nodiscard]] __device__ T element(size_type element_index) const noexcept
{
size_type index = element_index + offset(); // account for this view's _offset
auto const indices = d_children[0];
Expand All @@ -521,7 +521,7 @@ class alignas(16) column_device_view : public detail::column_device_view_base {
* @return numeric::fixed_point representing the element at this index
*/
template <typename T, CUDF_ENABLE_IF(cudf::is_fixed_point<T>())>
__device__ [[nodiscard]] T element(size_type element_index) const noexcept
[[nodiscard]] __device__ T element(size_type element_index) const noexcept
{
using namespace numeric;
using rep = typename T::rep;
Expand Down Expand Up @@ -1034,7 +1034,7 @@ class alignas(16) mutable_column_device_view : public detail::column_device_view
* @return Reference to the element at the specified index
*/
template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
__device__ [[nodiscard]] T& element(size_type element_index) const noexcept
[[nodiscard]] __device__ T& element(size_type element_index) const noexcept
{
return data<T>()[element_index];
}
Expand Down Expand Up @@ -1427,13 +1427,13 @@ struct pair_rep_accessor {

private:
template <typename R, std::enable_if_t<std::is_same_v<R, rep_type>, void>* = nullptr>
__device__ [[nodiscard]] inline auto get_rep(cudf::size_type i) const
[[nodiscard]] __device__ inline auto get_rep(cudf::size_type i) const
{
return col.element<R>(i);
}

template <typename R, std::enable_if_t<not std::is_same_v<R, rep_type>, void>* = nullptr>
__device__ [[nodiscard]] inline auto get_rep(cudf::size_type i) const
[[nodiscard]] __device__ inline auto get_rep(cudf::size_type i) const
{
return col.element<R>(i).value();
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/cudf/detail/aggregation/aggregation.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <cudf/detail/utilities/assert.cuh>
#include <cudf/detail/utilities/device_atomics.cuh>
#include <cudf/table/table_view.hpp>
#include <cudf/utilities/span.hpp>
#include <cudf/utilities/traits.cuh>

#include <rmm/cuda_stream_view.hpp>
Expand All @@ -31,7 +32,6 @@
#include <thrust/fill.h>

#include <type_traits>
#include <vector>

namespace cudf {
namespace detail {
Expand Down Expand Up @@ -216,12 +216,12 @@ struct identity_initializer {
* @throw cudf::logic_error if column type is not fixed-width
*
* @param table The table of columns to initialize.
* @param aggs A vector of aggregation operations corresponding to the table
* @param aggs A span of aggregation operations corresponding to the table
* columns. The aggregations determine the identity value for each column.
* @param stream CUDA stream used for device memory operations and kernel launches.
*/
void initialize_with_identity(mutable_table_view& table,
std::vector<aggregation::Kind> const& aggs,
host_span<cudf::aggregation::Kind const> aggs,
rmm::cuda_stream_view stream);

} // namespace detail
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/detail/device_scalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class device_scalar : public rmm::device_scalar<T> {
[[nodiscard]] T value(rmm::cuda_stream_view stream) const
{
cuda_memcpy<T>(bounce_buffer, device_span<T const>{this->data(), 1}, stream);
return bounce_buffer[0];
return std::move(bounce_buffer[0]);
}

void set_value_async(T const& value, rmm::cuda_stream_view stream)
Expand Down
22 changes: 11 additions & 11 deletions cpp/include/cudf/strings/string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class string_view {
*
* @return The number of characters in this string
*/
__device__ [[nodiscard]] inline size_type length() const;
[[nodiscard]] __device__ inline size_type length() const;
/**
* @brief Return a pointer to the internal device array
*
Expand Down Expand Up @@ -119,13 +119,13 @@ class string_view {
*
* @return new iterator pointing to the beginning of this string
*/
__device__ [[nodiscard]] inline const_iterator begin() const;
[[nodiscard]] __device__ inline const_iterator begin() const;
/**
* @brief Return new iterator pointing past the end of this string
*
* @return new iterator pointing past the end of this string
*/
__device__ [[nodiscard]] inline const_iterator end() const;
[[nodiscard]] __device__ inline const_iterator end() const;

/**
* @brief Return single UTF-8 character at the given character position
Expand All @@ -140,7 +140,7 @@ class string_view {
* @param pos Character position
* @return Byte offset from data() for a given character position
*/
__device__ [[nodiscard]] inline size_type byte_offset(size_type pos) const;
[[nodiscard]] __device__ inline size_type byte_offset(size_type pos) const;

/**
* @brief Comparing target string with this string. Each character is compared
Expand All @@ -155,7 +155,7 @@ class string_view {
* not match is greater in the arg string, or all compared characters
* match but the arg string is longer.
*/
__device__ [[nodiscard]] inline int compare(string_view const& str) const;
[[nodiscard]] __device__ inline int compare(string_view const& str) const;
/**
* @brief Comparing target string with this string. Each character is compared
* as a UTF-8 code-point value.
Expand Down Expand Up @@ -225,7 +225,7 @@ class string_view {
* Specify -1 to indicate to the end of the string.
* @return npos if str is not found in this string.
*/
__device__ [[nodiscard]] inline size_type find(string_view const& str,
[[nodiscard]] __device__ inline size_type find(string_view const& str,
size_type pos = 0,
size_type count = -1) const;
/**
Expand Down Expand Up @@ -253,7 +253,7 @@ class string_view {
* Specify -1 to indicate to the end of the string.
* @return npos if arg string is not found in this string.
*/
__device__ [[nodiscard]] inline size_type find(char_utf8 character,
[[nodiscard]] __device__ inline size_type find(char_utf8 character,
size_type pos = 0,
size_type count = -1) const;
/**
Expand All @@ -266,7 +266,7 @@ class string_view {
* Specify -1 to indicate to the end of the string.
* @return npos if arg string is not found in this string.
*/
__device__ [[nodiscard]] inline size_type rfind(string_view const& str,
[[nodiscard]] __device__ inline size_type rfind(string_view const& str,
size_type pos = 0,
size_type count = -1) const;
/**
Expand Down Expand Up @@ -294,7 +294,7 @@ class string_view {
* Specify -1 to indicate to the end of the string.
* @return npos if arg string is not found in this string.
*/
__device__ [[nodiscard]] inline size_type rfind(char_utf8 character,
[[nodiscard]] __device__ inline size_type rfind(char_utf8 character,
size_type pos = 0,
size_type count = -1) const;

Expand All @@ -306,7 +306,7 @@ class string_view {
* @param length Number of characters from start to include in the sub-string.
* @return New instance pointing to a subset of the characters within this instance.
*/
__device__ [[nodiscard]] inline string_view substr(size_type start, size_type length) const;
[[nodiscard]] __device__ inline string_view substr(size_type start, size_type length) const;

/**
* @brief Return minimum value associated with the string type
Expand Down Expand Up @@ -386,7 +386,7 @@ class string_view {
* @param bytepos Byte position from start of _data.
* @return The character position for the specified byte.
*/
__device__ [[nodiscard]] inline size_type character_offset(size_type bytepos) const;
[[nodiscard]] __device__ inline size_type character_offset(size_type bytepos) const;

/**
* @brief Common internal implementation for string_view::find and string_view::rfind.
Expand Down
2 changes: 0 additions & 2 deletions cpp/include/cudf/utilities/memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#pragma once

#include <cudf/utilities/memory_resource.hpp>

#include <rmm/cuda_device.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/aggregation/aggregation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
#include <cudf/detail/aggregation/aggregation.cuh>
#include <cudf/detail/aggregation/aggregation.hpp>
#include <cudf/table/table_view.hpp>
#include <cudf/utilities/span.hpp>

#include <rmm/cuda_stream_view.hpp>

#include <vector>

namespace cudf {
namespace detail {
void initialize_with_identity(mutable_table_view& table,
std::vector<aggregation::Kind> const& aggs,
host_span<cudf::aggregation::Kind const> aggs,
rmm::cuda_stream_view stream)
{
// TODO: Initialize all the columns in a single kernel instead of invoking one
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/bitmask/is_element_valid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <cudf/detail/is_element_valid.hpp>
#include <cudf/detail/utilities/vector_factories.hpp>
#include <cudf/utilities/bit.hpp>
#include <cudf/utilities/error.hpp>

Expand All @@ -30,15 +31,14 @@ bool is_element_valid_sync(column_view const& col_view,
CUDF_EXPECTS(element_index >= 0 and element_index < col_view.size(), "invalid index.");
if (!col_view.nullable()) { return true; }

bitmask_type word = 0;
// null_mask() returns device ptr to bitmask without offset
size_type const index = element_index + col_view.offset();
CUDF_CUDA_TRY(cudaMemcpyAsync(&word,
col_view.null_mask() + word_index(index),
sizeof(bitmask_type),
cudaMemcpyDefault,
stream.value()));
stream.synchronize();

auto const word =
cudf::detail::make_host_vector_sync(
device_span<bitmask_type const>{col_view.null_mask() + word_index(index), 1}, stream)
.front();

return static_cast<bool>(word & (bitmask_type{1} << intra_word_index(index)));
}

Expand Down
16 changes: 5 additions & 11 deletions cpp/src/column/column_device_view.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, 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 All @@ -16,6 +16,7 @@
#include <cudf/column/column_device_view.cuh>
#include <cudf/column/column_view.hpp>
#include <cudf/detail/iterator.cuh>
#include <cudf/detail/utilities/vector_factories.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/error.hpp>

Expand Down Expand Up @@ -60,13 +61,12 @@ create_device_view_from_view(ColumnView const& source, rmm::cuda_stream_view str
// A buffer of CPU memory is allocated to hold the ColumnDeviceView
// objects. Once filled, the CPU memory is copied to device memory
// and then set into the d_children member pointer.
std::vector<char> staging_buffer(descendant_storage_bytes);
auto staging_buffer = detail::make_host_vector<char>(descendant_storage_bytes, stream);

// Each ColumnDeviceView instance may have child objects that
// require setting some internal device pointers before being copied
// from CPU to device.
rmm::device_buffer* const descendant_storage =
new rmm::device_buffer(descendant_storage_bytes, stream);
auto const descendant_storage = new rmm::device_uvector<char>(descendant_storage_bytes, stream);

auto deleter = [descendant_storage](ColumnDeviceView* v) {
v->destroy();
Expand All @@ -77,13 +77,7 @@ create_device_view_from_view(ColumnView const& source, rmm::cuda_stream_view str
new ColumnDeviceView(source, staging_buffer.data(), descendant_storage->data()), deleter};

// copy the CPU memory with all the children into device memory
CUDF_CUDA_TRY(cudaMemcpyAsync(descendant_storage->data(),
staging_buffer.data(),
descendant_storage->size(),
cudaMemcpyDefault,
stream.value()));

stream.synchronize();
detail::cuda_memcpy<char>(*descendant_storage, staging_buffer, stream);

return result;
}
Expand Down
Loading

0 comments on commit 3b4ec4c

Please sign in to comment.