-
Notifications
You must be signed in to change notification settings - Fork 107
[ENHANCEMENT]: Add for_each device API #499
Copy link
Copy link
Closed
Labels
P1: Should haveNecessary but not criticalNecessary but not criticaltopic: static_mapIssue related to the static_mapIssue related to the static_maptopic: static_multisetIssue related to the static_multisetIssue related to the static_multisettopic: static_setIssue related to the static_setIssue related to the static_settype: feature requestNew feature requestNew feature request
Milestone
Metadata
Metadata
Assignees
Labels
P1: Should haveNecessary but not criticalNecessary but not criticaltopic: static_mapIssue related to the static_mapIssue related to the static_maptopic: static_multisetIssue related to the static_multisetIssue related to the static_multisettopic: static_setIssue related to the static_setIssue related to the static_settype: feature requestNew feature requestNew feature request
Is your feature request related to a problem? Please describe.
There's currently no way of iterating over all matching values for a given key from the device.
The current
retrieveAPI isn't exposed to the public since it is highly optimized for bulkretrieveand thus not well-suited for general use.Describe the solution you'd like
Implement a device function that allows for iterating over all values found and then process them according to some user-defined callback function:
During probing for
key, if a thread intilehits a matching slot, it will pass a non-incrementable iterator to said slot to the callback which then handles the downstream processing.This API can also be used to implement the aforementioned optimized
retrieve.Describe alternatives you've considered
for_eachhandles all of the probing logic internally and just calls the callback with the found values.The counter design to this would consist of a "heavy" iterator which is returned from a new
retrievedevice functionThe iterator will handle the probing internally, returningend()once there are no more matching values for the givenkey`.I have some concerns with this design:
for_eachfunction, however, ensures that probing is always performed in the same CG contextAdditional context
WarpCore had a
for_eachfunction although my design back in the day wasn't perfect: https://github.com/sleeepyjack/warpcore/blob/ba5a6a84a8797464e2ce8dd03b269907ee70e7c2/include/warpcore/multi_value_hash_table.cuh#L607