Skip to content

Commit

Permalink
Don't use host-only functions in host-device contexts.
Browse files Browse the repository at this point in the history
This fixes the issue reported in NVIDIA#299. There's no
clear reason why this should use `RandomBits` unconditionally.
  • Loading branch information
alliepiper committed May 11, 2021
1 parent cfa20c9 commit bbb303f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ void InitValue(GenMode gen_mode, T &value, int index = 0)
__host__ __device__ __forceinline__
void InitValue(GenMode gen_mode, bool &value, int index = 0)
{

NV_IF_TARGET(
NV_IS_HOST,
(
Expand Down Expand Up @@ -657,10 +656,8 @@ __host__ __device__ __forceinline__ void InitValue(
cub::KeyValuePair<KeyT, ValueT>& value,
int index = 0)
{
InitValue(gen_mode, value.key, index);
InitValue(gen_mode, value.value, index);

// Assign corresponding flag with a likelihood of the last bit being set with entropy-reduction level 3
RandomBits(value.key, 3);
value.key = (value.key & 0x1);
}

Expand Down

0 comments on commit bbb303f

Please sign in to comment.