Skip to content

Commit 809fdf8

Browse files
committed
Move header files from include to src.
We have a semi-working C++ "interface" that's not really an interface. Some files are impossible to be used without hacking inside XGBoost. This PR hides the following files to reduce confusion and to reduce the need for broken forward declarations: - learner.h - gbm.h - cache.h - predictor.h Aside from automated headers sorting, I did not make much change, to make sure git recognize this PR is doing a simple rename.
1 parent ff84c71 commit 809fdf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+153
-161
lines changed

plugin/sycl/predictor/predictor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Copyright by Contributors 2017-2025
2+
* Copyright by Contributors 2017-2026
33
*/
44
#pragma GCC diagnostic push
55
#pragma GCC diagnostic ignored "-Wtautological-constant-compare"
@@ -17,7 +17,7 @@
1717
#include "dmlc/registry.h"
1818

1919
#include "xgboost/tree_model.h"
20-
#include "xgboost/predictor.h"
20+
#include "../../../src/predictor/predictor.h"
2121
#include "xgboost/tree_updater.h"
2222
#include "../../../src/common/timer.h"
2323

src/c_api/c_api.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2014-2025, XGBoost Contributors
2+
* Copyright 2014-2026, XGBoost Contributors
33
*/
44
#include "xgboost/c_api.h"
55

@@ -29,6 +29,7 @@
2929
#include "../data/proxy_dmatrix.h" // for DMatrixProxy
3030
#include "../data/simple_dmatrix.h" // for SimpleDMatrix
3131
#include "../encoder/types.h" // for Overloaded
32+
#include "../learner.h" // for Learner, PredictionType
3233
#include "c_api_error.h" // for xgboost_CHECK_C_ARG_PTR, API_END, API_BEGIN
3334
#include "c_api_utils.h" // for RequiredArg, OptionalArg, GetMissing, CastDM...
3435
#include "dmlc/base.h" // for BeginPtr
@@ -42,9 +43,7 @@
4243
#include "xgboost/global_config.h" // for GlobalConfiguration, GlobalConfigThreadLocal...
4344
#include "xgboost/host_device_vector.h" // for HostDeviceVector
4445
#include "xgboost/json.h" // for Json, get, Integer, IsA, Boolean, String
45-
#include "xgboost/learner.h" // for Learner, PredictionType
4646
#include "xgboost/logging.h" // for LOG_FATAL, LogMessageFatal, CHECK, LogCheck_EQ
47-
#include "xgboost/predictor.h" // for PredictionCacheEntry
4847
#include "xgboost/span.h" // for Span
4948
#include "xgboost/string_view.h" // for StringView, operator<<
5049
#include "xgboost/version_config.h" // for XGBOOST_VER_MAJOR, XGBOOST_VER_MINOR, XGBOOS...

src/c_api/c_api.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2019-2025, XGBoost Contributors
2+
* Copyright 2019-2026, XGBoost Contributors
33
*/
44
#include <thrust/transform.h> // for transform
55

@@ -13,7 +13,7 @@
1313
#include "xgboost/c_api.h"
1414
#include "xgboost/data.h"
1515
#include "xgboost/json.h"
16-
#include "xgboost/learner.h"
16+
#include "../learner.h" // for Learner
1717
#if defined(XGBOOST_USE_NCCL)
1818
#include <nccl.h>
1919
#endif // defined(XGBOOST_USE_NCCL)

src/c_api/c_api_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2021-2024, XGBoost Contributors
2+
* Copyright 2021-2026, XGBoost Contributors
33
*/
44
#ifndef XGBOOST_C_API_C_API_UTILS_H_
55
#define XGBOOST_C_API_C_API_UTILS_H_
@@ -19,7 +19,7 @@
1919
#include "xgboost/data.h" // DMatrix
2020
#include "xgboost/feature_map.h" // for FeatureMap
2121
#include "xgboost/json.h"
22-
#include "xgboost/learner.h"
22+
#include "../learner.h" // for Learner
2323
#include "xgboost/linalg.h" // ArrayInterfaceHandler, MakeTensorView, ArrayInterfaceStr
2424
#include "xgboost/logging.h"
2525
#include "xgboost/string_view.h" // StringView

src/common/api_entry.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
/**
2-
* Copyright 2016-2023 by XGBoost contributors
2+
* Copyright 2016-2026, XGBoost contributors
33
*/
44
#ifndef XGBOOST_COMMON_API_ENTRY_H_
55
#define XGBOOST_COMMON_API_ENTRY_H_
6-
#include <string> // std::string
7-
#include <vector> // std::vector
86

9-
#include "xgboost/base.h" // GradientPair,bst_ulong
10-
#include "xgboost/predictor.h" // PredictionCacheEntry
7+
#include <string> // for string
8+
#include <vector> // for vector
9+
10+
#include "../predictor/predictor.h" // PredictionCacheEntry
11+
#include "xgboost/base.h" // GradientPair,bst_ulong
1112

1213
namespace xgboost {
1314
/**
14-
* \brief entry to to easily hold returning information
15+
* @brief entry to to easily hold returning information
1516
*/
1617
struct XGBAPIThreadLocalEntry {
1718
/*! \brief result holder for returning string */
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/**
2-
* Copyright 2023 by XGBoost contributors
2+
* Copyright 2023-2026, XGBoost contributors
33
*/
4-
#ifndef XGBOOST_CACHE_H_
5-
#define XGBOOST_CACHE_H_
6-
4+
#pragma once
75
#include <xgboost/logging.h> // for CHECK_EQ, CHECK
86

97
#include <cstddef> // for size_t
@@ -201,4 +199,3 @@ class DMatrixCache {
201199
}
202200
};
203201
} // namespace xgboost
204-
#endif // XGBOOST_CACHE_H_

src/data/data.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2025, XGBoost Contributors
2+
* Copyright 2015-2026, XGBoost Contributors
33
* \file data.cc
44
*/
55
#include "xgboost/data.h"
@@ -52,7 +52,7 @@
5252
#include "xgboost/base.h" // for bst_group_t, bst_idx_t, bst_float, bst_ulong
5353
#include "xgboost/context.h" // for Context
5454
#include "xgboost/host_device_vector.h" // for HostDeviceVector
55-
#include "xgboost/learner.h" // for HostDeviceVector
55+
#include "../learner.h" // for Learner
5656
#include "xgboost/linalg.h" // for Tensor, Stack, TensorView, Vector, ArrayInte...
5757
#include "xgboost/logging.h" // for Error, LogCheck_EQ, CHECK, CHECK_EQ, LOG
5858
#include "xgboost/span.h" // for Span, operator!=, SpanIterator

src/gbm/gblinear.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2014-2025, XGBoost Contributors
2+
* Copyright 2014-2026, XGBoost Contributors
33
* \file gblinear.cc
44
* \brief Implementation of Linear booster, with L1/L2 regularization: Elastic Net
55
* the update rule is parallel coordinate descent (shotgun)
@@ -17,13 +17,13 @@
1717
#include "../common/threading_utils.h"
1818
#include "../common/timer.h"
1919
#include "gblinear_model.h"
20-
#include "xgboost/gbm.h"
20+
#include "gbm.h" // for GradientContainer
2121
#include "xgboost/json.h"
22-
#include "xgboost/learner.h"
22+
#include "../learner.h" // for LearnerModelParam
2323
#include "xgboost/linalg.h"
2424
#include "xgboost/linear_updater.h"
2525
#include "xgboost/logging.h"
26-
#include "xgboost/predictor.h"
26+
#include "../predictor/predictor.h" // for Predictor
2727

2828
namespace xgboost::gbm {
2929
DMLC_REGISTRY_FILE_TAG(gblinear);

src/gbm/gblinear_model.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* Copyright 2018-2025, XGBoost Contributors
2+
* Copyright 2018-2026, XGBoost Contributors
33
*/
44
#pragma once
55
#include <dmlc/io.h>
66
#include <dmlc/parameter.h>
7-
#include <xgboost/learner.h>
7+
#include "../learner.h" // for LearnerModelParam
88

99
#include <vector>
1010
#include <string>

src/gbm/gbm.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
2-
* Copyright 2015-2025, XGBoost Contributors
2+
* Copyright 2015-2026, XGBoost Contributors
33
* \file gbm.cc
44
* \brief Registry of gradient boosters.
55
*/
6-
#include "xgboost/gbm.h"
6+
#include "gbm.h"
77

88
#include <dmlc/registry.h>
99

1010
#include <string>
1111

1212
#include "xgboost/context.h"
13-
#include "xgboost/learner.h"
13+
#include "../learner.h" // for LearnerModelParam
1414

1515
namespace dmlc {
1616
DMLC_REGISTRY_ENABLE(::xgboost::GradientBoosterReg);

0 commit comments

Comments
 (0)