Skip to content

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

@amiralirz

Description

@amiralirz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions