Skip to content

Commit

Permalink
HIP 4.5.0 workaround compile error
Browse files Browse the repository at this point in the history
Disable printf to avoid compiler error: `error: stack size limit
exceeded (181896) in _ZN6alpaka...`
  • Loading branch information
psychocoderHPC committed Aug 2, 2022
1 parent db3e11b commit 78e212e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions include/alpaka/test/Check.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,33 @@
// TODO: SYCL doesn't have a way to detect if we're looking at device or host code. This needs a workaround so that
// SYCL and other back-ends are compatible.
#ifdef ALPAKA_ACC_SYCL_ENABLED
# define ALPAKA_CHECK_DO(file, line, success, expression) \
# define ALPAKA_CHECK_DO(printMsg, file, line, success, expression) \
do \
{ \
if(!(expression)) \
{ \
acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << file << ":" << line \
<< "\n"; \
if constexpr(printMsg) \
acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << file << ":" << line \
<< "\n"; \
success = false; \
} \
} while(0)
#else
# define ALPAKA_CHECK_DO(file, line, success, expression) \
# define ALPAKA_CHECK_DO(printMsg, file, line, success, expression) \
do \
{ \
if(!(expression)) \
{ \
printf("ALPAKA_CHECK failed because '!(%s)' in %s:%d\n", #expression, file, line); \
if constexpr(printMsg) \
printf("ALPAKA_CHECK failed because '!(%s)' in %s:%d\n", #expression, file, line); \
success = false; \
} \
} while(0)
#endif

#define ALPAKA_CHECK(success, expression) ALPAKA_CHECK_DO(__FILE__, __LINE__, success, expression)
#if BOOST_LANG_HIP == BOOST_VERSION_NUMBER(4, 5, 0)
// disable message print to avoid compiler error: 'error: stack size limit exceeded (181896) in _ZN6alpaka...'
# define ALPAKA_CHECK(success, expression) ALPAKA_CHECK_DO(false, __FILE__, __LINE__, success, expression)
#else
# define ALPAKA_CHECK(success, expression) ALPAKA_CHECK_DO(true, __FILE__, __LINE__, success, expression)
#endif

0 comments on commit 78e212e

Please sign in to comment.