Skip to content

Remove reintroduced GPU sketch memory estimation#12159

Merged
RAMitchell merged 1 commit intodmlc:masterfrom
RAMitchell:gpu-remove-memory-estimation
Apr 13, 2026
Merged

Remove reintroduced GPU sketch memory estimation#12159
RAMitchell merged 1 commit intodmlc:masterfrom
RAMitchell:gpu-remove-memory-estimation

Conversation

@RAMitchell
Copy link
Copy Markdown
Member

Summary

This removes the GPU sketch memory-estimation path that was accidentally reintroduced after #12118.

The GPU sketch batching policy goes back to the fixed 64M sliding-window size:

  • no RequiredMemory(...)
  • no SketchBatchNumElements(...)
  • no batch-size override plumbing on DeviceSketch* / AdapterDeviceSketch

What Changed

  • remove the estimator helpers and related API surface from src/common/hist_util.cuh and src/common/hist_util.cu
  • restore fixed-window batching with detail::kSketchBatchNumElements
  • remove the estimator-specific batch override test from tests/cpp/common/test_hist_util.cu
  • make the fixed-window path a bit more robust:
    • DeviceSketchWithHessian(...) no longer depends on info.num_nonzero_ for loop progress
    • AdapterDeviceSketch(...) sizes the last window from the true remaining elements

Testing

  • configured and rebuilt testxgboost with CUDA
  • ran the focused GPU sketch / adapter / external-memory / hessian slice

Result:

  • 66/66 passed

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the accidentally reintroduced GPU sketch memory-estimation code path and restores a fixed 64M-element sliding-window batching policy for GPU sketching.

Changes:

  • Deleted memory-estimation helpers/APIs (RequiredMemory, SketchBatchNumElements, batch-size override plumbing) and reverted to a fixed detail::kSketchBatchNumElements window size.
  • Updated GPU sketching implementations to use fixed-window batching (including more robust last-window sizing for adapter sketching).
  • Removed the estimator-specific batch override test and updated hessian-sketch tests to match the simplified API.

Reviewed changes

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

File Description
src/common/hist_util.cuh Removes estimator-related declarations/API surface; introduces fixed batch constant; simplifies DeviceSketch*/AdapterDeviceSketch interfaces.
src/common/hist_util.cu Deletes estimator implementations and uses fixed batch size in DeviceSketchWithHessian batching loop.
tests/cpp/common/test_hist_util.cu Removes batch-override test coverage and updates call sites to the new fixed-batch API.
Comments suppressed due to low confidence (1)

src/common/hist_util.cuh:369

  • The comment mentions an "estimation of sketch_batch_num_elements" assuming dense input, but sketch_batch_num_elements is now a fixed constant (clamped to remaining). Update the wording to refer to the dense assumption used when computing approx_n_samples, or remove the outdated phrasing to avoid confusion.
    // Re-estimate the needed number of cuts based on the size of the sub-batch.
    //
    // The estimation of `sketch_batch_num_elements` assumes dense input, so the
    // approximation here is reasonably accurate. It doesn't hurt accuracy since the
    // estimated n_samples must be greater or equal to the actual n_samples thanks to the

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

@RAMitchell RAMitchell merged commit b3130a8 into dmlc:master Apr 13, 2026
82 checks passed
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