From 8431e3620a1e1e95eb09bd144e09a41d09522ea6 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Thu, 20 Sep 2018 11:23:51 +0530 Subject: [PATCH] Update hipTestFMA.cpp Fix the test so that it works on nvcc path as well. [ROCm/hip commit: ecd6a212c7e1cbac802b415adf3bd9ecb72648f8] --- .../hip/tests/src/deviceLib/hipTestFMA.cpp | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/projects/hip/tests/src/deviceLib/hipTestFMA.cpp b/projects/hip/tests/src/deviceLib/hipTestFMA.cpp index 5e1913a5c7..1f1a5bc921 100644 --- a/projects/hip/tests/src/deviceLib/hipTestFMA.cpp +++ b/projects/hip/tests/src/deviceLib/hipTestFMA.cpp @@ -33,8 +33,7 @@ THE SOFTWARE. #define LEN 50 #define SIZE (LEN * sizeof(bool)) -struct TestFMA { - static __global__ void kernel(bool *Ad) { + __global__ void kernelTestFMA(bool *Ad) { float f = 1.0f / 3.0f; double d = f; int i = 0; @@ -71,7 +70,8 @@ struct TestFMA { while (i < LEN) Check(true); } - void run() { + + void runTestFMA() { bool *Ad; bool A[LEN]; for (unsigned i = 0; i < LEN; i++) { @@ -79,17 +79,15 @@ struct TestFMA { } HIP_ASSERT(hipMalloc((void **)&Ad, SIZE)); - hipLaunchKernelGGL(kernel, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, Ad); + hipLaunchKernelGGL(kernelTestFMA, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, Ad); HIP_ASSERT(hipMemcpy(A, Ad, SIZE, hipMemcpyDeviceToHost)); for (unsigned i = 0; i < LEN; i++) { assert(A[i]); } } -}; -struct TestHalfFMA { - static __global__ void kernel(bool *Ad) { + __global__ void kernelTestHalfFMA(bool *Ad) { _Float16 h = (_Float16)(1.0f/3.0f); float f = h; double d = f; @@ -118,7 +116,7 @@ struct TestHalfFMA { Check(true); } - void run() { + void runTestHalfFMA() { bool *Ad; bool A[LEN]; for (unsigned i = 0; i < LEN; i++) { @@ -126,17 +124,16 @@ struct TestHalfFMA { } HIP_ASSERT(hipMalloc((void **)&Ad, SIZE)); - hipLaunchKernelGGL(kernel, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, Ad); + hipLaunchKernelGGL(kernelTestHalfFMA, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, Ad); HIP_ASSERT(hipMemcpy(A, Ad, SIZE, hipMemcpyDeviceToHost)); for (unsigned i = 0; i < LEN; i++) { assert(A[i]); } } -}; int main() { - TestFMA().run(); - TestHalfFMA().run(); + runTestFMA(); + runTestHalfFMA(); passed(); }