diff --git a/include/alpaka/test/Check.hpp b/include/alpaka/test/Check.hpp index 6aa453fc83ef..ec2412d59b7f 100644 --- a/include/alpaka/test/Check.hpp +++ b/include/alpaka/test/Check.hpp @@ -9,28 +9,39 @@ #pragma once +#include + #include // 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(success, expression) \ +# define ALPAKA_CHECK_DO(file, line, success, expression) \ do \ { \ if(!(expression)) \ { \ - acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")'\n"; \ + acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << file << ":" << line \ + << "\n"; \ success = false; \ } \ } while(0) #else -# define ALPAKA_CHECK(success, expression) \ +# define ALPAKA_CHECK_DO(file, line, success, expression) \ do \ { \ if(!(expression)) \ { \ - printf("ALPAKA_CHECK failed because '!(%s)'\n", #expression); \ + printf("ALPAKA_CHECK failed because '!(%s)' in %s:%d\n", #expression, file, line); \ success = false; \ } \ } while(0) #endif + +#if BOOST_LANG_HIP == BOOST_VERSION_NUMBER(4, 5, 0) +// Do not forward the file name to avoid the compiler crashes with: "error: stack size limit exceeded (181056) in +// _ZN6alpaka16uniform_cuda_hip..." +# define ALPAKA_CHECK(success, expression) ALPAKA_CHECK_DO("unknown", __LINE__, success, expression) +#else +# define ALPAKA_CHECK(success, expression) ALPAKA_CHECK_DO(__FILE__, __LINE__, success, expression) +#endif