Extract histogram builder from CPU Hist. (#7152)

* Extract the CPU histogram builder.
* Fix tests.
* Reduce number of histograms being built.
This commit is contained in:
Jiaming Yuan
2021-08-09 21:15:21 +08:00
committed by GitHub
parent 336af4f974
commit 149f209af6
6 changed files with 647 additions and 676 deletions

View File

@@ -301,7 +301,7 @@ class HistCollection {
// access histogram for i-th node
GHistRowT operator[](bst_uint nid) const {
constexpr uint32_t kMax = std::numeric_limits<uint32_t>::max();
const size_t id = row_ptr_[nid];
const size_t id = row_ptr_.at(nid);
CHECK_NE(id, kMax);
GradientPairT* ptr = nullptr;
if (contiguous_allocation_) {