Size computation slows bulk insert significantly
Nobody has claimed this yet.
- Dominant language
- Cuda
- Stars
- 667
- Forks
- 120
- Avg merge
- 7d 5h
- Merged PRs (30d)
- 4
Description
The size computation requires a small memcpy from device to host and then a synchronization. Each one is the cause of serious performance degradation.
The synchronization is bad because it means that other unrelated streams are unable to do work.
The memcpy is bad because future copies are queued behind this one in architectures that have a limited number of cuda copy engines.
I was able to get a significant performance improvement by deleting these lines.
There ought to be a better way to compute size. Perhaps a lazy method. If this is too difficult, you might consider using templates to allow the user to choose to not maintain size_ at all! Use templates to change the type of size_ from int to a struct that has no members. That way it doesn't take up any space. Provide no methods on this struct so that the size_ doesn't get accidentally used. It will still use some space on the host but that seems like no big deal.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with include/cuco/detail/static_map.inl at lines 149-151 and profile bulk insertion to confirm the device-to-host memcpy and synchronization costs. Compare alternatives for computing or avoiding size maintenance, then verify that bulk insert no longer incurs the reported per-operation overhead without breaking size-related behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100