Fix test errors

Check the HIP API calls status, and abort if != success.

Change-Id: Ifc38d8f28092ffdce1674a05a7886f7c0c97a885
This commit is contained in:
Laurent Morichetti
2022-06-02 21:17:29 -07:00
committed by Laurent Morichetti
parent 1680d2c70e
commit 4c6f249cc1
2 changed files with 27 additions and 9 deletions
+11 -2
View File
@@ -22,10 +22,19 @@
#include "roctx.h"
#define HIP_CALL(call) \
do { \
hipError_t err = call; \
if (err != hipSuccess) { \
fprintf(stderr, "%s\n", hipGetErrorString(err)); \
abort(); \
} \
} while (0)
__global__ void kernel() {}
int main(int argc, char* argv[]) {
hipSetDevice(0);
HIP_CALL(hipSetDevice(0));
// Not in a roctx range.
kernel<<<1, 1>>>();
@@ -59,6 +68,6 @@ int main(int argc, char* argv[]) {
if (roctxRangePop() != 0) return -1;
hipDeviceSynchronize();
HIP_CALL(hipDeviceSynchronize());
return 0;
}