Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add distinct key inner join #14990

Merged
merged 78 commits into from
Feb 23, 2024

Conversation

PointKernel
Copy link
Member

@PointKernel PointKernel commented Feb 7, 2024

Description

Contributes to #14948

This PR adds a public cudf::distinct_hash_join class that provides a fast code path for joins with distinct keys.

Only distinct inner join is tackled in the current PR.

Checklist

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

@PointKernel PointKernel added feature request New feature or request 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue Performance Performance related issue non-breaking Non-breaking change labels Feb 7, 2024
@PointKernel PointKernel self-assigned this Feb 7, 2024
@GregoryKimball
Copy link
Contributor

🔥🔥🔥

cpp/include/cudf/join.hpp Outdated Show resolved Hide resolved
cpp/include/cudf/detail/unique_hash_join.cuh Outdated Show resolved Hide resolved
cpp/include/cudf/detail/unique_hash_join.cuh Outdated Show resolved Hide resolved
cpp/include/cudf/join.hpp Outdated Show resolved Hide resolved
@PointKernel
Copy link
Member Author

PointKernel commented Feb 8, 2024

@jlowe The prototype should be ready for testing. Please let me know if you find any bugs/issues.

I'm testing/tuning several alternative algorithms locally for the probe kernel so no need to worry about the performance for now.

TODO:

  • Add benchmarks
  • Add more unit tests
  • Add scalar-based probe kernel with scan
  • Evaluate scalar-based kernel and CG-based kernel
  • Per-block flush v.s. per-CG flush
  • Tune hash table probing scheme, cg_size, window_size, hasher, buffer size and block size

Co-authored-by: Lawrence Mitchell <wence@gmx.li>
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Good from my end wrt the one racey read/write

@@ -21,6 +21,9 @@

namespace cudf::detail {

/// Default load factor for cuco data structures
static double constexpr CUCO_DESIRED_LOAD_FACTOR = 0.5;
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

Comment on lines +37 to +41
/**
* @brief An comparator adapter wrapping both self comparator and two table comparator
*/
template <typename Equal>
struct comparator_adapter {
Copy link
Contributor

@ttnghia ttnghia Feb 21, 2024

Choose a reason for hiding this comment

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

Sound extremely familiar to me 😛 . Can you extract the code into some common header (or row_operators.cuh) instead of putting here? We would probably reuse it somewhere else.

Copy link
Member Author

Choose a reason for hiding this comment

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

Such adapters look similar to each other while the contents are quite different, e.g. the insert comparator always returns false since we know all insert elements are distinct, the set key type is a pair of row hash value and row index which is rarely seen besides join operations, etc.

Copy link
Contributor

@davidwendt davidwendt left a comment

Choose a reason for hiding this comment

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

LGTM

@PointKernel
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit 71c9909 into rapidsai:branch-24.04 Feb 23, 2024
68 checks passed
@PointKernel PointKernel deleted the unique-hash-join branch February 23, 2024 19:17
raydouglass pushed a commit that referenced this pull request Feb 28, 2024
Adds Java bindings to the distinct hash join functionality added in #14990.

Authors:
   - Jason Lowe (https://github.com/jlowe)

Approvers:
   - Jim Brennan (https://github.com/jbrennan333)
   - Nghia Truong (https://github.com/ttnghia)
rapids-bot bot pushed a commit that referenced this pull request Feb 29, 2024
Closes #15156 
Fixes the invalid global read introduced by #14990 and simplifies the logic.

Authors:
  - Yunsong Wang (https://github.com/PointKernel)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - David Wendt (https://github.com/davidwendt)

URL: #15164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team CMake CMake build issue feature request New feature or request 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.

None yet

9 participants