Skip to content

Improve performance for hash partition operator - #23507

Draft
tgujar wants to merge 14 commits into
rapidsai:mainfrom
tgujar:tgujar-hash-partition-improvements
Draft

Improve performance for hash partition operator#23507
tgujar wants to merge 14 commits into
rapidsai:mainfrom
tgujar:tgujar-hash-partition-improvements

Conversation

@tgujar

@tgujar tgujar commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Description

This change adds a staged scatter path for fixed-width hash partitioning. It computes compact row metadata once, then copies fixed-width output columns directly in partition order instead of materializing the whole result through a gather map. Variable-width columns and validity masks continue to use the existing gather machinery.

The implementation includes these optimizations:

  • pack each row's partition ID and local partition offset into one 32-bit metadata value when the
    bit widths allow it, with the existing representation retained as a fallback;
  • hash compatible fixed-width keys through a specialized row hasher and remove redundant global
    partition-total storage;
  • stage partition offsets in shared memory and copy 1-, 2-, 4-, 8-, and 16-byte values directly,
    including vectorized 16-byte copies;
  • select the staged-scatter CTA size and rows per thread from the available shared memory;
  • fuse fixed width column copies to avoid repeated metadata loads from GMEM for each column
  • use streaming loads for one-pass input data and group output columns into L2-sized batches to
    reduce scattered output sector writes;
  • build one gather map only when variable-width columns or validity masks need it, then reuse it for
    all remaining materialization work.

Checklist

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

@copy-pr-bot

copy-pr-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue labels Aug 1, 2026
@tgujar

tgujar commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author
analytic_shape_heatmaps partition_count_runtime_comparison all_benchmark_states

Some perf charts on RTX 6k PRO Blackwell

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

Labels

CMake CMake build issue libcudf Affects libcudf (C++/CUDA) code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant