diff options
author | Brad King <brad.king@kitware.com> | 2023-11-16 20:33:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-11-17 14:58:21 (GMT) |
commit | bc435bc2888d0a3ebb2adf9ec13786cb9bd72598 (patch) | |
tree | 95865547a996d29ae385582811305a28dc708a10 /Tests/HIP/MathFunctions | |
parent | 52ce26b9d3ba8856547952acf0a1bd1fc99dbb76 (diff) | |
download | CMake-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.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; } } |