Skip to content

Commit

Permalink
Revert fixed point back to cpp header + fix an nvrtc issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Dec 20, 2024
1 parent adf58d2 commit 775de86
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cpp/include/cudf/column/column_device_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cudf/column/column_view.hpp>
#include <cudf/detail/offsets_iterator.cuh>
#include <cudf/detail/utilities/alignment.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/lists/list_view.hpp>
#include <cudf/strings/string_view.cuh>
#include <cudf/strings/strings_column_view.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/detail/utilities/device_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @file
*/

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/fixed_point/temporary.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/strings/string_view.cuh>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <cudf/fixed_point/temporary.hpp>
#include <cudf/types.hpp>

#include <cuda/std/functional>
#include <cuda/std/limits>
#include <cuda/std/type_traits>
#include <cuda/std/utility>
Expand Down Expand Up @@ -73,6 +72,24 @@ CUDF_HOST_DEVICE constexpr inline auto is_supported_representation_type()
// Helper functions for `fixed_point` type
namespace detail {

/**
* @brief Returns the smaller of the given scales
*
* @param a The left-hand side value to compare
* @param b The right-hand side value to compare
* @return The smaller of the given scales
*/
CUDF_HOST_DEVICE constexpr inline scale_type min(scale_type const& a, scale_type const& b)
{
// TODO This is a temporary workaround because <cuda/std/functional> is not self-contained when
// built with NVRTC 11.8. Replace this with cuda::std::min once the underlying issue is resolved.
#ifdef __CUDA_ARCH__
return scale_type{min(static_cast<int>(a), static_cast<int>(b))};
#else
return std::min(a, b);
#endif
}

/**
* @brief A function for integer exponentiation by squaring.
*
Expand Down Expand Up @@ -670,7 +687,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline fixed_point<Rep1, Rad1> operator+(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
auto const sum = lhs.rescaled(scale)._value + rhs.rescaled(scale)._value;

#if defined(__CUDACC_DEBUG__)
Expand All @@ -688,7 +705,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline fixed_point<Rep1, Rad1> operator-(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
auto const diff = lhs.rescaled(scale)._value - rhs.rescaled(scale)._value;

#if defined(__CUDACC_DEBUG__)
Expand Down Expand Up @@ -736,7 +753,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline bool operator==(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
return lhs.rescaled(scale)._value == rhs.rescaled(scale)._value;
}

Expand All @@ -745,7 +762,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline bool operator!=(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
return lhs.rescaled(scale)._value != rhs.rescaled(scale)._value;
}

Expand All @@ -754,7 +771,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline bool operator<=(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
return lhs.rescaled(scale)._value <= rhs.rescaled(scale)._value;
}

Expand All @@ -763,7 +780,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline bool operator>=(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
return lhs.rescaled(scale)._value >= rhs.rescaled(scale)._value;
}

Expand All @@ -772,7 +789,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline bool operator<(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
return lhs.rescaled(scale)._value < rhs.rescaled(scale)._value;
}

Expand All @@ -781,7 +798,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline bool operator>(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
return lhs.rescaled(scale)._value > rhs.rescaled(scale)._value;
}

Expand All @@ -790,7 +807,7 @@ template <typename Rep1, Radix Rad1>
CUDF_HOST_DEVICE inline fixed_point<Rep1, Rad1> operator%(fixed_point<Rep1, Rad1> const& lhs,
fixed_point<Rep1, Rad1> const& rhs)
{
auto const scale = cuda::std::min(lhs._scale, rhs._scale);
auto const scale = detail::min(lhs._scale, rhs._scale);
auto const remainder = lhs.rescaled(scale)._value % rhs.rescaled(scale)._value;
return fixed_point<Rep1, Rad1>{scaled_integer<Rep1>{remainder, scale}};
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/hashing/detail/murmurhash3_x64_128.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
#pragma once

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/hashing.hpp>
#include <cudf/hashing/detail/hash_functions.cuh>
#include <cudf/strings/string_view.cuh>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/hashing/detail/murmurhash3_x86_32.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/hashing.hpp>
#include <cudf/hashing/detail/hash_functions.cuh>
#include <cudf/lists/list_view.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/hashing/detail/xxhash_64.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/hashing.hpp>
#include <cudf/hashing/detail/hash_functions.cuh>
#include <cudf/strings/string_view.cuh>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/unary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#pragma once

#include <cudf/fixed_point/detail/floating_conversion.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/export.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/utilities/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/types.hpp>
#include <cudf/wrappers/dictionary.hpp>
#include <cudf/wrappers/durations.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/utilities/type_dispatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/error.hpp>
#include <cudf/wrappers/dictionary.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/binaryop/jit/kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* limitations under the License.
*/

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/bit.hpp>
#include <cudf/wrappers/durations.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/interop/decimal_conversion_utilities.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <cudf/detail/utilities/integer_utils.hpp>
#include <cudf/detail/utilities/linked_column.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>

#include <rmm/exec_policy.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/csv/csv_gpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <cudf/detail/utilities/cuda.cuh>
#include <cudf/detail/utilities/vector_factories.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/null_mask.hpp>
#include <cudf/strings/detail/convert/fixed_point.cuh>
#include <cudf/strings/string_view.cuh>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/csv/datetime.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "io/utilities/parsing_utils.cuh"
#include "io/utilities/time_utils.cuh"

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>

#include <thrust/equal.h>
#include <thrust/execution_policy.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/parquet/reader_impl_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <cudf/ast/detail/expression_transformer.hpp>
#include <cudf/ast/expressions.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/io/datasource.hpp>
#include <cudf/types.hpp>

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/statistics/statistics_type_identification.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "byte_array_view.cuh"
#include "conversion_type_select.cuh"

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/strings/string_view.cuh>
#include <cudf/utilities/traits.hpp>
#include <cudf/wrappers/durations.hpp>
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/statistics/temp_storage_wrapper.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, 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 @@ -24,7 +24,7 @@
#include "byte_array_view.cuh"
#include "statistics.cuh"

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/strings/string_view.cuh>
#include <cudf/wrappers/durations.hpp>
#include <cudf/wrappers/timestamps.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/statistics/typed_statistics_chunk.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "statistics_type_identification.cuh"
#include "temp_storage_wrapper.cuh"

#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/wrappers/timestamps.hpp>

#include <cuda/std/limits>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/round/round.cu
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <cudf/detail/nvtx/ranges.hpp>
#include <cudf/detail/round.hpp>
#include <cudf/detail/unary.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/fixed_point/temporary.hpp>
#include <cudf/round.hpp>
#include <cudf/scalar/scalar_factories.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/scalar/scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <cudf/column/column.hpp>
#include <cudf/detail/null_mask.hpp>
#include <cudf/detail/structs/utilities.hpp>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/strings/string_view.hpp>
#include <cudf/utilities/default_stream.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/unary/cast_ops.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <cudf/detail/nvtx/ranges.hpp>
#include <cudf/detail/unary.hpp>
#include <cudf/detail/valid_if.cuh>
#include <cudf/fixed_point/fixed_point.cuh>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/null_mask.hpp>
#include <cudf/scalar/scalar_factories.hpp>
#include <cudf/unary.hpp>
Expand Down

0 comments on commit 775de86

Please sign in to comment.