Skip to content

Simplifications to Quantile Sketching#12033

Merged
RAMitchell merged 7 commits into
dmlc:masterfrom
RAMitchell:remove-wxqsummary
Feb 25, 2026
Merged

Simplifications to Quantile Sketching#12033
RAMitchell merged 7 commits into
dmlc:masterfrom
RAMitchell:remove-wxqsummary

Conversation

@RAMitchell

Copy link
Copy Markdown
Member

This is a first pass at reducing spaghetti code in quantile sketching. I have removed the version of sketch only used by the approx tree method. If the first is good enough for hist then it is good enough for approx.

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 simplifies the CPU quantile sketching implementation by removing the specialized “approx-tree-only” sketch variant and consolidating usage around a single weighted quantile sketch type.

Changes:

  • Remove WXQSummary / WXQuantileSketch and replace templated sketch/template machinery with a concrete WQuantileSketch.
  • Introduce a standalone Queue and WQSummaryContainer used by WQuantileSketch.
  • Make SketchContainerImpl non-templated and update host/GPU call sites to use the unified sketch type.

Reviewed changes

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

File Description
src/common/quantile.h Consolidates quantile sketch types into WQuantileSketch, introduces new Queue + WQSummaryContainer, updates sorted sketch container integration.
src/common/quantile.cc Removes template instantiations and updates SketchContainerImpl implementations to the new unified sketch types.
src/common/quantile.cuh Updates CUDA-side type aliasing to the new non-templated WQuantileSketch.
src/common/hist_util.cu Updates LimitSizeLevel call site to use WQuantileSketch.

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

Comment thread src/common/quantile.h
Comment thread src/common/quantile.cc
Comment thread src/common/quantile.h Outdated
Comment thread src/common/quantile.h
Comment thread src/common/quantile.h Outdated
Comment thread src/common/quantile.h Outdated
Comment thread src/common/quantile.h
LOG(INFO) << " check quantile stats, nbig=" << nbig << ", n=" << n;
LOG(INFO) << " srcsize=" << src.size << ", maxsize=" << maxsize << ", range=" << range
<< ", chunk=" << chunk;
src.Print();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Print function is no longer used after this PR, maybe remove the definition as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually all of these are unused (!!):
WQSummary::MaxError
WQSummary::Query
WQSummary::MaxRank
WQSummary::MakeFromSorted
WQuantileSketch::PushSummary
WQSummary::Entry::CheckValid
WQSummary::CheckValid
WQuantileSketch::CheckValid

@trivialfis trivialfis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The PR looks good to me.

@RAMitchell
RAMitchell merged commit 0271e60 into dmlc:master Feb 25, 2026
78 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