NVIDIA / NVIDIA/cuCollections

[ENHANCEMENT]: Provide helper function cuco::experimental::make_static_set et al

Open
#370 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2: Nice to have type: improvement
Dominant language
Cuda
Stars
667
Forks
120
Avg merge
7d 5h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.

I would like a function called make_static_set that will create a static set that will infer the template arguments from the function call.

Describe the solution you'd like

Instead of:

auto set = cuco::experimental::static_set<MyKeyType, MyExtent, MyThreadScope, MyKeyEqual>(capacity, cuco::empty_key(-1), MyKeyEqual(123));

I could write:

auto set = cuco::experimental::make_static_set(capacity, cuco::empty_key(-1), MyKeyEqual(123));

Notice how it's much smaller and I'm not repeating myself. Notice the addition of the work "make". This is consistent with the stdlib's usage of the word make in, for example, std::make_tuple

Describe alternatives you've considered

I can do without but its wordy. Doing this doesn't add much work for cuco. Cuco can modify some of its tests to use this form of the instantiation so that it is tested well in CI.

Additional context

Inference only works on functions, not classes: https://stackoverflow.com/questions/797594/when-a-compiler-can-infer-a-template-parameter

Here's how make_tuple works: https://en.cppreference.com/w/cpp/utility/tuple/make_tuple

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the cuco::experimental::static_set implementation and its existing tests. Check how the proposed make_static_set call should infer the template arguments, then update tests to exercise the helper and confirm the requested construction form works in CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.