Skip to content

Commit

Permalink
Merge branch 'branch-25.02' into add-xxhash32
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice authored Dec 17, 2024
2 parents 6fbd870 + b9760ac commit fc35cc5
Show file tree
Hide file tree
Showing 48 changed files with 942 additions and 1,368 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 @@ -917,7 +917,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
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
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
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 fc35cc5

Please sign in to comment.