From 7ee4734d3a2b7eb3a1c7bc69e84ad3421555b43d Mon Sep 17 00:00:00 2001 From: amdsc21 <96135754+amdsc21@users.noreply.github.com> Date: Sun, 26 Mar 2023 00:24:11 +0100 Subject: [PATCH] rm device_helpers.hip.h from cu --- src/common/hist_util.cu | 6 ------ src/common/host_device_vector.cu | 5 ----- src/common/numeric.cu | 5 ----- src/common/quantile.cu | 6 ------ src/common/stats.cu | 6 ------ src/data/data.cu | 6 ------ src/gbm/gbtree.cu | 5 ----- src/linear/updater_gpu_coordinate.cu | 6 ------ src/metric/elementwise_metric.cu | 13 ++----------- src/metric/multiclass_metric.cu | 13 ++----------- src/metric/survival_metric.cu | 9 ++------- src/objective/adaptive.cu | 6 ------ src/objective/rank_obj.cu | 17 +++++------------ src/objective/regression_obj.cu | 5 +---- src/predictor/gpu_predictor.cu | 6 ------ src/tree/constraints.cu | 5 ----- src/tree/fit_stump.cu | 6 ------ src/tree/gpu_hist/evaluate_splits.cu | 9 ++------- src/tree/gpu_hist/evaluator.cu | 5 ----- src/tree/gpu_hist/feature_groups.cu | 6 ------ src/tree/gpu_hist/histogram.cu | 6 ------ src/tree/gpu_hist/row_partitioner.cu | 5 ----- src/tree/updater_gpu_hist.cu | 6 ------ tests/cpp/common/test_host_device_vector.cu | 5 ----- tests/cpp/common/test_span.cu | 4 ---- tests/cpp/data/test_metainfo.cu | 5 ----- tests/cpp/tree/test_constraints.cu | 5 ----- 27 files changed, 14 insertions(+), 167 deletions(-) diff --git a/src/common/hist_util.cu b/src/common/hist_util.cu index 7e92433b9..79fdd1ae9 100644 --- a/src/common/hist_util.cu +++ b/src/common/hist_util.cu @@ -19,13 +19,7 @@ #include #include "categorical.h" - -#if defined(XGBOOST_USE_CUDA) #include "device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "device_helpers.hip.h" -#endif - #include "hist_util.cuh" #include "hist_util.h" #include "math.h" // NOLINT diff --git a/src/common/host_device_vector.cu b/src/common/host_device_vector.cu index 18e64afe8..786c30a6b 100644 --- a/src/common/host_device_vector.cu +++ b/src/common/host_device_vector.cu @@ -11,12 +11,7 @@ #include "xgboost/data.h" #include "xgboost/host_device_vector.h" #include "xgboost/tree_model.h" - -#if defined(XGBOOST_USE_CUDA) #include "device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "device_helpers.hip.h" -#endif namespace xgboost { diff --git a/src/common/numeric.cu b/src/common/numeric.cu index 818de69a0..ce8035f7e 100644 --- a/src/common/numeric.cu +++ b/src/common/numeric.cu @@ -3,12 +3,7 @@ */ #include -#if defined(XGBOOST_USE_CUDA) #include "device_helpers.cuh" // dh::Reduce, dh::XGBCachingDeviceAllocator -#elif defined(XGBOOST_USE_HIP) -#include "device_helpers.hip.h" // dh::Reduce, dh::XGBCachingDeviceAllocator -#endif - #include "numeric.h" #include "xgboost/context.h" // Context #include "xgboost/host_device_vector.h" // HostDeviceVector diff --git a/src/common/quantile.cu b/src/common/quantile.cu index 5fb846900..eab648332 100644 --- a/src/common/quantile.cu +++ b/src/common/quantile.cu @@ -16,13 +16,7 @@ #include "../collective/device_communicator.cuh" #include "categorical.h" #include "common.h" - -#if defined(XGBOOST_USE_CUDA) #include "device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "device_helpers.hip.h" -#endif - #include "hist_util.h" #include "quantile.cuh" #include "quantile.h" diff --git a/src/common/stats.cu b/src/common/stats.cu index 3dcf80f78..fbc19b8da 100644 --- a/src/common/stats.cu +++ b/src/common/stats.cu @@ -7,13 +7,7 @@ #include // size_t #include "cuda_context.cuh" // CUDAContext - -#if defined(XGBOOST_USE_CUDA) #include "device_helpers.cuh" // dh::MakeTransformIterator, tcbegin, tcend -#elif defined(XGBOOST_USE_HIP) -#include "device_helpers.hip.h" // dh::MakeTransformIterator, tcbegin, tcend -#endif - #include "optional_weight.h" // common::OptionalWeights #include "stats.cuh" // common::SegmentedQuantile, common::SegmentedWeightedQuantile #include "xgboost/base.h" // XGBOOST_DEVICE diff --git a/src/data/data.cu b/src/data/data.cu index fe6f8c8cf..b03514801 100644 --- a/src/data/data.cu +++ b/src/data/data.cu @@ -5,13 +5,7 @@ * \brief Handles setting metainfo from array interface. */ #include "../common/cuda_context.cuh" - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif - #include "../common/linalg_op.cuh" #include "array_interface.h" #include "device_adapter.cuh" diff --git a/src/gbm/gbtree.cu b/src/gbm/gbtree.cu index d493c87c6..f3bfc4d79 100644 --- a/src/gbm/gbtree.cu +++ b/src/gbm/gbtree.cu @@ -2,12 +2,7 @@ * Copyright 2021 by Contributors */ -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif - #include "xgboost/context.h" #include "xgboost/linalg.h" #include "xgboost/span.h" diff --git a/src/linear/updater_gpu_coordinate.cu b/src/linear/updater_gpu_coordinate.cu index eb2ffd1ee..2f8e3b992 100644 --- a/src/linear/updater_gpu_coordinate.cu +++ b/src/linear/updater_gpu_coordinate.cu @@ -11,13 +11,7 @@ #include "coordinate_common.h" #include "../common/common.h" - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif - #include "../common/timer.h" #include "./param.h" diff --git a/src/metric/elementwise_metric.cu b/src/metric/elementwise_metric.cu index f425d8432..fb85cca8a 100644 --- a/src/metric/elementwise_metric.cu +++ b/src/metric/elementwise_metric.cu @@ -20,23 +20,14 @@ #include "metric_common.h" #include "xgboost/metric.h" -#if defined(XGBOOST_USE_CUDA) +#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP) #include // thrust::cuda::par #include // thrust::plus<> #include #include #include "../common/device_helpers.cuh" -#endif // XGBOOST_USE_CUDA - -#if defined(XGBOOST_USE_HIP) -#include // thrust::hip::par -#include // thrust::plus<> -#include -#include - -#include "../common/device_helpers.hip.h" -#endif // XGBOOST_USE_HIP +#endif // defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP) namespace xgboost { namespace metric { diff --git a/src/metric/multiclass_metric.cu b/src/metric/multiclass_metric.cu index 706c0135b..c6cd80ae6 100644 --- a/src/metric/multiclass_metric.cu +++ b/src/metric/multiclass_metric.cu @@ -14,23 +14,14 @@ #include "../common/threading_utils.h" #include "metric_common.h" // MetricNoCache -#if defined(XGBOOST_USE_CUDA) +#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP) #include // thrust::cuda::par #include // thrust::plus<> #include #include #include "../common/device_helpers.cuh" -#endif // XGBOOST_USE_CUDA - -#if defined(XGBOOST_USE_HIP) -#include // thrust::hip::par -#include // thrust::plus<> -#include -#include - -#include "../common/device_helpers.hip.h" -#endif // XGBOOST_USE_HIP +#endif // XGBOOST_USE_CUDA || XGBOOST_USE_HIP namespace xgboost { namespace metric { diff --git a/src/metric/survival_metric.cu b/src/metric/survival_metric.cu index 6f17c6006..793337b96 100644 --- a/src/metric/survival_metric.cu +++ b/src/metric/survival_metric.cu @@ -19,15 +19,10 @@ #include "xgboost/json.h" #include "xgboost/metric.h" -#if defined(XGBOOST_USE_CUDA) +#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP) #include // thrust::cuda::par #include "../common/device_helpers.cuh" -#endif // XGBOOST_USE_CUDA - -#if defined(XGBOOST_USE_HIP) -#include // thrust::hip::par -#include "../common/device_helpers.hip.h" -#endif // XGBOOST_USE_HIP +#endif // XGBOOST_USE_CUDA || XGBOOST_USE_HIP using AFTParam = xgboost::common::AFTParam; using ProbabilityDistributionType = xgboost::common::ProbabilityDistributionType; diff --git a/src/objective/adaptive.cu b/src/objective/adaptive.cu index b6eb02b36..3d718637c 100644 --- a/src/objective/adaptive.cu +++ b/src/objective/adaptive.cu @@ -12,13 +12,7 @@ #endif #include "../common/cuda_context.cuh" // CUDAContext - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif - #include "../common/stats.cuh" #include "adaptive.h" #include "xgboost/context.h" diff --git a/src/objective/rank_obj.cu b/src/objective/rank_obj.cu index 805870aac..13d57945d 100644 --- a/src/objective/rank_obj.cu +++ b/src/objective/rank_obj.cu @@ -15,27 +15,20 @@ #include "../common/math.h" #include "../common/random.h" -#if defined(__CUDACC__) +#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__) #include #include #include #include #include +#if defined(__CUDACC__) #include +#elif defined(__HIP_PLATFORM_AMD__) +#include +#endif #include "../common/device_helpers.cuh" -#elif defined(__HIP_PLATFORM_AMD__) - -#include -#include -#include -#include -#include - -#include - -#include "../common/device_helpers.hip.h" #endif namespace xgboost { diff --git a/src/objective/regression_obj.cu b/src/objective/regression_obj.cu index 460f1f40e..214c493f4 100644 --- a/src/objective/regression_obj.cu +++ b/src/objective/regression_obj.cu @@ -35,12 +35,9 @@ #include "xgboost/span.h" #include "xgboost/tree_model.h" // RegTree -#if defined(XGBOOST_USE_CUDA) +#if defined(XGBOOST_USE_CUDA) || defined(XGBOOST_USE_HIP) #include "../common/device_helpers.cuh" #include "../common/linalg_op.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#include "../common/linalg_op.cuh" #endif // defined(XGBOOST_USE_CUDA), defined(XGBOOST_USE_HIP) namespace xgboost { diff --git a/src/predictor/gpu_predictor.cu b/src/predictor/gpu_predictor.cu index 5920eb8b1..905202040 100644 --- a/src/predictor/gpu_predictor.cu +++ b/src/predictor/gpu_predictor.cu @@ -14,13 +14,7 @@ #include "../common/bitfield.h" #include "../common/categorical.h" #include "../common/common.h" - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif - #include "../data/device_adapter.cuh" #include "../data/ellpack_page.cuh" #include "../data/proxy_dmatrix.h" diff --git a/src/tree/constraints.cu b/src/tree/constraints.cu index c5993dd1d..b6db0eda0 100644 --- a/src/tree/constraints.cu +++ b/src/tree/constraints.cu @@ -14,12 +14,7 @@ #include "xgboost/span.h" #include "constraints.cuh" #include "param.h" - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif namespace xgboost { diff --git a/src/tree/fit_stump.cu b/src/tree/fit_stump.cu index bc206155f..a9541ad98 100644 --- a/src/tree/fit_stump.cu +++ b/src/tree/fit_stump.cu @@ -12,13 +12,7 @@ #include // std::size_t #include "../collective/device_communicator.cuh" // DeviceCommunicator - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" // dh::MakeTransformIterator -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" // dh::MakeTransformIterator -#endif - #include "fit_stump.h" #include "xgboost/base.h" // GradientPairPrecise, GradientPair, XGBOOST_DEVICE #include "xgboost/context.h" // Context diff --git a/src/tree/gpu_hist/evaluate_splits.cu b/src/tree/gpu_hist/evaluate_splits.cu index dc7ea1513..c6baa97b6 100644 --- a/src/tree/gpu_hist/evaluate_splits.cu +++ b/src/tree/gpu_hist/evaluate_splits.cu @@ -6,19 +6,14 @@ #include #include "../../common/categorical.h" - -#if defined(XGBOOST_USE_CUDA) #include "../../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../common/device_helpers.hip.h" -#include -#endif - #include "../../data/ellpack_page.cuh" #include "evaluate_splits.cuh" #include "expand_entry.cuh" #if defined(XGBOOST_USE_HIP) +#include + #define WARP_SIZE WAVEFRONT_SIZE #elif defined(XGBOOST_USE_CUDA) #define WARP_SIZE 32 diff --git a/src/tree/gpu_hist/evaluator.cu b/src/tree/gpu_hist/evaluator.cu index e76414694..0ef5c6121 100644 --- a/src/tree/gpu_hist/evaluator.cu +++ b/src/tree/gpu_hist/evaluator.cu @@ -7,12 +7,7 @@ #include // thrust::any_of #include // thrust::stable_sort -#if defined(XGBOOST_USE_CUDA) #include "../../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../common/device_helpers.hip.h" -#endif - #include "../../common/hist_util.h" // common::HistogramCuts #include "evaluate_splits.cuh" #include "xgboost/data.h" diff --git a/src/tree/gpu_hist/feature_groups.cu b/src/tree/gpu_hist/feature_groups.cu index 696c50bdb..f9c6ce057 100644 --- a/src/tree/gpu_hist/feature_groups.cu +++ b/src/tree/gpu_hist/feature_groups.cu @@ -7,13 +7,7 @@ #include #include "feature_groups.cuh" - -#if defined(XGBOOST_USE_CUDA) #include "../../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../common/device_helpers.hip.h" -#endif - #include "../../common/hist_util.h" namespace xgboost { diff --git a/src/tree/gpu_hist/histogram.cu b/src/tree/gpu_hist/histogram.cu index 087881a9e..da1179526 100644 --- a/src/tree/gpu_hist/histogram.cu +++ b/src/tree/gpu_hist/histogram.cu @@ -9,13 +9,7 @@ #include #include "../../common/deterministic.cuh" - -#if defined(XGBOOST_USE_CUDA) #include "../../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../common/device_helpers.hip.h" -#endif - #include "../../data/ellpack_page.cuh" #include "histogram.cuh" #include "row_partitioner.cuh" diff --git a/src/tree/gpu_hist/row_partitioner.cu b/src/tree/gpu_hist/row_partitioner.cu index 137999acc..ff04cbea9 100644 --- a/src/tree/gpu_hist/row_partitioner.cu +++ b/src/tree/gpu_hist/row_partitioner.cu @@ -7,12 +7,7 @@ #include -#if defined(XGBOOST_USE_CUDA) #include "../../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../common/device_helpers.hip.h" -#endif - #include "row_partitioner.cuh" namespace xgboost { diff --git a/src/tree/updater_gpu_hist.cu b/src/tree/updater_gpu_hist.cu index ea864f9d1..a961e5fb3 100644 --- a/src/tree/updater_gpu_hist.cu +++ b/src/tree/updater_gpu_hist.cu @@ -17,13 +17,7 @@ #include "../common/categorical.h" #include "../common/cuda_context.cuh" // CUDAContext - -#if defined(XGBOOST_USE_CUDA) #include "../common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../common/device_helpers.hip.h" -#endif - #include "../common/hist_util.h" #include "../common/io.h" #include "../common/timer.h" diff --git a/tests/cpp/common/test_host_device_vector.cu b/tests/cpp/common/test_host_device_vector.cu index c67bf518e..81b036055 100644 --- a/tests/cpp/common/test_host_device_vector.cu +++ b/tests/cpp/common/test_host_device_vector.cu @@ -6,12 +6,7 @@ #include #include -#if defined(XGBOOST_USE_CUDA) #include "../../../src/common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../../src/common/device_helpers.hip.h" -#endif - #include namespace xgboost { diff --git a/tests/cpp/common/test_span.cu b/tests/cpp/common/test_span.cu index afebcf91c..79c871b45 100644 --- a/tests/cpp/common/test_span.cu +++ b/tests/cpp/common/test_span.cu @@ -7,11 +7,7 @@ #include #include -#if defined(XGBOOST_USE_CUDA) #include "../../../src/common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../../src/common/device_helpers.hip.h" -#endif #include #include "test_span.h" diff --git a/tests/cpp/data/test_metainfo.cu b/tests/cpp/data/test_metainfo.cu index cf70ac987..a86b6b70b 100644 --- a/tests/cpp/data/test_metainfo.cu +++ b/tests/cpp/data/test_metainfo.cu @@ -6,12 +6,7 @@ #include #include -#if defined(XGBOOST_USE_CUDA) #include "../../../src/common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../../src/common/device_helpers.hip.h" -#endif - #include "test_array_interface.h" #include "test_metainfo.h" diff --git a/tests/cpp/tree/test_constraints.cu b/tests/cpp/tree/test_constraints.cu index 393dc4ebf..c9f1639b3 100644 --- a/tests/cpp/tree/test_constraints.cu +++ b/tests/cpp/tree/test_constraints.cu @@ -10,12 +10,7 @@ #include #include "../../../src/tree/constraints.cuh" #include "../../../src/tree/param.h" - -#if defined(XGBOOST_USE_CUDA) #include "../../../src/common/device_helpers.cuh" -#elif defined(XGBOOST_USE_HIP) -#include "../../../src/common/device_helpers.hip.h" -#endif namespace xgboost { namespace {