NVIDIA / NVIDIA/cuCollections

[BUG]: repeated keys in static_map after a sequence of insertions and deletions

Open
#606 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P1: Should have topic: static_map topic: static_set type: bug
Dominant language
Cuda
Stars
667
Forks
120
Avg merge
7d 5h
Merged PRs (30d)
4

Description

Is this a duplicate?
Type of Bug

Silent Failure

Describe the bug

I've been seeing repeated keys when I retrieve all the keys and values from cuco::staic_map. This is the explanation that I've found for it.

Assume that k1 and k2 map to the same position on the map and cause a collision. if we insert at k1, then insert at k2, remove k1 and then insert at k2 again, with the current probing schemes, there will be 2 instances of k2 at the map. That's because when we remove k1, an erased key sentinel will be left at it's position and when we want to insert k2 again, the insert function sees the erased key sentinel first and doesn't check any further to see if k2 is placed anywhere else. as a result, there will be 2 k2s at our map.

How to Reproduce
  1. Construct a map
  2. find 2 keys k1 and k2 that collide with each other
  3. insert something at k1
  4. insert something at k2
  5. remove k1
  6. insert something at k2
  7. retrieve all the keys at the map

Result: There will be 2 instances of k2 when we retrieve all the elements from the map.

Expected behavior

At any time there should be only one instance of k2 in the map.

Reproduction link

No response

Operating System

Ubuntu 22.04.4 LTS

nvidia-smi output

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.100 Driver Version: 550.100 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4090 Off | 00000000:01:00.0 Off | Off |
| 0% 49C P8 19W / 500W | 31MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

NVCC version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

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 reproducing the k1/k2 collision sequence described for cuco::static_map, then inspect its probing, erase, and insertion entry points. Done means repeated insertions and deletions never produce duplicate keys when all keys and values are retrieved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.