Skip to content
Draft
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: 0 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,6 @@ rtcx_embed_includes(
cudf/cpp/src/join/jit INCLUDE_DIRECTORIES cudf/cpp/src
)

rtcx_embed_includes(
cudf_cuda_embed SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/rolling DEST_DIRECTORY
cudf/cpp/src/rolling INCLUDE_DIRECTORIES cudf/cpp/src
)

rtcx_embed_includes(
cudf_cuda_embed SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/transform/jit DEST_DIRECTORY
cudf/cpp/src/transform/jit INCLUDE_DIRECTORIES cudf/cpp/src
Expand Down
16 changes: 0 additions & 16 deletions cpp/include/cudf/aggregation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class aggregation {
COLLECT_SET, ///< collect values into a list without duplicate entries
LEAD, ///< window function, accesses row at specified offset following current row
LAG, ///< window function, accesses row at specified offset preceding current row
PTX, ///< PTX based UDF aggregation
CUDA, ///< CUDA based UDF aggregation
HOST_UDF, ///< host based UDF aggregation
MERGE_LISTS, ///< merge multiple lists values into one list
MERGE_SETS, ///< merge multiple lists values into one list then drop duplicate entries
Expand Down Expand Up @@ -541,20 +539,6 @@ std::unique_ptr<Base> make_lag_aggregation(size_type offset);
template <typename Base = aggregation>
std::unique_ptr<Base> make_lead_aggregation(size_type offset);

/**
* @brief Factory to create an aggregation base on UDF for PTX or CUDA
*
* @param[in] type The source type of the UDF aggregation
* @param[in] user_defined_aggregator A string containing the aggregator code
* @param[in] output_type expected output type
*
* @return An aggregation containing a user-defined aggregator string
*/
template <typename Base = aggregation>
std::unique_ptr<Base> make_udf_aggregation(udf_source_type type,
std::string const& user_defined_aggregator,
data_type output_type);

// Forward declaration of `host_udf_base` for the factory function of `HOST_UDF` aggregation.
class host_udf_base;

Expand Down
46 changes: 0 additions & 46 deletions cpp/include/cudf/detail/aggregation/aggregation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,52 +581,6 @@ class lead_lag_aggregation final
[[nodiscard]] size_t hash_impl() const { return std::hash<size_type>()(row_offset); }
};

/**
* @brief Derived class for specifying a custom aggregation
* specified in udf
*/
class udf_aggregation final : public clonable<udf_aggregation>::derived_from<rolling_aggregation> {
public:
udf_aggregation(aggregation::Kind type,
std::string user_defined_aggregator,
data_type output_type)
: aggregation{type},
_source{std::move(user_defined_aggregator)},
_operator_name{(type == aggregation::PTX) ? "rolling_udf_ptx" : "rolling_udf_cuda"},
_function_name{"GENERIC_ROLLING_OP"},
_output_type{output_type}
{
CUDF_EXPECTS(type == aggregation::PTX or type == aggregation::CUDA,
"udf_aggregation can accept only PTX, CUDA");
}

[[nodiscard]] bool is_equal(aggregation const& _other) const override
{
if (!this->aggregation::is_equal(_other)) { return false; }
auto const& other = dynamic_cast<udf_aggregation const&>(_other);
return (_source == other._source and _operator_name == other._operator_name and
_function_name == other._function_name and _output_type == other._output_type);
}

[[nodiscard]] size_t do_hash() const override
{
return this->aggregation::do_hash() ^ hash_impl();
}

std::string const _source;
std::string const _operator_name;
std::string const _function_name;
data_type _output_type;

protected:
[[nodiscard]] size_t hash_impl() const
{
return std::hash<std::string>{}(_source) ^ std::hash<std::string>{}(_operator_name) ^
std::hash<std::string>{}(_function_name) ^
std::hash<int>{}(static_cast<int32_t>(_output_type.id()));
}
};

/**
* @brief Derived class for specifying host-based UDF aggregation.
*/
Expand Down
17 changes: 0 additions & 17 deletions cpp/src/aggregation/aggregation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,23 +428,6 @@ template CUDF_EXPORT std::unique_ptr<aggregation> make_lead_aggregation<aggregat
template CUDF_EXPORT std::unique_ptr<rolling_aggregation>
make_lead_aggregation<rolling_aggregation>(size_type offset);

/// Factory to create a UDF aggregation
template <typename Base>
std::unique_ptr<Base> make_udf_aggregation(udf_source_type type,
std::string const& user_defined_aggregator,
data_type output_type)
{
auto* a =
new detail::udf_aggregation{type == udf_source_type::PTX ? aggregation::PTX : aggregation::CUDA,
user_defined_aggregator,
output_type};
return std::unique_ptr<detail::udf_aggregation>(a);
}
template CUDF_EXPORT std::unique_ptr<aggregation> make_udf_aggregation<aggregation>(
udf_source_type type, std::string const& user_defined_aggregator, data_type output_type);
template CUDF_EXPORT std::unique_ptr<rolling_aggregation> make_udf_aggregation<rolling_aggregation>(
udf_source_type type, std::string const& user_defined_aggregator, data_type output_type);

/// Factory to create a MERGE_LISTS aggregation
template <typename Base>
std::unique_ptr<Base> make_merge_lists_aggregation()
Expand Down
16 changes: 2 additions & 14 deletions cpp/src/rolling/detail/rolling.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,8 @@ namespace detail {
static std::unique_ptr<column> empty_output_for_rolling_aggregation(column_view const& input,
rolling_aggregation const& agg)
{
// TODO:
// Ideally, for UDF aggregations, the returned column would match
// the agg's return type. It currently returns empty_like(input), because:
// 1. This preserves prior behavior for empty input columns.
// 2. There is insufficient information to construct nested return columns.
// `cudf::make_udf_aggregation()` expresses the return type as a `data_type`
// which cannot express recursively nested types (e.g. `STRUCT<LIST<INT32>>`.)
// 3. In any case, UDFs that return nested types are not currently supported.
// Constructing a more accurate return type for UDFs will be taken up
// at a later date.
return agg.kind == aggregation::CUDA || agg.kind == aggregation::PTX
? empty_like(input)
: cudf::detail::dispatch_type_and_aggregation(
input.type(), agg.kind, agg_specific_empty_output{}, input, agg);
return cudf::detail::dispatch_type_and_aggregation(
input.type(), agg.kind, agg_specific_empty_output{}, input, agg);
}

/**
Expand Down
28 changes: 8 additions & 20 deletions cpp/src/rolling/detail/rolling_fixed_window.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

#include "rolling.cuh"
#include "rolling_udf.cuh"
#include "rolling_utils.cuh"

#include <cudf/detail/aggregation/aggregation.hpp>
Expand Down Expand Up @@ -37,24 +36,13 @@ std::unique_ptr<column> rolling_window(column_view const& input,
CUDF_EXPECTS(-(preceding_window - 1) <= following_window,
"Preceding window bounds must precede the following window bounds.");

if (agg.kind == aggregation::CUDA || agg.kind == aggregation::PTX) {
// TODO: In future, might need to clamp preceding/following to column boundaries.
return cudf::detail::rolling_window_udf(input,
cudf::detail::fixed_window_wrapper(preceding_window),
cudf::detail::fixed_window_wrapper(following_window),
min_periods,
agg,
stream,
mr);
} else {
namespace utils = cudf::detail::rolling;
auto groups = utils::ungrouped{input.size()};
auto preceding =
utils::make_clamped_window_iterator<utils::direction::PRECEDING>(preceding_window, groups);
auto following =
utils::make_clamped_window_iterator<utils::direction::FOLLOWING>(following_window, groups);
return cudf::detail::rolling_window(
input, default_outputs, preceding, following, min_periods, agg, stream, mr);
}
namespace utils = cudf::detail::rolling;
auto groups = utils::ungrouped{input.size()};
auto preceding =
utils::make_clamped_window_iterator<utils::direction::PRECEDING>(preceding_window, groups);
auto following =
utils::make_clamped_window_iterator<utils::direction::FOLLOWING>(following_window, groups);
return cudf::detail::rolling_window(
input, default_outputs, preceding, following, min_periods, agg, stream, mr);
}
} // namespace cudf::detail
109 changes: 0 additions & 109 deletions cpp/src/rolling/detail/rolling_jit.cuh

This file was deleted.

Loading
Loading