Skip to content

Add static_multimap::pair_contains#175

Merged
PointKernel merged 13 commits intoNVIDIA:devfrom
PointKernel:add-multimap-pair-contains
Jul 12, 2022
Merged

Add static_multimap::pair_contains#175
PointKernel merged 13 commits intoNVIDIA:devfrom
PointKernel:add-multimap-pair-contains

Conversation

@PointKernel
Copy link
Member

@PointKernel PointKernel commented Jun 5, 2022

Depends on #174

Contributes to #173

This PR adds static_multimap::pair_contains.

@PointKernel PointKernel added type: feature request New feature request helps: rapids Helps or needed by RAPIDS topic: static_multimap Issue related to the static_multimap labels Jun 5, 2022
auto current_slot = initial_slot(g, k);
auto current_slot = [&]() {
if constexpr (is_pair_contains) { return initial_slot(g, element.first); }
if constexpr (not is_pair_contains) { return initial_slot(g, element); }
Copy link

Choose a reason for hiding this comment

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

Similar to above.

Copy link

Choose a reason for hiding this comment

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

And also all other places.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now I recall, we need this to silence the compiler warnings with cuda-11.0/11.2. Reverting back to the if constexpr (not ...) expression.

@ttnghia
Copy link

ttnghia commented Jun 10, 2022

I tested locally with my PR. Will work with this fix: 331b248.
This also needs more cleanup and fixing for docs.

Comment on lines 880 to 883
__device__ __forceinline__ bool pair_contains(
cooperative_groups::thread_block_tile<ProbeSequence::cg_size> const& g,
value_type const& p,
PairEqual pair_equal = PairEqual{}) noexcept;
Copy link

Choose a reason for hiding this comment

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

In addition, we also need to add the version of pair_contains here without the thread_block_tile parameter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why is that?

Copy link

Choose a reason for hiding this comment

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

This is exposed to the users, right? So the users don't have that parameter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unlike single map, multimap needs to handle duplicates. That's the reason that we provide CG APIs only in multimap. Non-CG APIs are provided in single map but are also rarely used. Can you provide more details on your use case i.e. why would non-CG implementation is preferred over the CG ones?

Copy link
Member Author

Choose a reason for hiding this comment

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

So the users don't have that parameter.

users can create a CG e.g. https://godbolt.org/z/o6jYYv7Ys

@PointKernel PointKernel requested a review from jrhemstad June 15, 2022 14:51
@PointKernel PointKernel added the Needs Review Awaiting reviews before merging label Jun 15, 2022
@PointKernel PointKernel force-pushed the add-multimap-pair-contains branch from 469776f to 32d0b17 Compare June 15, 2022 15:52
@ttnghia
Copy link

ttnghia commented Jun 15, 2022

Closes #173

Hey, since #173 now saying "Support pair_contains in static_map and static_multimap", this should not be enough to close that.

@PointKernel
Copy link
Member Author

Closes #173

Hey, since #173 now saying "Support pair_contains in static_map and static_multimap", this should not be enough to close that.

I'm aware of that. Don't worry. :)

@ttnghia
Copy link

ttnghia commented Jun 16, 2022

Confirm that the latest commit works with my code.

@PointKernel PointKernel merged commit 3a49fc7 into NVIDIA:dev Jul 12, 2022
@PointKernel PointKernel deleted the add-multimap-pair-contains branch July 12, 2022 22:20
rapids-bot bot pushed a commit to rapidsai/cudf that referenced this pull request Jul 14, 2022
A (left) semi-join between the left and right tables returns a set of rows in the left table that has matching rows (i.e., compared equally) in the right table. As such, for each row in the left table, it needs to check if that row has a match in the right table. 

Such check is very generic and has applications in many other places, not just in semi-join. This PR exposes that check functionality as a new `cudf::detail::contains(table_view, table_view)` for internal usage.

Closes #11037.

Depends on:
 * NVIDIA/cuCollections#175

Authors:
  - Nghia Truong (https://github.com/ttnghia)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Yunsong Wang (https://github.com/PointKernel)

URL: #11100
rapids-bot bot pushed a commit to rapidsai/cudf that referenced this pull request Jul 26, 2022
This PR adds the following APIs for set operations:
 * `lists::have_overlap`
 * `lists::intersect_distinct`
 * `lists::union_distinct`
 * `lists::difference_distinct`

### Name Convention
Except for the first API (`lists::have_overlap`) that returns a boolean column, the suffix `_distinct` of the rest APIs denotes that their results will be lists columns in which all list rows have been post-processed to remove duplicates. As such, their results are actually "set" columns in which each row is a "set" of distinct elements.

---

Depends on:
 * #10945
 * #11017
 * NVIDIA/cuCollections#175
 * #11052
 * #11118
 * #11100
 * #11149

Closes #10409.

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

Approvers:
  - Michael Wang (https://github.com/isVoid)
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Bradley Dice (https://github.com/bdice)
  - Yunsong Wang (https://github.com/PointKernel)

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

Labels

helps: rapids Helps or needed by RAPIDS Needs Review Awaiting reviews before merging topic: static_multimap Issue related to the static_multimap type: feature request New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants