Skip to content

Avoid reduction overhead in hash join probe kernels - #24706

Open
PointKernel wants to merge 2 commits into
NVIDIA:mainfrom
PointKernel:fix/hash-join-probe-kernel-performance
Open

PointKernel wants to merge 2 commits into
NVIDIA:mainfrom
PointKernel:fix/hash-join-probe-kernel-performance

Conversation

@PointKernel

Copy link
Copy Markdown
Member

Description

Follow-up to #24637. Match contexts and join retrieval pass a null total_matches pointer, but the runtime guard still gives their probe kernel the register and shared-memory footprint of the fused size reduction.

Select separate sum and no-sum kernel specializations in the host launcher. Match contexts, ordinary retrieval, and partitioned retrieval use a kernel without the sum accumulator or block reduction, while size queries retain the fused reduction and its memory savings. Both specializations keep the same probing and full-join bookkeeping logic.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Select separate sum and no-sum kernel specializations on the host so
match contexts and join retrieval do not reserve reduction resources.
Retain the fused reduction for size queries and shared probing logic.
@copy-pr-bot

copy-pr-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Oct 20, 2026
@PointKernel PointKernel added Performance Performance related issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Oct 20, 2026
@PointKernel

Copy link
Copy Markdown
Member Author

/ok to test

@PointKernel

PointKernel commented Oct 20, 2026 •

Copy link
Copy Markdown
Member Author

Before/after performance for match-count contexts and partitioned joins, using nvbench_compare.py. One row per benchmark configuration; means and standard deviations are pooled from the existing 500 samples per configuration, including variation between runs.

Ref: merged #24637 (d625effc8b). Cmp: 53bd4916d1; current head ee54fb66f8 has identical join source. RTX PRO 6000 Blackwell, CUDA 13.3.73, GCC 14.3, Release sm120; clocks unlocked, no foreign GPU compute overlap observed.

left_size/right_size are probe/build rows; Nullable=1 means nullable. Negative %Diff means faster. pr24637_probe is the custom follow-up benchmark; inner_join is the stock benchmark.

python python/scripts/nvbench_compare.py --no-color baseline.json candidate.json

[0] NVIDIA RTX PRO 6000 Blackwell Workstation Edition

Nullable DataType left_size right_size num_keys multiplicity selectivity kind mode nulls Ref Time Ref Noise Cmp Time Cmp Noise Diff %Diff Status
1 INT32 10000000 100000 1 1 0.1 inner context unequal 177.812 us 1.68% 160.400 us 2.45% -17.413 us -9.79% 🟢 FAST
1 INT32 10000000 100000 1 1 0.1 left context unequal 179.140 us 1.65% 160.686 us 1.49% -18.454 us -10.30% 🟢 FAST
0 INT32 10000000 100000 1 1 0.1 left context unequal 205.921 us 0.98% 190.597 us 3.94% -15.324 us -7.44% 🟢 FAST
0 INT32 10000000 100000 1 1 0.1 inner context unequal 205.773 us 2.18% 187.277 us 1.63% -18.496 us -8.99% 🟢 FAST
1 INT32 10000000 100000 1 1 0.1 inner partitioned unequal 578.406 us 2.60% 543.241 us 2.25% -35.165 us -6.08% 🟢 FAST
0 INT32 10000000 100000 1 1 0.1 inner partitioned unequal 642.552 us 1.20% 613.061 us 3.37% -29.491 us -4.59% 🟢 FAST
1 INT32 10000000 100000 1 1 0.1 left partitioned unequal 710.642 us 3.83% 673.815 us 0.89% -36.827 us -5.18% 🟢 FAST
0 INT32 10000000 100000 1 1 0.1 left partitioned unequal 770.522 us 5.59% 736.486 us 5.56% -34.036 us -4.42% 🔵 SAME
0 STRING 10000000 100000 1 1 0.1 left context unequal 482.793 us 0.62% 458.734 us 0.58% -24.060 us -4.98% 🟢 FAST
1 STRING 10000000 100000 1 1 0.1 inner context unequal 475.375 us 0.80% 453.749 us 0.82% -21.627 us -4.55% 🟢 FAST
1 STRING 10000000 100000 1 1 0.1 left context unequal 477.565 us 0.68% 453.496 us 0.80% -24.070 us -5.04% 🟢 FAST
0 STRING 10000000 100000 1 1 0.1 inner context unequal 479.975 us 0.52% 458.313 us 0.59% -21.662 us -4.51% 🟢 FAST
0 INT32 10000000 100000 1 1 0.9 left context unequal 281.123 us 1.22% 284.581 us 1.04% 3.458 us 1.23% 🔴 SLOW
1 INT32 10000000 100000 1 1 0.9 left context unequal 237.922 us 0.98% 240.304 us 2.86% 2.382 us 1.00% 🔴 SLOW
0 LIST 100000 10000 1 1 0.3 inner context unequal 101.342 us 2.05% 100.661 us 2.07% -0.681 us -0.67% 🔵 SAME
0 LIST 100000 10000 1 1 0.3 left partitioned unequal 224.868 us 1.81% 226.929 us 2.57% 2.061 us 0.92% 🔵 SAME
1 LIST 100000 10000 1 1 0.3 full context unequal 128.141 us 2.64% 130.185 us 4.34% 2.044 us 1.60% 🔵 SAME
1 LIST 257 1000 1 1 0.3 inner context equal 52.951 us 6.30% 52.734 us 6.77% -0.218 us -0.41% 🔵 SAME
1 LIST 257 1000 1 1 0.3 left partitioned equal 162.421 us 3.43% 163.681 us 3.78% 1.259 us 0.78% 🔵 SAME
0 STRUCT 100000 10000 1 1 0.3 inner context unequal 214.525 us 4.23% 214.441 us 2.56% -0.084 us -0.04% 🔵 SAME
0 STRUCT 100000 10000 1 1 0.3 left partitioned unequal 473.896 us 2.28% 488.446 us 8.45% 14.551 us 3.07% 🔴 SLOW
1 STRUCT 100000 10000 1 1 0.3 full context unequal 340.246 us 3.67% 343.640 us 13.12% 3.394 us 1.00% 🔵 SAME
1 STRUCT 257 1000 1 1 0.3 inner context equal 309.042 us 2.49% 311.036 us 3.61% 1.994 us 0.65% 🔵 SAME
1 STRUCT 257 1000 1 1 0.3 left partitioned equal 673.450 us 2.84% 668.010 us 5.63% -5.440 us -0.81% 🔵 SAME
0 INT32 10000000 100000 1 1 0.1 full partitioned unequal 862.674 us 1.73% 826.637 us 1.35% -36.037 us -4.18% 🟢 FAST
1 INT32 10000000 100000 1 1 0.1 full partitioned unequal 804.291 us 0.72% 774.667 us 2.49% -29.625 us -3.68% 🟢 FAST
1 STRING 10000000 100000 1 1 0.1 full partitioned unequal 1.435 ms 1.91% 1.391 ms 1.54% -43.637 us -3.04% 🟢 FAST
1 FLOAT64 100000 10000 3 1 0.3 full partitioned unequal 251.945 us 14.09% 238.303 us 3.80% -13.642 us -5.41% 🟢 FAST
1 LIST 100000 10000 1 1 0.3 full partitioned unequal 339.734 us 4.75% 336.357 us 2.78% -3.377 us -0.99% 🔵 SAME
1 STRUCT 100000 10000 1 1 0.3 full partitioned unequal 771.611 us 9.73% 757.947 us 2.64% -13.665 us -1.77% 🔵 SAME

inner_join

[0] NVIDIA RTX PRO 6000 Blackwell Workstation Edition

Nullable NullEquality DataType num_keys left_size right_size skip_large_sizes mode Ref Time Ref Noise Cmp Time Cmp Noise Diff %Diff Status
1 NULLS_UNEQUAL INT32 3 10000000 100000 0 partitioned 1.021 ms 1.42% 950.435 us 2.47% -70.469 us -6.90% 🟢 FAST
0 NULLS_UNEQUAL INT32 3 10000000 100000 0 partitioned 1.394 ms 2.14% 1.294 ms 1.27% -100.247 us -7.19% 🟢 FAST

@PointKernel
PointKernel marked this pull request as ready for review October 20, 2026 02:05
@PointKernel
PointKernel requested a review from a team as a code owner October 20, 2026 02:05
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cudf/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 05076d03-cc4a-4afe-b5d7-33f7352381ab
📥 Commits

Reviewing files that changed from the base of the PR and between 87d2d78 and ee54fb6.

📒 Files selected for processing: 1
  • cpp/src/join/hash_join/hash_csr_kernels.cuh

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Performance
    • Improved hash join execution efficiency when match totals are not requested.
    • Reduced unnecessary processing and resource usage for applicable join operations.
    • Preserved match-count calculation behavior when totals are requested.

The probe-count kernel now uses a ComputeSum template parameter to control total-match accumulation and reduction. The launcher selects the specialization based on whether total_matches is non-null.

Changes: Hash CSR probe-count specialization

Layer / File(s) Summary
Kernel aggregation specialization
cpp/src/join/hash_join/hash_csr_kernels.cuh
The kernel compiles match accumulation and block reduction only when ComputeSum is enabled. The launcher enables this specialization when total_matches is non-null.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: scanhex12

Merge Risk: ⚪ Minimal · up to ee54f

This change specializes the hash join probe-count kernel so launches that do not request totals skip the reduction. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly identifies the main change: removing reduction overhead from hash join probe kernels.
Description check Passed The description directly explains the kernel specialization changes, affected paths, preserved behavior, and reported validation results.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change Performance Performance related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant