Skip to content

Commit

Permalink
nvcc Kokkos_ENABLE_DEBUG_BOUNDS_CHECK compile perf fix for Kokkos_Cor…
Browse files Browse the repository at this point in the history
…eUnitTest_Default
  • Loading branch information
weinbe2 authored and nmm0 committed May 15, 2024
1 parent df018d9 commit fba40bb
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions core/src/Cuda/Kokkos_Cuda_abort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C" {
/* Cuda runtime function, declared in <crt/device_runtime.h>
* Requires capability 2.x or better.
*/
extern __device__ void __assertfail(const void *message, const void *file,
__device__ [[noreturn]] void __assertfail(const void *message, const void *file,
unsigned int line, const void *function,
size_t charsize);
}
Expand All @@ -38,25 +38,11 @@ namespace Impl {

// required to workaround failures in random number generator unit tests with
// pre-volta architectures
#if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
__device__ inline void cuda_abort(const char *const message) {
#else
[[noreturn]] __device__ inline void cuda_abort(const char *const message) {
#endif
__device__ __noinline__ [[noreturn]] static void cuda_abort(const char *const message) {
const char empty[] = "";

__assertfail((const void *)message, (const void *)empty, (unsigned int)0,
(const void *)empty, sizeof(char));

// This loop is never executed. It's intended to suppress warnings that the
// function returns, even though it does not. This is necessary because
// __assertfail is not marked as [[noreturn]], even though it does not return.
// Disable with KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK to workaround failures
// in random number generator unit tests with pre-volta architectures
#if !defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)
while (true)
;
#endif
}

} // namespace Impl
Expand Down

0 comments on commit fba40bb

Please sign in to comment.