From 3e1169eb511d6ce3c5c779c814cca014e07da7e5 Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary <51944368+cjatin@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:25:55 +0100 Subject: [PATCH] SWDEV-397031 - fix device functions as well (#352) Change-Id: I9081a5497c89b563c3761e533bb9ee03d61f5867 --- .../15_static_library/device_functions/hipMain2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp b/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp index a3c3f8f164..fafbf5a72d 100644 --- a/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp +++ b/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp @@ -23,8 +23,15 @@ #include #include #include +#include -#define HIP_ASSERT(status) assert(status == hipSuccess) +#define HIP_ASSERT(status) \ + { \ + if ((status != hipSuccess)) { \ + std::cerr << "Failed in: " << __LINE__ << " on hip call: " #status << std::endl; \ + throw std::runtime_error("generic failure"); \ + } \ + } #define LEN 512 extern __device__ int square_me(int);