-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race during insertion of key/values #23
Comments
@AKKamath did you see other races of this type? Thank you for this report! |
This seems repeated in many locations. |
Hi @AKKamath, although the bucket read operation doesn't perform any synchronization, the Could you explain what scenario would produce a race condition? I'm also curious about how you found these multiple race conditions. |
Since the read operation is "weak" it has no consistency guarantees. A simple fix would be changing the weak loads to a "strong" operation by typecasting them to volatile, or using an atomic operation instead, e.g. atomicAdd(getPointerFromBucket(src_bucket, laneId), 0) |
Thanks for sharing that paper. I read it before. |
So by definition (https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#conflict-and-data-races), there is a data race between the weak load and atomic. |
I continue to be interested in getting to the bottom of this. @maawad is there a data race / is it benign, or is this not a race? |
I noticed that there were races in the code.
For example, in line 45 of src/concurrent_map/warp:
uint32_t src_unit_data = (next == SlabHashT::A_INDEX_POINTER)
? *(getPointerFromBucket(src_bucket, laneId))
: *(getPointerFromSlab(next, laneId));
Here a weak load operation is used to read data from the bucket.
Later on (line 65/line 83), an atomicCAS is performed to the same location.
Different threads may read and atomicCAS on the same location, creating a race.
The text was updated successfully, but these errors were encountered: