[QST] Is there any plan to support insert empty_key_sentinel in static_map? #433
-
The origin question is situated within cudf issue #14896. As the maintenance of GPU hash tables will be transferred to the cuCollections repo, so I migrate the question here. Based upon the response to issue. If the remapped value of the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
They will not. The "get current_slot" process only indicates the starting point for a given key and doesn't determine the actual insertion place. If that initial slot is empty (a.k.a equal to the sentinel value), the key will be inserted. Otherwise, we will follow a certain pattern (probing scheme) to find the next empty slot and insert the key/value there. Can you provide more details on your use case so we can understand the problem better? e.g. What's the key type and payload type? Are you using the device singular API or host bulk API? |
Beta Was this translation helpful? Give feedback.
-
Many Thanks for your reply.
key type: uint64_t
I'm not very sure, what are the differences between device singular API and host bulk API?
Yes, I understand your point. But my problem is not followed this procedure.
In this scenario, If this situation occurs, when attempting to find To sum up, this is the origin problem I met. Additionally, remapping
After the remap, if |
Beta Was this translation helpful? Give feedback.
Please do not insert sentinels.
Sentinel values are reserved values and they must be never present in your input data. Attempting to insert them is an undefined behavior.
Whenever one needs to insert sentinels, it's time to take a step back and revise the algorithm. A common workaround is to use the hash map as an indirection mapping table to the original input, e.g. https://godbolt.org/z/s96e5z7bn:
-1
is a valid sentinel value since you will never access tokeys[-1]
in your problem