diff options
Diffstat (limited to 'Tests/HIP/MathFunctions')
-rw-r--r-- | Tests/HIP/MathFunctions/main.hip | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Tests/HIP/MathFunctions/main.hip b/Tests/HIP/MathFunctions/main.hip index 8a6e77f..dae89fc 100644 --- a/Tests/HIP/MathFunctions/main.hip +++ b/Tests/HIP/MathFunctions/main.hip @@ -18,11 +18,15 @@ bool verify(F f, T expected) { std::unique_ptr<T> cpu_T(new T); T* gpu_T = nullptr; - hipMalloc((void**)&gpu_T, sizeof(T)); + if (hipMalloc((void**)&gpu_T, sizeof(T)) != hipSuccess) { + return false; + } + bool result = true; hipLaunchKernelGGL(global_entry_point, 1, 1, 0, 0, f, gpu_T); - hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost); - hipFree(gpu_T); - return (*cpu_T == expected); + result = hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost) == hipSuccess && result; + result = hipFree(gpu_T) == hipSuccess && result; + result = *cpu_T == expected && result; + return result; } } |