Skip to content

Avoid the use of restrict in the evaluator.#11540

Merged
trivialfis merged 1 commit into
dmlc:masterfrom
trivialfis:remove-restrict
Jul 1, 2025
Merged

Avoid the use of restrict in the evaluator.#11540
trivialfis merged 1 commit into
dmlc:masterfrom
trivialfis:remove-restrict

Conversation

@trivialfis

@trivialfis trivialfis commented Jun 30, 2025

Copy link
Copy Markdown
Member

It somehow caches the written value in the registry, resulting in an incorrect value in the second iteration of the scan.

No performance loss is observed.

@trivialfis trivialfis requested a review from Copilot June 30, 2025 18:38
@trivialfis

Copy link
Copy Markdown
Member Author

cc @rongou .

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 removes the __restrict__ qualifier from evaluator methods to avoid caching the written best_split pointer in the GPU register and ensure correct behavior across iterations.

  • Dropped __restrict__ on DeviceSplitCandidate* best_split parameters in four evaluator routines
  • Verified no observable performance regression after removal
Comments suppressed due to low confidence (4)

src/tree/gpu_hist/evaluate_splits.cu:113

  • [nitpick] Pointer declarator spacing is inconsistent; consider standardizing to either DeviceSplitCandidate* best_split or DeviceSplitCandidate *best_split across all methods for consistency.
  __device__ __forceinline__ void Numerical(DeviceSplitCandidate * best_split) {

src/tree/gpu_hist/evaluate_splits.cu:148

  • [nitpick] Pointer declarator spacing is inconsistent; consider standardizing to either DeviceSplitCandidate* best_split or DeviceSplitCandidate *best_split across all methods for consistency.
  __device__ __forceinline__ void OneHot(DeviceSplitCandidate *best_split) {

src/tree/gpu_hist/evaluate_splits.cu:184

  • [nitpick] Pointer declarator spacing is inconsistent; consider standardizing to either DeviceSplitCandidate* best_split or DeviceSplitCandidate *best_split across all methods for consistency.
                                                  DeviceSplitCandidate *best_split) {

src/tree/gpu_hist/evaluate_splits.cu:207

  • [nitpick] Pointer declarator spacing is inconsistent; consider standardizing to either DeviceSplitCandidate* best_split or DeviceSplitCandidate *best_split across all methods for consistency.
  __device__ __forceinline__ void Partition(DeviceSplitCandidate *best_split,

@trivialfis trivialfis merged commit 32e5976 into dmlc:master Jul 1, 2025
59 of 61 checks passed
@trivialfis trivialfis deleted the remove-restrict branch July 1, 2025 07:19
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