summaryrefslogtreecommitdiffstats
path: root/Tests/HIP/MathFunctions
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-16 20:33:14 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-17 14:58:21 (GMT)
commitbc435bc2888d0a3ebb2adf9ec13786cb9bd72598 (patch)
tree95865547a996d29ae385582811305a28dc708a10 /Tests/HIP/MathFunctions
parent52ce26b9d3ba8856547952acf0a1bd1fc99dbb76 (diff)
downloadCMake-bc435bc2888d0a3ebb2adf9ec13786cb9bd72598.zip
CMake-bc435bc2888d0a3ebb2adf9ec13786cb9bd72598.tar.gz
CMake-bc435bc2888d0a3ebb2adf9ec13786cb9bd72598.tar.bz2
Tests: Update HIP.MathFunctions case for nodiscard enforcement
Diffstat (limited to 'Tests/HIP/MathFunctions')
-rw-r--r--Tests/HIP/MathFunctions/main.hip12
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;
}
}