diff --git a/include/alpaka/test/Check.hpp b/include/alpaka/test/Check.hpp index 4f9115fef5e2..1fe6007a9042 100644 --- a/include/alpaka/test/Check.hpp +++ b/include/alpaka/test/Check.hpp @@ -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