Skip to content

Commit e946a4b

Browse files
authored
Fix CPU inplace predict performance regression. (#11621)
1 parent 3f56c33 commit e946a4b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/predictor/cpu_predictor.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -820,23 +820,16 @@ class CPUPredictor : public Predictor {
820820
CHECK_EQ(p_m->Info().num_col_, x->NumColumns());
821821
this->InitOutPredictions(p_m->Info(), &(out_preds->predictions), model);
822822

823-
bool blocked = ShouldUseBlock(p_m.get());
824-
825823
auto &predictions = out_preds->predictions.HostVector();
826824
std::vector<RegTree::FVec> thread_temp;
827-
InitThreadTemp(n_threads * (blocked ? kBlockOfRowsSize : 1), &thread_temp);
825+
InitThreadTemp(n_threads * kBlockOfRowsSize, &thread_temp);
828826
bst_idx_t n_groups = model.learner_model_param->OutputLength();
829827
auto out_predt = linalg::MakeTensorView(ctx_, predictions, x->NumRows(), n_groups);
830828

831829
auto launch = [&](auto &&acc) {
832830
auto view = AdapterView{x.get(), missing, acc};
833-
if (blocked) {
834-
PredictBatchByBlockKernel<kBlockOfRowsSize>(view, model, tree_begin, tree_end,
835-
&thread_temp, n_threads, out_predt);
836-
} else {
837-
PredictBatchByBlockKernel<1>(view, model, tree_begin, tree_end, &thread_temp,
838-
n_threads, out_predt);
839-
}
831+
PredictBatchByBlockKernel<kBlockOfRowsSize>(view, model, tree_begin, tree_end,
832+
&thread_temp, n_threads, out_predt);
840833
};
841834

842835
if constexpr (std::is_same_v<AdapterT, data::ColumnarAdapter>) {

0 commit comments

Comments
 (0)