Skip to content

Use context for thrust caching policy.#12191

Merged
trivialfis merged 3 commits into
dmlc:masterfrom
trivialfis:replace-caching-policy
Apr 29, 2026
Merged

Use context for thrust caching policy.#12191
trivialfis merged 3 commits into
dmlc:masterfrom
trivialfis:replace-caching-policy

Conversation

@trivialfis
Copy link
Copy Markdown
Member

Replace all existing use of the free function.

Replace all existing use of the free function.
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

Updates GPU-side Thrust usage to rely on the CUDA Context/CUDAContext for the caching execution policy (instead of a free helper), ensuring Thrust operations consistently use the context’s allocator and stream.

Changes:

  • Remove the dh::CachingThrustPolicy() free function from device_helpers.cuh.
  • Update FeatureInteractionConstraintDevice::Split to accept a Context and use ctx->CUDACtx()->CTP() for the Thrust fill.
  • Update call sites (GPU hist updater + CUDA tests) to pass a CUDA context and use CTP() where needed.

Reviewed changes

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

Show a summary per file
File Description
tests/cpp/tree/test_constraints.cu Create CUDA context in GPU constraint tests and pass it into Split/QueryNode; minor formatting cleanups.
tests/cpp/common/test_device_vector.cu Use ctx.CUDACtx()->CTP() for Thrust algorithms in tests; add required includes/helpers.
src/tree/updater_gpu_hist.cu Pass ctx_ into interaction-constraint Split during tree expansion.
src/tree/constraints.cুহ Update FeatureInteractionConstraintDevice::Split signature to accept Context const*.
src/tree/constraints.cu Use ctx->CUDACtx()->CTP() for the buffer clear after split.
src/common/device_helpers.cuh Remove CachingThrustPolicy() helper.

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

@trivialfis trivialfis merged commit 26a1379 into dmlc:master Apr 29, 2026
80 checks passed
@trivialfis trivialfis deleted the replace-caching-policy branch April 29, 2026 10:30
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