Skip to content

Commit

Permalink
Try to use the same redefinition of __assert_fail as pytorch has (#…
Browse files Browse the repository at this point in the history
…2577)

* Try to use the same redefinition of `__assert_fail` as pytorch has

* Also dont use the `__THROW` macro as that might be undefined
  • Loading branch information
miscco authored Oct 15, 2024
1 parent 361f671 commit c711a30
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libcudacxx/include/cuda/std/__cccl/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <cuda/std/__cccl/attributes.h>
#include <cuda/std/__cccl/builtin.h>
#include <cuda/std/__cccl/execution_space.h>

#if !defined(_CCCL_COMPILER_NVRTC)
# include <assert.h>
Expand Down Expand Up @@ -68,9 +69,14 @@
#else // ^^^ MSVC STL ^^^ / vvv !MSVC STL vvv
# ifdef NDEBUG
// Reintroduce the __assert_fail declaration
extern void
__assert_fail(const char* __assertion, const char* __file, unsigned int __line, const char* __function) __THROW
extern "C" {
# if !defined(_CCCL_CUDA_COMPILER_CLANG)
_CCCL_HOST_DEVICE
# endif // !_CCCL_CUDA_COMPILER_CLANG
void
__assert_fail(const char* __assertion, const char* __file, unsigned int __line, const char* __function) noexcept
__attribute__((__noreturn__));
}
# endif // NDEBUG
// ICC cannot deal with `__builtin_expect` in the constexpr evaluator, so just drop it
# if defined(_CCCL_COMPILER_ICC)
Expand Down

0 comments on commit c711a30

Please sign in to comment.