Commit 20996c92 authored by Jeff Daily's avatar Jeff Daily
Browse files

partial revert of 61ec4f1a

Instead of replacing all #ifdef USE_CUDA, just add USE_CUDA define to ROCm build.
parent 1b3deb5f
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_regression_objective.hpp" #include "cuda_regression_objective.hpp"
...@@ -106,4 +106,4 @@ void CUDARegressionQuantileloss::Init(const Metadata& metadata, data_size_t num_ ...@@ -106,4 +106,4 @@ void CUDARegressionQuantileloss::Init(const Metadata& metadata, data_size_t num_
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_regression_objective.hpp" #include "cuda_regression_objective.hpp"
#include <LightGBM/cuda/cuda_algorithms.hpp> #include <LightGBM/cuda/cuda_algorithms.hpp>
...@@ -478,4 +478,4 @@ void CUDARegressionQuantileloss::LaunchGetGradientsKernel(const double* score, s ...@@ -478,4 +478,4 @@ void CUDARegressionQuantileloss::LaunchGetGradientsKernel(const double* score, s
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef LIGHTGBM_OBJECTIVE_CUDA_CUDA_REGRESSION_OBJECTIVE_HPP_ #ifndef LIGHTGBM_OBJECTIVE_CUDA_CUDA_REGRESSION_OBJECTIVE_HPP_
#define LIGHTGBM_OBJECTIVE_CUDA_CUDA_REGRESSION_OBJECTIVE_HPP_ #define LIGHTGBM_OBJECTIVE_CUDA_CUDA_REGRESSION_OBJECTIVE_HPP_
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#define GET_GRADIENTS_BLOCK_SIZE_REGRESSION (1024) #define GET_GRADIENTS_BLOCK_SIZE_REGRESSION (1024)
...@@ -163,5 +163,5 @@ class CUDARegressionQuantileloss : public CUDARegressionObjectiveInterface<Regre ...@@ -163,5 +163,5 @@ class CUDARegressionQuantileloss : public CUDARegressionObjectiveInterface<Regre
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
#endif // LIGHTGBM_OBJECTIVE_CUDA_CUDA_REGRESSION_OBJECTIVE_HPP_ #endif // LIGHTGBM_OBJECTIVE_CUDA_CUDA_REGRESSION_OBJECTIVE_HPP_
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
namespace LightGBM { namespace LightGBM {
ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string& type, const Config& config) { ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string& type, const Config& config) {
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
if (config.device_type == std::string("cuda") && if (config.device_type == std::string("cuda") &&
config.data_sample_strategy != std::string("goss") && config.data_sample_strategy != std::string("goss") &&
config.boosting != std::string("rf")) { config.boosting != std::string("rf")) {
...@@ -64,7 +64,7 @@ ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string& ...@@ -64,7 +64,7 @@ ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string&
return nullptr; return nullptr;
} }
} else { } else {
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
if (type == std::string("regression")) { if (type == std::string("regression")) {
return new RegressionL2loss(config); return new RegressionL2loss(config);
} else if (type == std::string("regression_l1")) { } else if (type == std::string("regression_l1")) {
...@@ -100,9 +100,9 @@ ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string& ...@@ -100,9 +100,9 @@ ObjectiveFunction* ObjectiveFunction::CreateObjectiveFunction(const std::string&
} else if (type == std::string("custom")) { } else if (type == std::string("custom")) {
return nullptr; return nullptr;
} }
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
} }
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
Log::Fatal("Unknown objective type name: %s", type.c_str()); Log::Fatal("Unknown objective type name: %s", type.c_str());
return nullptr; return nullptr;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <algorithm> #include <algorithm>
...@@ -396,4 +396,4 @@ void CUDABestSplitFinder::SetUsedFeatureByNode(const std::vector<int8_t>& is_fea ...@@ -396,4 +396,4 @@ void CUDABestSplitFinder::SetUsedFeatureByNode(const std::vector<int8_t>& is_fea
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_best_split_finder.hpp" #include "cuda_best_split_finder.hpp"
...@@ -933,10 +933,10 @@ __global__ void FindBestSplitsDiscretizedForLeafKernel( ...@@ -933,10 +933,10 @@ __global__ void FindBestSplitsDiscretizedForLeafKernel(
if (is_feature_used_bytree[inner_feature_index]) { if (is_feature_used_bytree[inner_feature_index]) {
if (task->is_categorical) { if (task->is_categorical) {
__threadfence(); // ensure store issued before trap __threadfence(); // ensure store issued before trap
#if defined(USE_CUDA) #if defined(USE_ROCM)
asm("trap;");
#elif defined(USE_ROCM)
__builtin_trap(); __builtin_trap();
#else
asm("trap;");
#endif #endif
} else { } else {
if (!task->reverse) { if (!task->reverse) {
...@@ -2243,4 +2243,4 @@ void CUDABestSplitFinder::LaunchInitCUDARandomKernel() { ...@@ -2243,4 +2243,4 @@ void CUDABestSplitFinder::LaunchInitCUDARandomKernel() {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_BEST_SPLIT_FINDER_HPP_ #ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_BEST_SPLIT_FINDER_HPP_
#define LIGHTGBM_TREELEARNER_CUDA_CUDA_BEST_SPLIT_FINDER_HPP_ #define LIGHTGBM_TREELEARNER_CUDA_CUDA_BEST_SPLIT_FINDER_HPP_
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <LightGBM/bin.h> #include <LightGBM/bin.h>
#include <LightGBM/dataset.h> #include <LightGBM/dataset.h>
...@@ -240,5 +240,5 @@ class CUDABestSplitFinder { ...@@ -240,5 +240,5 @@ class CUDABestSplitFinder {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
#endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_BEST_SPLIT_FINDER_HPP_ #endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_BEST_SPLIT_FINDER_HPP_
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
...@@ -376,4 +376,4 @@ void CUDADataPartition::ReduceLeafGradStat( ...@@ -376,4 +376,4 @@ void CUDADataPartition::ReduceLeafGradStat(
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_data_partition.hpp" #include "cuda_data_partition.hpp"
...@@ -1120,4 +1120,4 @@ void CUDADataPartition::LaunchReduceLeafGradStat( ...@@ -1120,4 +1120,4 @@ void CUDADataPartition::LaunchReduceLeafGradStat(
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_DATA_PARTITION_HPP_ #ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_DATA_PARTITION_HPP_
#define LIGHTGBM_TREELEARNER_CUDA_CUDA_DATA_PARTITION_HPP_ #define LIGHTGBM_TREELEARNER_CUDA_CUDA_DATA_PARTITION_HPP_
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <LightGBM/bin.h> #include <LightGBM/bin.h>
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -392,5 +392,5 @@ class CUDADataPartition { ...@@ -392,5 +392,5 @@ class CUDADataPartition {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
#endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_DATA_PARTITION_HPP_ #endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_DATA_PARTITION_HPP_
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <algorithm> #include <algorithm>
...@@ -168,4 +168,4 @@ void CUDAGradientDiscretizer::DiscretizeGradients( ...@@ -168,4 +168,4 @@ void CUDAGradientDiscretizer::DiscretizeGradients(
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_GRADIENT_DISCRETIZER_HPP_ #ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_GRADIENT_DISCRETIZER_HPP_
#define LIGHTGBM_TREELEARNER_CUDA_CUDA_GRADIENT_DISCRETIZER_HPP_ #define LIGHTGBM_TREELEARNER_CUDA_CUDA_GRADIENT_DISCRETIZER_HPP_
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <LightGBM/bin.h> #include <LightGBM/bin.h>
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -114,5 +114,5 @@ class CUDAGradientDiscretizer: public GradientDiscretizer { ...@@ -114,5 +114,5 @@ class CUDAGradientDiscretizer: public GradientDiscretizer {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
#endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_GRADIENT_DISCRETIZER_HPP_ #endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_GRADIENT_DISCRETIZER_HPP_
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_histogram_constructor.hpp" #include "cuda_histogram_constructor.hpp"
...@@ -185,4 +185,4 @@ void CUDAHistogramConstructor::ResetConfig(const Config* config) { ...@@ -185,4 +185,4 @@ void CUDAHistogramConstructor::ResetConfig(const Config* config) {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_histogram_constructor.hpp" #include "cuda_histogram_constructor.hpp"
...@@ -959,4 +959,4 @@ void CUDAHistogramConstructor::LaunchSubtractHistogramKernel( ...@@ -959,4 +959,4 @@ void CUDAHistogramConstructor::LaunchSubtractHistogramKernel(
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_HISTOGRAM_CONSTRUCTOR_HPP_ #ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_HISTOGRAM_CONSTRUCTOR_HPP_
#define LIGHTGBM_TREELEARNER_CUDA_CUDA_HISTOGRAM_CONSTRUCTOR_HPP_ #define LIGHTGBM_TREELEARNER_CUDA_CUDA_HISTOGRAM_CONSTRUCTOR_HPP_
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <LightGBM/cuda/cuda_row_data.hpp> #include <LightGBM/cuda/cuda_row_data.hpp>
#include <LightGBM/cuda/cuda_utils.hu> #include <LightGBM/cuda/cuda_utils.hu>
...@@ -192,5 +192,5 @@ class CUDAHistogramConstructor { ...@@ -192,5 +192,5 @@ class CUDAHistogramConstructor {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
#endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_HISTOGRAM_CONSTRUCTOR_HPP_ #endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_HISTOGRAM_CONSTRUCTOR_HPP_
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_leaf_splits.hpp" #include "cuda_leaf_splits.hpp"
...@@ -75,4 +75,4 @@ void CUDALeafSplits::Resize(const data_size_t num_data) { ...@@ -75,4 +75,4 @@ void CUDALeafSplits::Resize(const data_size_t num_data) {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_leaf_splits.hpp" #include "cuda_leaf_splits.hpp"
#include <LightGBM/cuda/cuda_algorithms.hpp> #include <LightGBM/cuda/cuda_algorithms.hpp>
...@@ -244,4 +244,4 @@ void CUDALeafSplits::LaunchInitValuesKernel( ...@@ -244,4 +244,4 @@ void CUDALeafSplits::LaunchInitValuesKernel(
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_LEAF_SPLITS_HPP_ #ifndef LIGHTGBM_TREELEARNER_CUDA_CUDA_LEAF_SPLITS_HPP_
#define LIGHTGBM_TREELEARNER_CUDA_CUDA_LEAF_SPLITS_HPP_ #define LIGHTGBM_TREELEARNER_CUDA_CUDA_LEAF_SPLITS_HPP_
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include <LightGBM/cuda/cuda_utils.hu> #include <LightGBM/cuda/cuda_utils.hu>
#include <LightGBM/bin.h> #include <LightGBM/bin.h>
...@@ -175,5 +175,5 @@ class CUDALeafSplits { ...@@ -175,5 +175,5 @@ class CUDALeafSplits {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
#endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_LEAF_SPLITS_HPP_ #endif // LIGHTGBM_TREELEARNER_CUDA_CUDA_LEAF_SPLITS_HPP_
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* license information. * license information.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_single_gpu_tree_learner.hpp" #include "cuda_single_gpu_tree_learner.hpp"
...@@ -609,4 +609,4 @@ void CUDASingleGPUTreeLearner::RenewDiscretizedTreeLeaves(CUDATree* cuda_tree) { ...@@ -609,4 +609,4 @@ void CUDASingleGPUTreeLearner::RenewDiscretizedTreeLeaves(CUDATree* cuda_tree) {
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#if defined(USE_CUDA) || defined(USE_ROCM) #ifdef USE_CUDA
#include "cuda_single_gpu_tree_learner.hpp" #include "cuda_single_gpu_tree_learner.hpp"
...@@ -292,4 +292,4 @@ void CUDASingleGPUTreeLearner::LaunchCalcLeafValuesGivenGradStat( ...@@ -292,4 +292,4 @@ void CUDASingleGPUTreeLearner::LaunchCalcLeafValuesGivenGradStat(
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA || USE_ROCM #endif // USE_CUDA
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment