From c865151e50a6bea5ffab0c1ca4b3fc40f6b99307 Mon Sep 17 00:00:00 2001 From: "Sun, Peng" Date: Thu, 30 Mar 2017 17:14:55 -0500 Subject: [PATCH] fix hipVectorTypesDevice direct test with GGL enabled Change-Id: I7a63b87348f08f094cd709e87397d9e0fc24e4c2 --- tests/src/deviceLib/hipVectorTypesDevice.cpp | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/src/deviceLib/hipVectorTypesDevice.cpp b/tests/src/deviceLib/hipVectorTypesDevice.cpp index 285b3e889e..265cd00b22 100644 --- a/tests/src/deviceLib/hipVectorTypesDevice.cpp +++ b/tests/src/deviceLib/hipVectorTypesDevice.cpp @@ -3874,7 +3874,22 @@ int main() { assert(sizeof(float2) == 8); assert(sizeof(float3) == 12); assert(sizeof(float4) == 16); - bool *ptr; - hipLaunchKernel(CheckVectorTypes, dim3(1,1,1), dim3(1,1,1), 0, 0, ptr); - passed(); + + bool* ptr = nullptr; + if (hipMalloc(&ptr, sizeof(bool)) != HIP_SUCCESS) return EXIT_FAILURE; + std::unique_ptr correct{ptr, hipFree}; + hipLaunchKernel( + CheckVectorTypes, dim3(1,1,1), dim3(1,1,1), 0, 0, correct.get()); + bool passed = false; + if (hipMemcpyDtoH(&passed, correct.get(), sizeof(bool)) != HIP_SUCCESS) { + return EXIT_FAILURE; + } + + if (passed == true){ + std::cout << "PASSED" << std::endl; + return 0; + } + else + return EXIT_FAILURE; } +