Skip to content

Commit f2424de

Browse files
authored
Merge branch 'dmlc:release_3.1.0' into release_3.1.0
2 parents c38f892 + b5d77a0 commit f2424de

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ if(FORCE_COLORED_OUTPUT AND (CMAKE_GENERATOR STREQUAL "Ninja") AND
253253
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
254254
endif()
255255

256-
find_package(Threads REQUIRED)
256+
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Emscripten"))
257+
find_package(Threads REQUIRED)
258+
endif()
257259

258260
# -- OpenMP
259261
include(cmake/FindOpenMPMacOS.cmake)

cmake/Utils.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,12 @@ endmacro()
261261

262262
# handles dependencies
263263
macro(xgboost_target_link_libraries target)
264-
if(BUILD_STATIC_LIB)
265-
target_link_libraries(${target} PUBLIC Threads::Threads ${CMAKE_THREAD_LIBS_INIT})
266-
else()
267-
target_link_libraries(${target} PRIVATE Threads::Threads ${CMAKE_THREAD_LIBS_INIT})
264+
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Emscripten"))
265+
if(BUILD_STATIC_LIB)
266+
target_link_libraries(${target} PUBLIC Threads::Threads ${CMAKE_THREAD_LIBS_INIT})
267+
else()
268+
target_link_libraries(${target} PRIVATE Threads::Threads ${CMAKE_THREAD_LIBS_INIT})
269+
endif()
268270
endif()
269271

270272
if(USE_OPENMP)

plugin/sycl/data/gradient_index.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ void GHistIndexMatrix::SetIndexData(::sycl::queue* qu,
6161
BinIdxType* sort_data = reinterpret_cast<BinIdxType*>(sort_buff.Data());
6262

6363
for (auto &batch : dmat->GetBatches<SparsePage>()) {
64+
batch.data.SetDevice(ctx->Device());
65+
batch.offset.SetDevice(ctx->Device());
6466
const xgboost::Entry *data_ptr = batch.data.ConstDevicePointer();
6567
const bst_idx_t *offset_vec = batch.offset.ConstDevicePointer();
6668
size_t batch_size = batch.Size();

plugin/sycl/predictor/predictor.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ class Predictor : public xgboost::Predictor {
206206
xgboost::Predictor::Predictor{context},
207207
cpu_predictor(xgboost::Predictor::Create("cpu_predictor", context)),
208208
qu_(device_manager.GetQueue(context->Device())),
209-
device_prop_(qu_->get_device()) {}
209+
device_prop_(qu_->get_device()) {
210+
device_model.SetDevice(context->Device());
211+
}
210212

211213
void PredictBatch(DMatrix *dmat, PredictionCacheEntry *predts,
212214
const gbm::GBTreeModel &model, bst_tree_t tree_begin,

src/c_api/c_api.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,9 @@ XGB_DLL int XGBoosterLoadModelFromBuffer(BoosterHandle handle, const void *buf,
15791579
API_BEGIN();
15801580
CHECK_HANDLE();
15811581
xgboost_CHECK_C_ARG_PTR(buf);
1582-
auto buffer = common::Span<char const>{static_cast<char const *>(buf), len};
1582+
using CharT = std::add_const_t<char>;
1583+
using IdxType = common::Span<CharT>::index_type;
1584+
auto buffer = common::Span{static_cast<CharT *>(buf), static_cast<IdxType>(len)};
15831585
// Don't warn, we have to guess the format with buffer input.
15841586
auto in = DispatchModelType(buffer, "", false);
15851587
common::MemoryFixSizeBuffer fs((void *)buf, len); // NOLINT(*)

src/common/threading_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void ParallelFor1d(Index size, std::int32_t n_threads, Func&& fn) {
267267
static_assert(std::is_void_v<std::invoke_result_t<Func, common::Range1d>>);
268268
auto const n_blocks = DivRoundUp(size, kBlockOfRowsSize);
269269
common::ParallelFor(n_blocks, n_threads, [&](auto block_id) {
270-
auto const block_beg = block_id * kBlockOfRowsSize;
270+
std::size_t const block_beg = block_id * kBlockOfRowsSize;
271271
auto const block_size = std::min(static_cast<std::size_t>(size - block_beg), kBlockOfRowsSize);
272272
fn(common::Range1d{block_beg, block_beg + block_size});
273273
});

0 commit comments

Comments
 (0)