Skip to content

Commit

Permalink
Revert Bit Twiddle change from PR ROCm#377
Browse files Browse the repository at this point in the history
An update to the TwiddleIn/Out functions from PR ROCm#377 seems to be causing
a build failure in onnxruntime. This change reverts the single commit
(0721c2c) that made those changes.
We can re-apply the change with an appropriate fix in the future.
Note: the commits in the PR were squashed, so that commit will not
show up in the log.
  • Loading branch information
umfranzw committed Aug 26, 2024
1 parent 3990381 commit 72bef3e
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions hipcub/include/hipcub/backend/rocprim/util_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,12 @@ struct BaseTraits<UNSIGNED_INTEGER, true, false, _UnsignedBits, T>

static HIPCUB_HOST_DEVICE __forceinline__ UnsignedBits TwiddleIn(UnsignedBits key)
{
return key_codec::encode(rocprim::detail::bit_cast<T>(key));
return key;
}

static HIPCUB_HOST_DEVICE __forceinline__ UnsignedBits TwiddleOut(UnsignedBits key)
{
return key_codec::decode(rocprim::detail::bit_cast<T>(key));
return key;
}

static HIPCUB_HOST_DEVICE __forceinline__ T Max()
Expand Down Expand Up @@ -508,12 +508,12 @@ struct BaseTraits<SIGNED_INTEGER, true, false, _UnsignedBits, T>

static HIPCUB_HOST_DEVICE __forceinline__ UnsignedBits TwiddleIn(UnsignedBits key)
{
return key_codec::encode(rocprim::detail::bit_cast<T>(key));
return key ^ HIGH_BIT;
};

static HIPCUB_HOST_DEVICE __forceinline__ UnsignedBits TwiddleOut(UnsignedBits key)
{
return key_codec::decode(rocprim::detail::bit_cast<T>(key));
return key ^ HIGH_BIT;
};

static HIPCUB_HOST_DEVICE __forceinline__ T Max()
Expand Down Expand Up @@ -607,12 +607,14 @@ struct BaseTraits<FLOATING_POINT, true, false, _UnsignedBits, T>

static HIPCUB_HOST_DEVICE __forceinline__ UnsignedBits TwiddleIn(UnsignedBits key)
{
return key_codec::encode(rocprim::detail::bit_cast<T>(key));
UnsignedBits mask = (key & HIGH_BIT) ? UnsignedBits(-1) : HIGH_BIT;
return key ^ mask;
};

static HIPCUB_HOST_DEVICE __forceinline__ UnsignedBits TwiddleOut(UnsignedBits key)
{
return key_codec::decode(rocprim::detail::bit_cast<T>(key));
UnsignedBits mask = (key & HIGH_BIT) ? HIGH_BIT : UnsignedBits(-1);
return key ^ mask;
};

static HIPCUB_HOST_DEVICE __forceinline__ T Max() {
Expand Down Expand Up @@ -663,12 +665,12 @@ struct NumericTraits<__uint128_t>

static __host__ __device__ __forceinline__ UnsignedBits TwiddleIn(UnsignedBits key)
{
return key_codec::encode(rocprim::detail::bit_cast<T>(key));
return key;
}

static __host__ __device__ __forceinline__ UnsignedBits TwiddleOut(UnsignedBits key)
{
return key_codec::decode(rocprim::detail::bit_cast<T>(key));
return key;
}

static __host__ __device__ __forceinline__ T Max()
Expand Down Expand Up @@ -700,12 +702,12 @@ struct NumericTraits<__int128_t>

static __host__ __device__ __forceinline__ UnsignedBits TwiddleIn(UnsignedBits key)
{
return key_codec::encode(rocprim::detail::bit_cast<T>(key));
return key ^ HIGH_BIT;
};

static __host__ __device__ __forceinline__ UnsignedBits TwiddleOut(UnsignedBits key)
{
return key_codec::decode(rocprim::detail::bit_cast<T>(key));
return key ^ HIGH_BIT;
};

static __host__ __device__ __forceinline__ T Max()
Expand Down

0 comments on commit 72bef3e

Please sign in to comment.