Skip to content

Commit

Permalink
Silence some static asserts in ptx helpers (#1257) (#1284)
Browse files Browse the repository at this point in the history
We only use if constexpr in C++17 so those functions are instantiated but never used.

Fixes nvbug4384352

Co-authored-by: Jake Hemstad <[email protected]>
  • Loading branch information
miscco and jrhemstad authored Jan 17, 2024
1 parent 299eb62 commit b592060
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ inline _LIBCUDACXX_DEVICE _CUDA_VSTD::uint64_t __as_ptr_gmem(const void* __ptr)
template <typename _Tp>
inline _LIBCUDACXX_DEVICE _CUDA_VSTD::uint32_t __as_b32(_Tp __val)
{
#if _LIBCUDACXX_STD_VER >= 17 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR)
static_assert(sizeof(_Tp) == 4, "");
#endif // _LIBCUDACXX_STD_VER >= 17 && !_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR
// Consider using std::bitcast
return *reinterpret_cast<_CUDA_VSTD::uint32_t*>(&__val);
}

template <typename _Tp>
inline _LIBCUDACXX_DEVICE _CUDA_VSTD::uint64_t __as_b64(_Tp __val)
{
#if _LIBCUDACXX_STD_VER >= 17 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR)
static_assert(sizeof(_Tp) == 8, "");
#endif // _LIBCUDACXX_STD_VER >= 17 && !_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR
// Consider using std::bitcast
return *reinterpret_cast<_CUDA_VSTD::uint64_t*>(&__val);
}
Expand Down

0 comments on commit b592060

Please sign in to comment.