Skip to content

Commit 2f56e65

Browse files
author
Dmitry Razdoburdin
committed
comments
1 parent 88f246e commit 2f56e65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tree/hist/histogram.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,17 @@ common::BlockedSpace2d ConstructHistSpace(Partitioner const &partitioners,
242242
}
243243
}
244244

245+
// Estimate the size of each data block based on model parameters and L1 capacity
246+
// Each row being processed occupied ~ 32 Bytes in L1:
245247
// a pair of gradients (p_gpair): 2 * sizeof(float)
246248
// an index of row (rid[i]): sizeof(size_t)
247249
// icol_start and icol_end: 2 * sizeof(size_t)
248250
std::size_t l1_row_foot_print = (2 * sizeof(float) + 3 * sizeof(size_t));
249251
double usable_l1_size = 0.8 * l1_size;
250252
std::size_t space_in_l1_for_rows;
251253
if (read_by_column) {
254+
// Estimate, if histogram column can fit L1:
255+
// Maximal number of elements in column is 2^8, 2^16 or 2^32
252256
std::size_t max_elem_in_hist_col = 1u << (8 * gidx.index.GetBinTypeSize());
253257
std::size_t hist_col_size = 2 * sizeof(double) * max_elem_in_hist_col;
254258
bool hist_col_fit_to_l1 = hist_col_size < usable_l1_size;
@@ -261,7 +265,7 @@ common::BlockedSpace2d ConstructHistSpace(Partitioner const &partitioners,
261265
std::size_t hist_size = 2 * sizeof(double) * n_bins;
262266
std::size_t offsets_size = any_missing ? 0 : n_columns * sizeof(uint32_t);
263267

264-
// Prefetch
268+
// Prefetch, conservative estimation
265269
l1_row_foot_print += 2 * sizeof(float);
266270
std::size_t idx_bin_size = n_columns * sizeof(uint32_t);
267271

0 commit comments

Comments
 (0)