Skip to content

Avoid overflow in rounding estimation.#11910

Merged
trivialfis merged 2 commits into
dmlc:masterfrom
trivialfis:avoid-of
Jan 5, 2026
Merged

Avoid overflow in rounding estimation.#11910
trivialfis merged 2 commits into
dmlc:masterfrom
trivialfis:avoid-of

Conversation

@trivialfis

Copy link
Copy Markdown
Member

No description provided.

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 addresses a potential integer overflow issue in the rounding estimation algorithm by changing the parameter type of CreateRoundingFactor from int to bst_idx_t (uint64_t), allowing it to handle datasets with more than 2.1 billion rows without overflow.

Key changes:

  • Updated CreateRoundingFactor to accept bst_idx_t instead of int for the row count parameter, preventing overflow for large datasets
  • Changed gradient pair types in histogram computation from GradientPair to GradientPairPrecise for improved numerical precision
  • Modernized initialization syntax from parentheses to braces for gradient pair construction

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/common/deterministic.cuh Updated CreateRoundingFactor parameter from int to bst_idx_t to handle large row counts; updated copyright year and improved include comments
src/tree/gpu_hist/histogram.cu Changed gradient pair types to GradientPairPrecise for higher precision and modernized initialization syntax to use braces instead of parentheses

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

@trivialfis

Copy link
Copy Markdown
Member Author

cc @rongou

@trivialfis
trivialfis merged commit f5ff41e into dmlc:master Jan 5, 2026
65 checks passed
@trivialfis
trivialfis deleted the avoid-of branch January 5, 2026 19:45
@trivialfis trivialfis mentioned this pull request Jan 5, 2026
10 tasks
trivialfis added a commit to trivialfis/xgboost that referenced this pull request Jan 6, 2026
trivialfis added a commit to trivialfis/xgboost that referenced this pull request Jan 7, 2026
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