Skip to content

Commit 0349fc6

Browse files
committed
Tidy up patches
1 parent f0e8fc3 commit 0349fc6

File tree

5 files changed

+144
-178
lines changed

5 files changed

+144
-178
lines changed

recipe/meta.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ source:
1818
- patches/0001-Force-endian-flag-in-cross-compilation-mode.patch # [arm64 or aarch64 or ppc64le]
1919
- patches/0002-Enable-latest-libcxx-on-MacOS.patch # [osx]
2020
- patches/0003-Use-mingw-w64-path.patch
21-
- patches/0004-Undo-dmlc-xgboost-9436.patch
22-
- patches/0005-CMake-Explicitly-link-with-CCCL-standalone-or-CTK.patch
23-
- patches/0006-Partial-fix-for-CTK-12.5-10574.patch
21+
- patches/0004-Backport-fixes.patch
2422

2523
build:
2624
number: {{ build_number }}
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
From 7782edc8e004bd3fe10879c52753d6a6de35947d Mon Sep 17 00:00:00 2001
2+
From: Hyunsu Cho <[email protected]>
3+
Date: Fri, 28 Jun 2024 17:38:34 -0700
4+
Subject: [PATCH] Backport fixes
5+
6+
* Undo dmlc/xgboost#9436
7+
* Explicitly link with CCCL (standalone or CTK) (#10624, #10633)
8+
* Partial fix for CTK 12.5 (#10574)
9+
---
10+
CMakeLists.txt | 27 ++++++++++++++++++---------
11+
cmake/Utils.cmake | 7 +++----
12+
src/tree/updater_gpu_common.cuh | 21 ++++++++-------------
13+
src/tree/updater_gpu_hist.cu | 1 +
14+
4 files changed, 30 insertions(+), 26 deletions(-)
15+
16+
diff --git a/CMakeLists.txt b/CMakeLists.txt
17+
index c4ca82937..aa078405f 100644
18+
--- a/CMakeLists.txt
19+
+++ b/CMakeLists.txt
20+
@@ -224,6 +224,24 @@ if(USE_CUDA)
21+
add_subdirectory(${PROJECT_SOURCE_DIR}/gputreeshap)
22+
23+
find_package(CUDAToolkit REQUIRED)
24+
+ find_package(CCCL CONFIG)
25+
+ if(NOT CCCL_FOUND)
26+
+ message(STATUS "Standalone CCCL not found. Attempting to use CCCL from CUDA Toolkit...")
27+
+ find_package(CCCL CONFIG
28+
+ HINTS ${CUDAToolkit_LIBRARY_DIR}/cmake)
29+
+ if(NOT CCCL_FOUND)
30+
+ message(STATUS "Could not locate CCCL from CUDA Toolkit. Using Thrust and CUB from CUDA Toolkit...")
31+
+ find_package(libcudacxx CONFIG REQUIRED
32+
+ HINTS ${CUDAToolkit_LIBRARY_DIR}/cmake)
33+
+ find_package(CUB CONFIG REQUIRED
34+
+ HINTS ${CUDAToolkit_LIBRARY_DIR}/cmake)
35+
+ find_package(Thrust CONFIG REQUIRED
36+
+ HINTS ${CUDAToolkit_LIBRARY_DIR}/cmake)
37+
+ thrust_create_target(Thrust HOST CPP DEVICE CUDA)
38+
+ add_library(CCCL::CCCL INTERFACE IMPORTED GLOBAL)
39+
+ target_link_libraries(CCCL::CCCL INTERFACE libcudacxx::libcudacxx CUB::CUB Thrust)
40+
+ endif()
41+
+ endif()
42+
endif()
43+
44+
if(FORCE_COLORED_OUTPUT AND (CMAKE_GENERATOR STREQUAL "Ninja") AND
45+
@@ -301,15 +319,6 @@ add_subdirectory(${xgboost_SOURCE_DIR}/plugin)
46+
47+
if(PLUGIN_RMM)
48+
find_package(rmm REQUIRED)
49+
-
50+
- # Patch the rmm targets so they reference the static cudart
51+
- # Remove this patch once RMM stops specifying cudart requirement
52+
- # (since RMM is a header-only library, it should not specify cudart in its CMake config)
53+
- get_target_property(rmm_link_libs rmm::rmm INTERFACE_LINK_LIBRARIES)
54+
- list(REMOVE_ITEM rmm_link_libs CUDA::cudart)
55+
- list(APPEND rmm_link_libs CUDA::cudart_static)
56+
- set_target_properties(rmm::rmm PROPERTIES INTERFACE_LINK_LIBRARIES "${rmm_link_libs}")
57+
- get_target_property(rmm_link_libs rmm::rmm INTERFACE_LINK_LIBRARIES)
58+
endif()
59+
60+
if(PLUGIN_SYCL)
61+
diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake
62+
index d555f5edf..c1f19fdbb 100644
63+
--- a/cmake/Utils.cmake
64+
+++ b/cmake/Utils.cmake
65+
@@ -108,12 +108,12 @@ function(xgboost_set_cuda_flags target)
66+
target_compile_definitions(${target} PRIVATE -DXGBOOST_USE_NVTX=1)
67+
endif()
68+
69+
+ target_link_libraries(${target}
70+
+ PRIVATE CCCL::CCCL CUDA::cudart_static)
71+
target_compile_definitions(${target} PRIVATE -DXGBOOST_USE_CUDA=1)
72+
target_include_directories(
73+
${target} PRIVATE
74+
- ${xgboost_SOURCE_DIR}/gputreeshap
75+
- ${xgboost_SOURCE_DIR}/rabit/include
76+
- ${CUDAToolkit_INCLUDE_DIRS})
77+
+ ${xgboost_SOURCE_DIR}/gputreeshap)
78+
79+
if(MSVC)
80+
target_compile_options(${target} PRIVATE
81+
@@ -240,7 +240,6 @@ macro(xgboost_target_link_libraries target)
82+
83+
if(USE_CUDA)
84+
xgboost_set_cuda_flags(${target})
85+
- target_link_libraries(${target} PUBLIC CUDA::cudart_static)
86+
endif()
87+
88+
if(PLUGIN_RMM)
89+
diff --git a/src/tree/updater_gpu_common.cuh b/src/tree/updater_gpu_common.cuh
90+
index 1c3e6a552..5d999d6d6 100644
91+
--- a/src/tree/updater_gpu_common.cuh
92+
+++ b/src/tree/updater_gpu_common.cuh
93+
@@ -1,18 +1,13 @@
94+
-/*!
95+
- * Copyright 2017-2019 XGBoost contributors
96+
+/**
97+
+ * Copyright 2017-2024, XGBoost contributors
98+
*/
99+
#pragma once
100+
-#include <thrust/random.h>
101+
-#include <cstdio>
102+
-#include <cub/cub.cuh>
103+
-#include <stdexcept>
104+
-#include <string>
105+
-#include <vector>
106+
-#include "../common/categorical.h"
107+
-#include "../common/device_helpers.cuh"
108+
-#include "../common/random.h"
109+
+#include <limits> // for numeric_limits
110+
+#include <ostream> // for ostream
111+
+
112+
#include "gpu_hist/histogram.cuh"
113+
#include "param.h"
114+
+#include "xgboost/base.h"
115+
116+
namespace xgboost::tree {
117+
struct GPUTrainingParam {
118+
@@ -54,8 +49,8 @@ enum DefaultDirection {
119+
};
120+
121+
struct DeviceSplitCandidate {
122+
- float loss_chg {-FLT_MAX};
123+
- DefaultDirection dir {kLeftDir};
124+
+ float loss_chg{-std::numeric_limits<float>::max()};
125+
+ DefaultDirection dir{kLeftDir};
126+
int findex {-1};
127+
float fvalue {0};
128+
// categorical split, either it's the split category for OHE or the threshold for partition-based
129+
diff --git a/src/tree/updater_gpu_hist.cu b/src/tree/updater_gpu_hist.cu
130+
index 958fa0331..e126aeb31 100644
131+
--- a/src/tree/updater_gpu_hist.cu
132+
+++ b/src/tree/updater_gpu_hist.cu
133+
@@ -19,6 +19,7 @@
134+
#include "../common/cuda_context.cuh" // CUDAContext
135+
#include "../common/device_helpers.cuh"
136+
#include "../common/hist_util.h"
137+
+#include "../common/random.h" // for ColumnSampler, GlobalRandom
138+
#include "../common/timer.h"
139+
#include "../data/ellpack_page.cuh"
140+
#include "../data/ellpack_page.h"
141+
--
142+
2.45.2
143+

recipe/patches/0004-Undo-dmlc-xgboost-9436.patch

Lines changed: 0 additions & 45 deletions
This file was deleted.

recipe/patches/0005-CMake-Explicitly-link-with-CCCL-standalone-or-CTK.patch

Lines changed: 0 additions & 65 deletions
This file was deleted.

recipe/patches/0006-Partial-fix-for-CTK-12.5-10574.patch

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)