-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Move header files from include to src.
#11954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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.
|
cc @RAMitchell in case this conflicts with the new design of SHAP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR moves internal header files from the public include/xgboost directory to the src directory to better encapsulate XGBoost's internal implementation details. The headers moved include learner.h, gbm.h, cache.h, and predictor.h, which were previously exposed as part of the public API but were not usable without access to XGBoost's internals.
Changes:
- Moved four internal header files from
include/xgboost/to their respective implementation directories insrc/ - Updated all include paths across test files, source files, and plugins to reference the new locations
- Changed header guards from
#ifndef/#define/#endifstyle to#pragma once - Updated copyright years from 2025 to 2026 for modified files
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cpp/tree/test_prune.cc | Removed unused xgboost/learner.h include |
| tests/cpp/test_serialization.cc | Updated to include ../../src/learner.h instead of xgboost/learner.h |
| tests/cpp/test_multi_target.cc | Updated learner.h include path and reformatted includes |
| tests/cpp/test_learner.cu | Updated learner.h include path |
| tests/cpp/test_learner.cc | Updated learner.h and predictor.h include paths |
| tests/cpp/test_cache.cc | Updated cache.h include path from xgboost/cache.h to ../../src/common/cache.h |
| tests/cpp/predictor/test_predictor.h | Updated predictor.h include path |
| tests/cpp/predictor/test_predictor.cc | Updated predictor.h include path |
| tests/cpp/predictor/test_gpu_predictor.cu | Updated learner.h and predictor.h include paths |
| tests/cpp/predictor/test_cpu_predictor.cc | Updated predictor.h include path |
| tests/cpp/plugin/test_sycl_predictor.cc | Updated predictor.h include path |
| tests/cpp/linear/test_linear.cu | Removed unused xgboost/gbm.h include |
| tests/cpp/linear/test_linear.cc | Removed xgboost/gbm.h and added ../../../src/gbm/gblinear_model.h |
| tests/cpp/helpers.h | Updated learner.h include path |
| tests/cpp/helpers.cc | Updated learner.h, gbm.h, and predictor.h include paths |
| tests/cpp/gbm/test_gbtree.cu | Updated learner.h include path |
| tests/cpp/gbm/test_gbtree.cc | Updated learner.h and predictor.h include paths |
| tests/cpp/gbm/test_gblinear.cu | Updated learner.h include path |
| tests/cpp/gbm/test_gblinear.cc | Updated gbm.h and learner.h include paths |
| tests/cpp/common/test_categorical.cc | Updated learner.h include path |
| tests/cpp/c_api/test_c_api.cc | Updated learner.h include path |
| src/predictor/utils.h | Updated learner.h to use relative path ../learner.h |
| src/predictor/predictor.h | Moved from include, changed to #pragma once, updated cache.h path |
| src/predictor/predictor.cc | Updated to include local predictor.h and relative learner.h path |
| src/predictor/gpu_predictor.cu | Updated to include local predictor.h |
| src/predictor/cpu_predictor.cc | Updated learner.h and predictor.h to use relative paths |
| src/metric/rank_metric.cc | Updated cache.h include path from xgboost/cache.h to ../common/cache.h |
| src/learner.h | Moved from include, changed to #pragma once |
| src/learner.cc | Updated to include local learner.h and relative predictor.h path |
| src/gbm/gbtree_model.h | Updated learner.h to use relative path ../learner.h |
| src/gbm/gbtree_model.cc | Updated learner.h to use relative path |
| src/gbm/gbtree.h | Updated gbm.h and predictor.h to use relative paths |
| src/gbm/gbtree.cc | Updated gbm.h and predictor.h to use relative paths |
| src/gbm/gbm.h | Moved from include, changed to #pragma once |
| src/gbm/gbm.cc | Updated to include local gbm.h and relative learner.h path |
| src/gbm/gblinear_model.h | Updated learner.h to use relative path ../learner.h |
| src/gbm/gblinear.cc | Updated gbm.h, learner.h, and predictor.h to use relative paths |
| src/data/data.cc | Updated learner.h to use relative path ../learner.h |
| src/common/cache.h | Moved from include, changed to #pragma once |
| src/common/api_entry.h | Updated predictor.h to use relative path ../predictor/predictor.h |
| src/c_api/c_api_utils.h | Updated learner.h to use relative path ../learner.h |
| src/c_api/c_api.cu | Updated learner.h to use relative path |
| src/c_api/c_api.cc | Updated learner.h to use relative path, removed predictor.h include |
| plugin/sycl/predictor/predictor.cc | Updated predictor.h to use relative path ../../../src/predictor/predictor.h |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Have you considered putting internal headers to |
|
Yes. We will have to add a set of sub directories into |
|
Using Or we should probably consider adding |
We have a semi-working C++ "interface" that's not really an interface. Some files are impossible to use without hacking XGBoost's internals due to forward declarations.
This PR hides the following files to reduce confusion and to reduce the need for broken forward declarations:
Aside from automated header sorting, I did not make many changes. This is to ensure Git recognizes this PR as a simple rename.