Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] Initial fixed_point Column Support #5704

Merged
merged 82 commits into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
eca1349
Initial changes
codereport Jun 12, 2020
274734d
Merge branch 'branch-0.15' into fp-column
codereport Jun 16, 2020
6b2a3d1
Changes to support fixed_point_scalar
codereport Jun 23, 2020
46de596
Use default ctor in `replace`
codereport Jun 23, 2020
55645b8
Add #pragma once
codereport Jun 24, 2020
6d0f39e
Use default ctor instead of 0
codereport Jun 24, 2020
3b1c4d2
json/csv decode
codereport Jun 24, 2020
3045ddb
column_view_printer temoprary () operator
codereport Jun 24, 2020
a056bc5
Changes for algorithms to compile
codereport Jun 24, 2020
e05591e
Add TOREVIEW comment
codereport Jun 24, 2020
7c3efda
Add sorted_order and gather tests
codereport Jun 24, 2020
824fb37
Remove column_device_printer hack
codereport Jun 24, 2020
a98c5e6
Small cleanups
codereport Jun 29, 2020
e3e8571
Merge branch 'branch-0.15' into fp-column
codereport Jul 8, 2020
e0f51f8
Remove unused <functional> header
codereport Jul 9, 2020
29101ab
Add missing <type_traits> header
codereport Jul 9, 2020
d83fcb2
Remove << ostream operator / iostream
codereport Jul 9, 2020
8fe05c6
Add changes to support binaryops + unit test (failing)
codereport Jul 9, 2020
f2b0b8a
Final changes for `binaryop` to work
codereport Jul 10, 2020
424347c
Merge branch 'branch-0.15' into fp-column
codereport Jul 13, 2020
dd38812
Merge branch 'branch-0.15' of https://github.com/rapidsai/cudf into b…
codereport Jul 13, 2020
ebb929f
Add unit test for fixed_point concatenate
codereport Jul 13, 2020
9544fa0
Add unit test for fixed_point replace
codereport Jul 14, 2020
1c4a007
Add unit tests for fixed_point upper_bound & lower_bound
codereport Jul 14, 2020
e69c2c7
Remove trailing comma
codereport Jul 15, 2020
ec9fbd6
Add unit test for fixed_point interleave
codereport Jul 15, 2020
b2ef603
Add "scale loop" to interleave unit test
codereport Jul 15, 2020
5ca44bd
Add unit test for fixed_point product reduction
codereport Jul 15, 2020
1a6f131
Add unit test for fixed_point sum reduction
codereport Jul 15, 2020
3c36662
Merge branch 'branch-0.15' of https://github.com/rapidsai/cudf into b…
codereport Jul 16, 2020
93b6897
Merge branch 'branch-0.15' into fp-column
codereport Jul 16, 2020
c54488d
Update CHANGELOG
codereport Jul 16, 2020
a99e34e
Add decimal64 alias
codereport Jul 16, 2020
661a5ed
Add decimal64 to fixed_point type trait
codereport Jul 16, 2020
4e3d35b
Add decimal64 to types.hpp and type_dispatcher.hpp
codereport Jul 16, 2020
51b8c02
Make column_device_printer generic for decimal64
codereport Jul 16, 2020
3b30ff7
Add code for stamping out decimal64 algorithm specializations
codereport Jul 16, 2020
51487d1
Generalizing unit tests for decimal64
codereport Jul 16, 2020
58b76e2
Remove unnecessary #include fixed_point in binaryop kernel.cpp
codereport Jul 16, 2020
13b0dd2
Remove unnecessary header_names entry for fixed_point
codereport Jul 16, 2020
7759dfc
BROKEN: Add unit test for decimal64 binaryop
codereport Jul 17, 2020
c11e7a1
Merge branch 'fp-column' of https://github.com/codereport/cudf into f…
codereport Jul 17, 2020
0256cd5
Add back necessary jitify changes (seems to work w/o b/c of caching bug)
codereport Jul 17, 2020
4f5b459
Add binaryop MUL unit test for fixed_point
codereport Jul 17, 2020
f53c338
Merge branch 'branch-0.15' of https://github.com/rapidsai/cudf into b…
codereport Jul 19, 2020
786a079
Merge branch 'branch-0.15' into fp-column
codereport Jul 19, 2020
52226a2
Merge branch 'branch-0.15' of https://github.com/rapidsai/cudf into f…
codereport Jul 21, 2020
ac4837f
Disable reduction algorithms / device identity functions
codereport Jul 21, 2020
bfb68b4
Add is_primitive_type trait
codereport Jul 21, 2020
f40b8e5
Merge branch 'branch-0.15' into fp-column
codereport Jul 22, 2020
4ce07ee
Merge branch 'fp-column' of https://github.com/codereport/cudf into f…
codereport Jul 22, 2020
58b09ba
Fixing merge conflicts
codereport Jul 22, 2020
51c5e63
Remove unused type_traits header
codereport Jul 22, 2020
5b27405
Merge branch 'branch-0.15' into fp-column
codereport Jul 23, 2020
630dca2
Update CHANGELOG message
codereport Jul 23, 2020
1275249
Update doxygen
codereport Jul 23, 2020
583b26a
Move reduction unit tests
codereport Jul 23, 2020
7ae7485
Move interleave fixed_point test
codereport Jul 23, 2020
8e41cd0
Move search fixed_point unit tests
codereport Jul 23, 2020
d81226d
Move replace fixed_point unit tests
codereport Jul 23, 2020
15edb5d
Move concatentate fixed_point test
codereport Jul 23, 2020
77d654f
Move binaryop fixed_point unit tests
codereport Jul 23, 2020
0c8b05b
Move sort fixed_point unit test
codereport Jul 23, 2020
a639cc5
Merge branch 'branch-0.15' into fp-column
codereport Jul 27, 2020
50558f7
Add simple binary op EQUAL unit test
codereport Jul 28, 2020
1033657
Add binaryop comparison fixed_point unit tests
codereport Jul 28, 2020
4f4506d
Add scatter fixed_point unit test
codereport Jul 28, 2020
4d56b65
Add cudf::test::FixedPointTypes type list and update unit tests
codereport Jul 28, 2020
5b8608b
Add fixed_width_type_converter specialization for fixed_point
codereport Jul 28, 2020
3021910
Add cudf::test::FixedPointTypes to scatter invalid index test
codereport Jul 28, 2020
be7524d
Merge branch 'branch-0.15' into fp-column
codereport Jul 28, 2020
5ee38c0
Change long to uint64_t
codereport Jul 29, 2020
b39d107
Merge branch 'branch-0.15' into fp-column
codereport Jul 29, 2020
a69dd14
Add FixedPointTypes to FixedWidthTypes
codereport Jul 29, 2020
5138dd3
Fix COPY_TEST failure
codereport Jul 29, 2020
eafe0be
Fix FACTORIES_TEST failure
codereport Jul 29, 2020
f494646
Fix GROUPBY_TEST failure
codereport Jul 29, 2020
b8e43a3
Remove `is_primitive_type` trait
codereport Jul 29, 2020
46b2ec0
Merge branch 'branch-0.15' into fp-column
codereport Jul 30, 2020
d2eb6b6
Fix ROLLING_TEST failure!!! :)
codereport Jul 30, 2020
2cd4ef4
Merge branch 'branch-0.15' into fp-column
codereport Jul 30, 2020
c293785
Add comment on why using <simt/*> includes
codereport Jul 31, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
- PR #5658 Add `filter_tokens` nvtext API
- PR #5666 Add `filter_characters_of_type` strings API
- PR #5673 Always build and test with per-thread default stream enabled in the GPU CI build
- PR #5704 Initial `fixed_point` Column Support
- PR #5716 Add `double_type_dispatcher` to libcudf
- PR #5739 Add `nvtext::detokenize` API
- PR #5645 Enforce pd.NA and Pandas nullable dtype parity
Expand Down
23 changes: 22 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include/jit/types.hpp.jit
${CMAKE_BINARY_DIR}/include/bit.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/timestamps.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/fixed_point.hpp.jit
codereport marked this conversation as resolved.
Show resolved Hide resolved
${CMAKE_BINARY_DIR}/include/jit/durations.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/details/__config.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/limits.jit
Expand All @@ -632,6 +633,8 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/ratio.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/type_traits.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/version.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/cmath.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/cassert.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/__config.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/__undef_macros.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cfloat.jit
Expand All @@ -640,10 +643,13 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/limits.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/ratio.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/type_traits.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cmath.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cassert.jit
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/include/cudf/types.h
${CMAKE_CURRENT_SOURCE_DIR}/include/cudf/types.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/cudf/utilities/bit.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/cudf/wrappers/timestamps.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/cudf/fixed_point/fixed_point.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/cudf/wrappers/durations.hpp
${LIBCUDACXX_INCLUDE_DIR}/details/__config
${LIBCUDACXX_INCLUDE_DIR}/simt/limits
Expand All @@ -653,6 +659,8 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
${LIBCUDACXX_INCLUDE_DIR}/simt/ratio
${LIBCUDACXX_INCLUDE_DIR}/simt/type_traits
${LIBCUDACXX_INCLUDE_DIR}/simt/version
${LIBCUDACXX_INCLUDE_DIR}/simt/cmath
${LIBCUDACXX_INCLUDE_DIR}/simt/cassert
${LIBCXX_INCLUDE_DIR}/__config
${LIBCXX_INCLUDE_DIR}/__undef_macros
${LIBCXX_INCLUDE_DIR}/cfloat
Expand All @@ -661,13 +669,16 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
${LIBCXX_INCLUDE_DIR}/limits
${LIBCXX_INCLUDE_DIR}/ratio
${LIBCXX_INCLUDE_DIR}/type_traits
${LIBCXX_INCLUDE_DIR}/cmath
${LIBCXX_INCLUDE_DIR}/cassert

# stringified headers are placed underneath the bin include jit directory and end in ".jit"
COMMAND ${CMAKE_BINARY_DIR}/stringify cudf/types.h > ${CMAKE_BINARY_DIR}/include/jit/types.h.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify cudf/types.hpp > ${CMAKE_BINARY_DIR}/include/jit/types.hpp.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify cudf/utilities/bit.hpp > ${CMAKE_BINARY_DIR}/include/bit.hpp.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ../src/rolling/rolling_jit_detail.hpp > ${CMAKE_BINARY_DIR}/include/rolling_jit_detail.hpp.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify cudf/wrappers/timestamps.hpp > ${CMAKE_BINARY_DIR}/include/jit/timestamps.hpp.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify cudf/fixed_point/fixed_point.hpp > ${CMAKE_BINARY_DIR}/include/jit/fixed_point.hpp.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify cudf/wrappers/durations.hpp > ${CMAKE_BINARY_DIR}/include/jit/durations.hpp.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/details/__config libcudacxx_details_config > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/details/__config.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/simt/limits libcudacxx_simt_limits > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/limits.jit
Expand All @@ -676,6 +687,8 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/simt/ctime libcudacxx_simt_ctime > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/ctime.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/simt/ratio libcudacxx_simt_ratio > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/ratio.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/simt/type_traits libcudacxx_simt_type_traits > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/type_traits.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/simt/cmath libcudacxx_simt_cmath > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/cmath.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/simt/cassert libcudacxx_simt_cassert > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/cassert.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCUDACXX_INCLUDE_DIR}/version libcudacxx_simt_version > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/version.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/__config libcxx_config > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/__config.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/__undef_macros libcxx_undef_macros > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/__undef_macros.jit
Expand All @@ -685,13 +698,16 @@ add_custom_command(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/limits libcxx_limits > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/limits.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/ratio libcxx_ratio > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/ratio.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/type_traits libcxx_type_traits > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/type_traits.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/cmath libcxx_cmath > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cmath.jit
COMMAND ${CMAKE_BINARY_DIR}/stringify ${LIBCXX_INCLUDE_DIR}/cassert libcxx_cassert > ${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cassert.jit
)

add_custom_target(stringify_run DEPENDS
${CMAKE_BINARY_DIR}/include/jit/types.h.jit
${CMAKE_BINARY_DIR}/include/jit/types.hpp.jit
${CMAKE_BINARY_DIR}/include/bit.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/timestamps.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/fixed_point.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/durations.hpp.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/details/__config.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/limits.jit
Expand All @@ -700,6 +716,8 @@ add_custom_target(stringify_run DEPENDS
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/ctime.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/ratio.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/type_traits.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/cmath.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/cassert.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/simt/version.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/__config.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/__undef_macros.jit
Expand All @@ -708,7 +726,10 @@ add_custom_target(stringify_run DEPENDS
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/ctime.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/limits.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/ratio.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/type_traits.jit)
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/type_traits.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cmath.jit
${CMAKE_BINARY_DIR}/include/jit/libcudacxx/libcxx/include/cassert.jit
)

add_dependencies(cudf stringify_run)

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/column/column_factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ std::unique_ptr<column> make_numeric_column(
cudaStream_t stream = 0,
rmm::mr::device_memory_resource* mr = rmm::mr::get_default_resource())
{
CUDF_EXPECTS(is_numeric(type), "Invalid, non-numeric type.");
CUDF_EXPECTS(is_numeric(type) || is_fixed_point(type), "Invalid, non-numeric type.");
codereport marked this conversation as resolved.
Show resolved Hide resolved
return std::make_unique<column>(type,
size,
rmm::device_buffer{size * cudf::size_of(type), stream, mr},
Expand Down
35 changes: 19 additions & 16 deletions cpp/include/cudf/detail/aggregation/aggregation.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ struct update_target_element {
};

template <typename Source, bool target_has_nulls, bool source_has_nulls>
struct update_target_element<Source,
aggregation::MIN,
target_has_nulls,
source_has_nulls,
std::enable_if_t<is_fixed_width<Source>()>> {
struct update_target_element<
Source,
aggregation::MIN,
target_has_nulls,
source_has_nulls,
std::enable_if_t<is_fixed_width<Source>() && !is_fixed_point<Source>()>> {
__device__ void operator()(mutable_column_device_view target,
size_type target_index,
column_device_view source,
Expand All @@ -117,11 +118,12 @@ struct update_target_element<Source,
};

template <typename Source, bool target_has_nulls, bool source_has_nulls>
struct update_target_element<Source,
aggregation::MAX,
target_has_nulls,
source_has_nulls,
std::enable_if_t<is_fixed_width<Source>()>> {
struct update_target_element<
Source,
aggregation::MAX,
target_has_nulls,
source_has_nulls,
std::enable_if_t<is_fixed_width<Source>() && !is_fixed_point<Source>()>> {
codereport marked this conversation as resolved.
Show resolved Hide resolved
__device__ void operator()(mutable_column_device_view target,
size_type target_index,
column_device_view source,
Expand All @@ -138,11 +140,12 @@ struct update_target_element<Source,
};

template <typename Source, bool target_has_nulls, bool source_has_nulls>
struct update_target_element<Source,
aggregation::SUM,
target_has_nulls,
source_has_nulls,
std::enable_if_t<is_fixed_width<Source>()>> {
struct update_target_element<
Source,
aggregation::SUM,
target_has_nulls,
source_has_nulls,
std::enable_if_t<is_fixed_width<Source>() && !is_fixed_point<Source>()>> {
__device__ void operator()(mutable_column_device_view target,
size_type target_index,
column_device_view source,
Expand Down Expand Up @@ -359,7 +362,7 @@ struct identity_initializer {
template <typename T, aggregation::Kind k>
static constexpr bool is_supported()
{
return cudf::is_fixed_width<T>() and
return cudf::is_fixed_width<T>() && !is_fixed_point<T>() and
(k == aggregation::SUM or k == aggregation::MIN or k == aggregation::MAX or
k == aggregation::COUNT_VALID or k == aggregation::COUNT_ALL or
k == aggregation::ARGMAX or k == aggregation::ARGMIN);
Expand Down
5 changes: 2 additions & 3 deletions cpp/include/cudf/detail/reduction.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ std::unique_ptr<scalar> reduce(InputIterator d_in,
identity,
stream);

using ScalarType = cudf::scalar_type_t<OutputType>;
auto s = new ScalarType(
std::move(dev_result), true, stream, mr); // only for string_view, data is copied
// only for string_view, data is copied
auto s = new cudf::scalar_type_t<OutputType>(std::move(dev_result), true, stream, mr);
return std::unique_ptr<scalar>(s);
}

Expand Down
43 changes: 39 additions & 4 deletions cpp/include/cudf/detail/utilities/device_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include <cudf/types.hpp>
#include <cudf/utilities/error.hpp>
#include <cudf/utilities/traits.hpp>

// will fail to compile if grouped with the includes above
#include <cudf/fixed_point/fixed_point.hpp>
codereport marked this conversation as resolved.
Show resolved Hide resolved

#include <type_traits>

namespace cudf {
Expand All @@ -40,11 +44,18 @@ struct DeviceSum {
return lhs + rhs;
}

template <typename T>
template <typename T, typename std::enable_if_t<!cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
return T{0};
}

template <typename T, typename std::enable_if_t<cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
CUDF_FAIL("fixed_point does not yet support device operator identity");
return T{};
}
};

/* @brief `count` operator - used in rolling windows */
Expand Down Expand Up @@ -88,9 +99,17 @@ struct DeviceMin {
}

template <typename T,
typename std::enable_if_t<!std::is_same<T, cudf::string_view>::value>* = nullptr>
typename std::enable_if_t<!std::is_same<T, cudf::string_view>::value &&
!cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
return std::numeric_limits<T>::max();
}

template <typename T, typename std::enable_if_t<cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
CUDF_FAIL("fixed_point does not yet support DeviceMin identity");
return std::numeric_limits<T>::max();
codereport marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down Expand Up @@ -118,11 +137,20 @@ struct DeviceMax {
}

template <typename T,
typename std::enable_if_t<!std::is_same<T, cudf::string_view>::value>* = nullptr>
typename std::enable_if_t<!std::is_same<T, cudf::string_view>::value &&
!cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
return std::numeric_limits<T>::lowest();
}

template <typename T, typename std::enable_if_t<cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
CUDF_FAIL("fixed_point does not yet support DeviceMax identity");
return std::numeric_limits<T>::lowest();
}

template <typename T,
typename std::enable_if_t<std::is_same<T, cudf::string_view>::value>* = nullptr>
CUDA_HOST_DEVICE_CALLABLE static constexpr T identity()
Expand All @@ -145,11 +173,18 @@ struct DeviceProduct {
return lhs * rhs;
}

template <typename T>
template <typename T, typename std::enable_if_t<!cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
return T{1};
}

template <typename T, typename std::enable_if_t<cudf::is_fixed_point<T>()>* = nullptr>
static constexpr T identity()
{
CUDF_FAIL("fixed_point does not yet support DeviceProduct identity");
return T{1, numeric::scale_type{0}};
}
};

/* @brief binary `and` operator */
Expand Down
Loading