NVIDIA / cuCollections

Apache License 2.0
457 stars 81 forks source link

[BUG]: Fix bugs in `insert_or_apply` #542

Closed PointKernel closed 1 month ago

PointKernel commented 1 month ago

Is this a duplicate?

Type of Bug

Runtime Error

Describe the bug

The insert_or_apply unit tests are failing sometimes, e.g.

yunsongw@0c23fdd-lcedt:~/Work/cuCollections/build/tests$ ./STATIC_MAP_TEST 
Randomness seeded to: 3818206722

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
STATIC_MAP_TEST is a Catch2 v3.3.0 host application.
Run with -? for options

-------------------------------------------------------------------------------
static_map insert_or_apply tests - int32_t, int64_t, cuco::test::
probe_sequence::double_hashing, 1
  Sentinel not equals to identity
-------------------------------------------------------------------------------
/home/yunsongw/Work/cuCollections/tests/static_map/insert_or_apply_test.cu:119
...............................................................................

/home/yunsongw/Work/cuCollections/tests/static_map/insert_or_apply_test.cu:64: FAILED:
  REQUIRE( cuco::test::equal(d_values.begin(), d_values.end(), thrust::make_constant_iterator<Value>(num_keys / num_unique_keys), thrust::equal_to<Value>{}) )
with expansion:
  false

How to Reproduce

Changing num_keys to 100'000 at line https://github.com/NVIDIA/cuCollections/blob/a7f87ac838320fe5b9fc9a90847d3f652ccec201/tests/static_map/insert_or_apply_test.cu#L95 will make the unit test always fail.

Expected behavior

Unit tests should pass without failures.

Note that the packed_cas cases seem to never fail, so the problem appears to be specific to large types where sizeof(value_type) > 8.

PointKernel commented 1 month ago

cc @srinivasyadav18

srinivasyadav18 commented 1 month ago

@PointKernel Thanks. I will investigate this and fix it soon!