Reduce compiler warnings on CPU-only build. (#8483)

This commit is contained in:
Jiaming Yuan
2022-11-29 00:04:16 +08:00
committed by GitHub
parent d666ba775e
commit 3fc1046fd3
12 changed files with 69 additions and 83 deletions

View File

@@ -734,9 +734,7 @@ void MetaInfo::Validate(int32_t device) const {
}
#if !defined(XGBOOST_USE_CUDA)
void MetaInfo::SetInfoFromCUDA(Context const& ctx, StringView key, Json arr) {
common::AssertGPUSupport();
}
void MetaInfo::SetInfoFromCUDA(Context const&, StringView, Json) { common::AssertGPUSupport(); }
#endif // !defined(XGBOOST_USE_CUDA)
using DMatrixThreadLocal =

View File

@@ -12,7 +12,7 @@ class EllpackPageImpl {};
EllpackPage::EllpackPage() = default;
EllpackPage::EllpackPage(DMatrix* dmat, const BatchParam& param) {
EllpackPage::EllpackPage(DMatrix*, const BatchParam&) {
LOG(FATAL) << "Internal Error: XGBoost is not compiled with CUDA but "
"EllpackPage is required";
}
@@ -22,7 +22,7 @@ EllpackPage::~EllpackPage() {
"EllpackPage is required";
}
void EllpackPage::SetBaseRowId(size_t row_id) {
void EllpackPage::SetBaseRowId(std::size_t) {
LOG(FATAL) << "Internal Error: XGBoost is not compiled with CUDA but "
"EllpackPage is required";
}

View File

@@ -25,7 +25,7 @@ EllpackPage::EllpackPage(EllpackPage&& that) { std::swap(impl_, that.impl_); }
size_t EllpackPage::Size() const { return impl_->Size(); }
void EllpackPage::SetBaseRowId(size_t row_id) { impl_->SetBaseRowId(row_id); }
void EllpackPage::SetBaseRowId(std::size_t row_id) { impl_->SetBaseRowId(row_id); }
// Bin each input data entry, store the bin indices in compressed form.
__global__ void CompressBinEllpackKernel(

View File

@@ -190,7 +190,7 @@ class EllpackPageImpl {
size_t Size() const;
/*! \brief Set the base row id for this page. */
void SetBaseRowId(size_t row_id) {
void SetBaseRowId(std::size_t row_id) {
base_rowid = row_id;
}

View File

@@ -19,7 +19,7 @@ const MetaInfo &SparsePageDMatrix::Info() const { return info_; }
namespace detail {
// Use device dispatch
size_t NSamplesDevice(DMatrixProxy *proxy)
std::size_t NSamplesDevice(DMatrixProxy *)
#if defined(XGBOOST_USE_CUDA)
; // NOLINT
#else
@@ -28,7 +28,7 @@ size_t NSamplesDevice(DMatrixProxy *proxy)
return 0;
}
#endif
size_t NFeaturesDevice(DMatrixProxy *proxy)
std::size_t NFeaturesDevice(DMatrixProxy *)
#if defined(XGBOOST_USE_CUDA)
; // NOLINT
#else
@@ -189,7 +189,7 @@ BatchSet<GHistIndexMatrix> SparsePageDMatrix::GetGradientIndex(const BatchParam
}
#if !defined(XGBOOST_USE_CUDA)
BatchSet<EllpackPage> SparsePageDMatrix::GetEllpackBatches(const BatchParam& param) {
BatchSet<EllpackPage> SparsePageDMatrix::GetEllpackBatches(const BatchParam &) {
common::AssertGPUSupport();
auto begin_iter = BatchIterator<EllpackPage>(ellpack_page_source_);
return BatchSet<EllpackPage>(BatchIterator<EllpackPage>(begin_iter));

View File

@@ -9,11 +9,11 @@ namespace xgboost {
namespace data {
namespace detail {
size_t NSamplesDevice(DMatrixProxy *proxy) {
std::size_t NSamplesDevice(DMatrixProxy *proxy) {
return Dispatch(proxy, [](auto const &value) { return value.NumRows(); });
}
size_t NFeaturesDevice(DMatrixProxy *proxy) {
std::size_t NFeaturesDevice(DMatrixProxy *proxy) {
return Dispatch(proxy, [](auto const &value) { return value.NumCols(); });
}
} // namespace detail