NVIDIA / cuCollections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ENHANCEMENT]: static_map insert_and_find() should increment size_ on new insertions.

mattpulver opened this issue · comments

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

It would be useful if static_map<>::device_mutable_view::insert_and_find() incremented static_map::size_ on successful insert.

Otherwise if an application is exclusively inserting values via insert_and_find() then get_size() always returns 0.

How do we know what size to make the output buffer when calling retrieve_all()?

Describe the solution you'd like

Increment static_map::size_ on successful insert by insert_and_find().

Or, please describe how to get the accurate size of a static_map which inserts data via insert_and_find().

Describe alternatives you've considered

No response

Additional context

No response

@mattpulver Thanks for reporting the issue.

There are misalignments of implementations between multimap and map and the multimap get_size would actually check if each slot is empty to compute the total number of filled slots. We are working on a refactor to clean up the whole code base.

I will put up a PR shortly to update map get_size following the same way as multimap.

@mattpulver PR merged.

Note you could also write your own kernel to accumulate the number of successful insertions of insert_and_find. A reference can be found here

@mattpulver Have to revert the latest changes in size computation due to conflicts in downstream projects. Sorry about that.

Will let you know once the feature is back (should be quick).

No worries, thanks for the update. We are using the old warpcore::CountingHashTable w/ a cooperative group size of 1 to accomplish this for now, so no rush. Rather wait for a clean/stable solution.