Skip to content

[mt] Implement prediction cache.#11862

Merged
trivialfis merged 4 commits into
dmlc:masterfrom
trivialfis:mt-prediction-cache
Dec 12, 2025
Merged

[mt] Implement prediction cache.#11862
trivialfis merged 4 commits into
dmlc:masterfrom
trivialfis:mt-prediction-cache

Conversation

@trivialfis

@trivialfis trivialfis commented Dec 11, 2025

Copy link
Copy Markdown
Member
  • Implement the prediction cache for vector leaf.
  • Skip histogram build for leaf nodes.

ref #9043

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 implements prediction cache support for multi-target trees in the GPU histogram tree builder. The prediction cache stores the final node positions for training samples, enabling faster prediction updates without having to traverse the tree for each prediction.

Key Changes

  • Added positions_ member variable to cache node indices for each sample in multi-target training
  • Implemented FinalizePosition method to compute and store final leaf positions after tree construction
  • Implemented UpdatePredictionCache method to update predictions using cached positions
  • Refactored histogram allocation logic by changing force_global flag from true to false for better memory efficiency

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/tree/updater_gpu_hist.cuh Added prediction cache infrastructure for multi-target trees including positions storage, FinalizePosition and UpdatePredictionCache methods
src/tree/updater_gpu_hist.cu Updated UpdatePredictionCache to support both single-target and multi-target trees, improved variable naming consistency (d_matrix → d_acc), and enhanced code comments
src/tree/gpu_hist/histogram.cuh Refactored subtraction logic by extracting CanSubtract helper method for improved code organization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tree/updater_gpu_hist.cuh
Comment thread src/tree/updater_gpu_hist.cuh
Comment thread src/tree/updater_gpu_hist.cuh
Comment thread src/tree/updater_gpu_hist.cuh Outdated
@trivialfis
trivialfis marked this pull request as ready for review December 12, 2025 15:55
@trivialfis

Copy link
Copy Markdown
Member Author

cc @rongou

@trivialfis trivialfis mentioned this pull request Dec 12, 2025
48 tasks
@trivialfis
trivialfis merged commit e8fa612 into dmlc:master Dec 12, 2025
86 of 89 checks passed
@trivialfis
trivialfis deleted the mt-prediction-cache branch December 12, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants