From d0aaed906d0139fcf78dbbcc0f99544533d3e2c8 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Wed, 31 Aug 2022 05:23:21 +0530 Subject: [PATCH] SWDEV-353807 - Fixes multiple catch issues (#2912) - enforcing c++17 for all tests - Warning as error: ignoring return value Change-Id: I3d171540403f74222e631d1a8e393386461c9729 --- catch/ABM/AddKernels/add.cc | 6 ++--- catch/CMakeLists.txt | 3 ++- catch/TypeQualifiers/hipManagedKeyword.cc | 8 +++---- catch/multiproc/deviceAllocationMproc.cc | 4 ++-- catch/multiproc/hipHostMallocTestsMproc.cc | 6 ++--- catch/unit/deviceLib/anyAll.cc | 2 +- catch/unit/deviceLib/deviceAllocation.cc | 24 +++++++++---------- catch/unit/deviceLib/unsafeAtomicAdd.cc | 8 +++---- catch/unit/graph/hipGraph.cc | 2 +- catch/unit/graph/hipGraphAddMemcpyNode.cc | 16 ++++++------- .../graph/hipGraphExecMemcpyNodeSetParams.cc | 8 +++---- .../unit/graph/hipGraphRemoveDependencies.cc | 2 +- catch/unit/graph/hipSimpleGraphWithKernel.cc | 10 ++++---- catch/unit/rtc/saxpy.cc | 8 +++---- catch/unit/rtc/warpsize.cc | 2 +- .../streamperthread/hipStreamPerThrdTsts.cc | 16 ++++++------- .../hipStreamPerThread_DeviceReset.cc | 10 ++++---- .../hipStreamPerThread_MultiThread.cc | 8 +++---- catch/unit/texture/hipBindTex2DPitch.cc | 6 ++--- catch/unit/texture/hipTexObjPitch.cc | 4 ++-- .../unit/texture/hipTextureObj1DCheckModes.cc | 14 +++++------ .../unit/texture/hipTextureObj2DCheckModes.cc | 14 +++++------ .../unit/texture/hipTextureObj3DCheckModes.cc | 16 ++++++------- catch/unit/texture/hipTextureRef2D.cc | 2 +- 24 files changed, 100 insertions(+), 99 deletions(-) diff --git a/catch/ABM/AddKernels/add.cc b/catch/ABM/AddKernels/add.cc index f2be747a77..785d975945 100644 --- a/catch/ABM/AddKernels/add.cc +++ b/catch/ABM/AddKernels/add.cc @@ -33,8 +33,8 @@ TEMPLATE_TEST_CASE("ABM_AddKernel_MultiTypeMultiSize", "", int, long, float, lon res = hipMemcpy(a.data(), d_c, sizeof(TestType) * size, hipMemcpyDeviceToHost); REQUIRE(res == hipSuccess); - hipFree(d_a); - hipFree(d_b); - hipFree(d_c); + HIP_CHECK(hipFree(d_a)); + HIP_CHECK(hipFree(d_b)); + HIP_CHECK(hipFree(d_c)); REQUIRE(a == c); } diff --git a/catch/CMakeLists.txt b/catch/CMakeLists.txt index 905810eae3..e2924a561d 100644 --- a/catch/CMakeLists.txt +++ b/catch/CMakeLists.txt @@ -63,7 +63,8 @@ else() OUTPUT_VARIABLE HIP_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) endif() - +# enforce c++17 for all tests +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++17") string(REPLACE "." ";" VERSION_LIST ${HIP_VERSION}) list(GET VERSION_LIST 0 HIP_VERSION_MAJOR) diff --git a/catch/TypeQualifiers/hipManagedKeyword.cc b/catch/TypeQualifiers/hipManagedKeyword.cc index f5e013b7ba..57462764a9 100644 --- a/catch/TypeQualifiers/hipManagedKeyword.cc +++ b/catch/TypeQualifiers/hipManagedKeyword.cc @@ -53,7 +53,7 @@ TEST_CASE("Unit_hipManagedKeyword_SingleGpu") { hipLaunchKernelGGL(add, dimGrid, dimBlock, 0, 0, static_cast(A), static_cast(B)); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); float maxError = 0.0f; for (int i = 0; i < N; i++) @@ -64,12 +64,12 @@ TEST_CASE("Unit_hipManagedKeyword_SingleGpu") { TEST_CASE("Unit_hipManagedKeyword_MultiGpu") { int numDevices = 0; - hipGetDeviceCount(&numDevices); + HIP_CHECK(hipGetDeviceCount(&numDevices)); for (int i = 0; i < numDevices; i++) { - hipSetDevice(i); + HIP_CHECK(hipSetDevice(i)); GPU_func<<< 1, 1 >>>(); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); } REQUIRE(x == numDevices); } diff --git a/catch/multiproc/deviceAllocationMproc.cc b/catch/multiproc/deviceAllocationMproc.cc index 0958cb8781..c1c15eb5cd 100644 --- a/catch/multiproc/deviceAllocationMproc.cc +++ b/catch/multiproc/deviceAllocationMproc.cc @@ -246,7 +246,7 @@ static bool testDeviceMemMulProc(bool testmalloc) { } // close the read-descriptor close(fd[0]); - hipFree(result_d); + HIP_CHECK(hipFree(result_d)); free(result_h); // wait for child exit wait(NULL); @@ -279,7 +279,7 @@ static bool testDeviceMemMulProc(bool testmalloc) { write(fd[1], result_h, sizeof(int)); // close the write descriptor: close(fd[1]); - hipFree(result_d); + HIP_CHECK(hipFree(result_d)); free(result_h); exit(0); } diff --git a/catch/multiproc/hipHostMallocTestsMproc.cc b/catch/multiproc/hipHostMallocTestsMproc.cc index 2e9a186187..b07922ec4b 100644 --- a/catch/multiproc/hipHostMallocTestsMproc.cc +++ b/catch/multiproc/hipHostMallocTestsMproc.cc @@ -190,7 +190,7 @@ static bool validatePageTableAllocations(const char *devList, int visDevCnt) { setenv("HIP_VISIBLE_DEVICES", devList, 1); // First Call to initialize hip api - hipGetDeviceCount(&tmpdev); + HIP_CHECK(hipGetDeviceCount(&tmpdev)); // Get memory snapshot before hostmalloc @@ -214,7 +214,7 @@ static bool validatePageTableAllocations(const char *devList, int visDevCnt) { printf("Error while running rsmi_dev_memory_usage_get func\n"); dlclose(rocm_smi_h); rsmi_shut_down_fp(); - hipHostFree(ptr); + HIP_CHECK(hipHostFree(ptr)); return false; } current.push_back(used); @@ -236,7 +236,7 @@ static bool validatePageTableAllocations(const char *devList, int visDevCnt) { testPassed = false; } - hipHostFree(ptr); + HIP_CHECK(hipHostFree(ptr)); // writing only, no need for read-descriptor close(fd[0]); diff --git a/catch/unit/deviceLib/anyAll.cc b/catch/unit/deviceLib/anyAll.cc index 1d660f7c7c..f9e690941c 100644 --- a/catch/unit/deviceLib/anyAll.cc +++ b/catch/unit/deviceLib/anyAll.cc @@ -33,7 +33,7 @@ __global__ void warpvote(int* device_any, int* device_all, int pshift) { TEST_CASE("Unit_AnyAll_CompileTest") { int warpSize, pshift; hipDeviceProp_t devProp; - hipGetDeviceProperties(&devProp, 0); + HIP_CHECK(hipGetDeviceProperties(&devProp, 0)); warpSize = devProp.warpSize; int w = warpSize; diff --git a/catch/unit/deviceLib/deviceAllocation.cc b/catch/unit/deviceLib/deviceAllocation.cc index 4982e4f976..63cba2171e 100644 --- a/catch/unit/deviceLib/deviceAllocation.cc +++ b/catch/unit/deviceLib/deviceAllocation.cc @@ -411,7 +411,7 @@ static bool TestAllocInAllThread(int test_type, break; } } - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -443,7 +443,7 @@ static bool TestMemoryAccessInAllThread(int test_type, int thread_idx) { break; } } - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -502,7 +502,7 @@ static bool TestMemoryAcrossMulKernels(int test_type, break; } } - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -562,7 +562,7 @@ static bool TestDevMemAllocMulKerMulThrd(int test_type) { break; } } - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -592,7 +592,7 @@ static bool TestMemoryAccessInAllThread_CmplxStr(int test_type) { break; } } - hipFree(result_d); + HIP_CHECK(hipFree(result_d)); free(result_h); return bPassed; } @@ -648,7 +648,7 @@ static bool TestMemoryAccessInAllThread_Union(int test_type) { } if (bPassed == false) break; } - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -706,7 +706,7 @@ static bool TestAlloc_Load_SingleKer_AllocFree(int test_type, } HIP_CHECK(hipModuleUnload(Module)); HIP_CHECK(hipStreamDestroy(stream)); - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -808,8 +808,8 @@ static bool TestAlloc_Load_MultKernels(int test_type, HIP_CHECK(hipModuleUnload(ModuleWrite)); HIP_CHECK(hipModuleUnload(ModuleFree)); HIP_CHECK(hipStreamDestroy(stream)); - hipFree(dev_addr); - hipFree(outputVec_d); + HIP_CHECK(hipFree(dev_addr)); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -895,7 +895,7 @@ static bool TestMemoryAcrossMulKernelsUsingGraph(int test_type) { } HIP_CHECK(hipStreamDestroy(streamForGraph)); HIP_CHECK(hipGraphExecDestroy(graphExec)); - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -924,7 +924,7 @@ static bool TestAllocInDeviceFunc(int test_type) { break; } } - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); return bPassed; } @@ -1367,7 +1367,7 @@ TEST_CASE("Unit_deviceAllocation_VirtualFunction") { } } REQUIRE(true == bPassed); - hipFree(outputVec_d); + HIP_CHECK(hipFree(outputVec_d)); free(outputVec_h); } diff --git a/catch/unit/deviceLib/unsafeAtomicAdd.cc b/catch/unit/deviceLib/unsafeAtomicAdd.cc index b48c5d1668..a4e005404b 100644 --- a/catch/unit/deviceLib/unsafeAtomicAdd.cc +++ b/catch/unit/deviceLib/unsafeAtomicAdd.cc @@ -114,16 +114,16 @@ TEST_CASE("Unit_unsafeAtomicAdd") { void* config_d[] = {HIP_LAUNCH_PARAM_BUFFER_POINTER, &args_d, HIP_LAUNCH_PARAM_BUFFER_SIZE, &size_d, HIP_LAUNCH_PARAM_END}; - hipModuleLaunchKernel(f_kernel, 10, 1, 1, 100, 1, 1, 0, nullptr, nullptr, config_f); - hipModuleLaunchKernel(d_kernel, 10, 1, 1, 100, 1, 1, 0, nullptr, nullptr, config_d); + HIP_CHECK(hipModuleLaunchKernel(f_kernel, 10, 1, 1, 100, 1, 1, 0, nullptr, nullptr, config_f)); + HIP_CHECK(hipModuleLaunchKernel(d_kernel, 10, 1, 1, 100, 1, 1, 0, nullptr, nullptr, config_d)); float res_f = 0.0f; double res_d = 0.0; HIP_CHECK(hipMemcpy(&res_f, fX, sizeof(float), hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(&res_d, dX, sizeof(double), hipMemcpyDeviceToHost)); - hipFree(dX); - hipFree(fX); + HIP_CHECK(hipFree(dX)); + HIP_CHECK(hipFree(fX)); HIP_CHECK(hipModuleUnload(module)); diff --git a/catch/unit/graph/hipGraph.cc b/catch/unit/graph/hipGraph.cc index e653f8abd8..59c552c753 100644 --- a/catch/unit/graph/hipGraph.cc +++ b/catch/unit/graph/hipGraph.cc @@ -316,7 +316,7 @@ TEST_CASE("Unit_hipGraph_BasicFunctional") { INFO("Elements : " << size << " ThreadsPerBlock : " << THREADS_PER_BLOCK); INFO("Graph Launch iterations = " << GRAPH_LAUNCH_ITERATIONS); - hipSetDevice(0); + HIP_CHECK(hipSetDevice(0)); inputVec_h = reinterpret_cast(malloc(sizeof(float) * size)); REQUIRE(inputVec_h != nullptr); HIP_CHECK(hipMalloc(&inputVec_d, sizeof(float) * size)); diff --git a/catch/unit/graph/hipGraphAddMemcpyNode.cc b/catch/unit/graph/hipGraphAddMemcpyNode.cc index 3e754c263c..5612f998ef 100644 --- a/catch/unit/graph/hipGraphAddMemcpyNode.cc +++ b/catch/unit/graph/hipGraphAddMemcpyNode.cc @@ -161,12 +161,12 @@ TEST_CASE("Unit_hipGraphAddMemcpyNode_Negative") { myparams.dstArray = devArray2; ret = hipGraphAddMemcpyNode(&memcpyNode, graph, nullptr, 0, &myparams); REQUIRE(hipErrorInvalidValue == ret); - hipFreeArray(devArray2); + HIP_CHECK(hipFreeArray(devArray2)); } HIP_CHECK(hipGraphDestroy(graph)); HIP_CHECK(hipStreamDestroy(streamForGraph)); - hipFreeArray(devArray1); + HIP_CHECK(hipFreeArray(devArray1)); free(hData); free(hOutputData); } @@ -268,8 +268,8 @@ static void validateMemcpyNode3DArray(bool peerAccess = false) { HIP_CHECK(hipGraphExecDestroy(graphExec)); HIP_CHECK(hipGraphDestroy(graph)); HIP_CHECK(hipStreamDestroy(streamForGraph)); - hipFreeArray(devArray1); - hipFreeArray(devArray2); + HIP_CHECK(hipFreeArray(devArray1)); + HIP_CHECK(hipFreeArray(devArray2)); free(hData); free(hOutputData); } @@ -369,8 +369,8 @@ static void validateMemcpyNode2DArray(bool peerAccess = false) { HIP_CHECK(hipGraphExecDestroy(graphExec)); HIP_CHECK(hipGraphDestroy(graph)); HIP_CHECK(hipStreamDestroy(streamForGraph)); - hipFreeArray(devArray1); - hipFreeArray(devArray2); + HIP_CHECK(hipFreeArray(devArray1)); + HIP_CHECK(hipFreeArray(devArray2)); } static void validateMemcpyNode1DArray(bool peerAccess = false) { @@ -464,8 +464,8 @@ static void validateMemcpyNode1DArray(bool peerAccess = false) { HIP_CHECK(hipGraphExecDestroy(graphExec)); HIP_CHECK(hipGraphDestroy(graph)); HIP_CHECK(hipStreamDestroy(streamForGraph)); - hipFreeArray(devArray1); - hipFreeArray(devArray2); + HIP_CHECK(hipFreeArray(devArray1)); + HIP_CHECK(hipFreeArray(devArray2)); } /** diff --git a/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc b/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc index d19603284c..f849f45487 100644 --- a/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc +++ b/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc @@ -144,8 +144,8 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Negative") { } HIP_CHECK(hipGraphExecDestroy(graphExec)); HIP_CHECK(hipGraphDestroy(graph)); - hipFreeArray(devArray); - hipFreeArray(devArray2); + HIP_CHECK(hipFreeArray(devArray)); + HIP_CHECK(hipFreeArray(devArray2)); free(hData); } @@ -254,6 +254,6 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Functional") { HIP_CHECK(hipGraphExecDestroy(graphExec)); HIP_CHECK(hipGraphDestroy(graph)); HIP_CHECK(hipStreamDestroy(streamForGraph)); - hipFreeArray(devArray1); - hipFreeArray(devArray2); + HIP_CHECK(hipFreeArray(devArray1)); + HIP_CHECK(hipFreeArray(devArray2)); } diff --git a/catch/unit/graph/hipGraphRemoveDependencies.cc b/catch/unit/graph/hipGraphRemoveDependencies.cc index de542facfd..5d18d2effe 100644 --- a/catch/unit/graph/hipGraphRemoveDependencies.cc +++ b/catch/unit/graph/hipGraphRemoveDependencies.cc @@ -347,7 +347,7 @@ TEST_CASE("Unit_hipGraphRemoveDependencies_ChangeComputeFunc") { kernelNodeParams.extra = nullptr; HIP_CHECK(hipGraphAddKernelNode(&kernel_square, graph, nullptr, 0, &kernelNodeParams)); - hipGraphRemoveDependencies(graph, &memcpyH2D_B, &kernel_vecAdd, 1); + HIP_CHECK(hipGraphRemoveDependencies(graph, &memcpyH2D_B, &kernel_vecAdd, 1)); // Add new dependencies HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_B, &kernel_square, 1)); HIP_CHECK(hipGraphAddDependencies(graph, &kernel_square, diff --git a/catch/unit/graph/hipSimpleGraphWithKernel.cc b/catch/unit/graph/hipSimpleGraphWithKernel.cc index 48cbb9a42c..08f20cbe45 100644 --- a/catch/unit/graph/hipSimpleGraphWithKernel.cc +++ b/catch/unit/graph/hipSimpleGraphWithKernel.cc @@ -60,18 +60,18 @@ static void hipTestWithGraph() { hipGraph_t graph; hipGraphExec_t instance; - hipStreamBeginCapture(stream, hipStreamCaptureModeGlobal); + HIP_CHECK(hipStreamBeginCapture(stream, hipStreamCaptureModeGlobal)); for (int ikrnl = 0; ikrnl < NKERNEL; ikrnl++) { simpleKernel<<>>(out_d, in_d); } - hipStreamEndCapture(stream, &graph); - hipGraphInstantiate(&instance, graph, nullptr, nullptr, 0); + HIP_CHECK(hipStreamEndCapture(stream, &graph)); + HIP_CHECK(hipGraphInstantiate(&instance, graph, nullptr, nullptr, 0)); auto start1 = std::chrono::high_resolution_clock::now(); for (int istep = 0; istep < NSTEP; istep++) { - hipGraphLaunch(instance, stream); - hipStreamSynchronize(stream); + HIP_CHECK(hipGraphLaunch(instance, stream)); + HIP_CHECK(hipStreamSynchronize(stream)); } auto stop = std::chrono::high_resolution_clock::now(); auto withInit = std::chrono::duration(stop - start); diff --git a/catch/unit/rtc/saxpy.cc b/catch/unit/rtc/saxpy.cc index a200b30d19..06379a686c 100644 --- a/catch/unit/rtc/saxpy.cc +++ b/catch/unit/rtc/saxpy.cc @@ -98,13 +98,13 @@ TEST_CASE("Unit_hiprtc_saxpy") { void* config[] = {HIP_LAUNCH_PARAM_BUFFER_POINTER, &args, HIP_LAUNCH_PARAM_BUFFER_SIZE, &size, HIP_LAUNCH_PARAM_END}; - hipModuleLaunchKernel(kernel, NUM_BLOCKS, 1, 1, NUM_THREADS, 1, 1, 0, nullptr, nullptr, config); + HIP_CHECK(hipModuleLaunchKernel(kernel, NUM_BLOCKS, 1, 1, NUM_THREADS, 1, 1, 0, nullptr, nullptr, config)); HIP_CHECK(hipMemcpy(hOut.get(), dOut, bufferSize, hipMemcpyDeviceToHost)); - hipFree(dX); - hipFree(dY); - hipFree(dOut); + HIP_CHECK(hipFree(dX)); + HIP_CHECK(hipFree(dY)); + HIP_CHECK(hipFree(dOut)); HIP_CHECK(hipModuleUnload(module)); diff --git a/catch/unit/rtc/warpsize.cc b/catch/unit/rtc/warpsize.cc index a4b534b4d2..5eadcb260a 100644 --- a/catch/unit/rtc/warpsize.cc +++ b/catch/unit/rtc/warpsize.cc @@ -50,7 +50,7 @@ TEST_CASE("Unit_hiprtc_warpsize") { hipDeviceProp_t props; int device = 0; - hipGetDeviceProperties(&props, device); + HIP_CHECK(hipGetDeviceProperties(&props, device)); #ifdef __HIP_PLATFORM_AMD__ std::string sarg = std::string("--gpu-architecture=") + props.gcnArchName; #else diff --git a/catch/unit/streamperthread/hipStreamPerThrdTsts.cc b/catch/unit/streamperthread/hipStreamPerThrdTsts.cc index 8aba0fa0f5..418e5332ab 100644 --- a/catch/unit/streamperthread/hipStreamPerThrdTsts.cc +++ b/catch/unit/streamperthread/hipStreamPerThrdTsts.cc @@ -495,10 +495,10 @@ TEST_CASE("Unit_hipStreamPerThread_CoopLaunchMDev") { // Calculate the device occupancy to know how many blocks can be // run concurrently - hipGetDeviceProperties(&deviceProp[i], 0); + HIP_CHECK(hipGetDeviceProperties(&deviceProp[i], 0)); if (!deviceProp[i].cooperativeMultiDeviceLaunch) { WARN("Device doesn't support cooperative launch!"); - SUCCEED(""); + return; } size_t SIZE = copySizeInDwords * sizeof(uint); @@ -511,7 +511,7 @@ TEST_CASE("Unit_hipStreamPerThread_CoopLaunchMDev") { } HIPCHECK(hipMemcpy(dA[i], &init[i * copySizeInDwords] , SIZE, hipMemcpyHostToDevice)); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); } dim3 dimBlock; @@ -560,7 +560,7 @@ TEST_CASE("Unit_hipStreamPerThread_CoopLaunchMDev") { } system_clock::time_point start = system_clock::now(); - hipLaunchCooperativeKernelMultiDevice(launchParamsList, nGpu, 0); + HIP_CHECK(hipLaunchCooperativeKernelMultiDevice(launchParamsList, nGpu, 0)); for (int i = 0; i < nGpu; i++) { HIP_CHECK(hipSetDevice(i)); HIP_CHECK(hipDeviceSynchronize()); @@ -586,11 +586,11 @@ TEST_CASE("Unit_hipStreamPerThread_CoopLaunchMDev") { WARN("finished computation at " << std::ctime(&end_time)); WARN("elapsed time: " << time << "s\n"); - hipSetDevice(0); - hipFree(dC); + HIP_CHECK(hipSetDevice(0)); + HIP_CHECK(hipFree(dC)); for (int i = 0; i < nGpu; i++) { - hipFree(dA[i]); - hipFree(dB[i]); + HIP_CHECK(hipFree(dA[i])); + HIP_CHECK(hipFree(dB[i])); } delete [] init; } diff --git a/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc b/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc index dc1c59ee5b..31f4079f61 100644 --- a/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc +++ b/catch/unit/streamperthread/hipStreamPerThread_DeviceReset.cc @@ -41,8 +41,8 @@ static void Copy_to_device() { for(unsigned int i = 0; i < ele_size; ++i) { A_h[i] = 123; } - hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, - hipStreamPerThread); + HIP_CHECK(hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, + hipStreamPerThread)); } TEST_CASE("Unit_hipStreamPerThread_DeviceReset_1") { @@ -80,9 +80,9 @@ TEST_CASE("Unit_hipStreamPerThread_DeviceReset_2") { status = hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, hipStreamPerThread); if (status != hipSuccess) return; - hipStreamSynchronize(hipStreamPerThread); + HIP_CHECK(hipStreamSynchronize(hipStreamPerThread)); - hipDeviceReset(); + HIP_CHECK(hipDeviceReset()); // After reset all memory objects will be destroyed hence allocating them again // Intension is to use hipStreamPerThread successfully after reset hence not validating @@ -95,5 +95,5 @@ TEST_CASE("Unit_hipStreamPerThread_DeviceReset_2") { status = hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, hipStreamPerThread); if (status != hipSuccess) return; - hipStreamSynchronize(hipStreamPerThread); + HIP_CHECK(hipStreamSynchronize(hipStreamPerThread)); } diff --git a/catch/unit/streamperthread/hipStreamPerThread_MultiThread.cc b/catch/unit/streamperthread/hipStreamPerThread_MultiThread.cc index a0ff7ed6be..ec34c6de77 100644 --- a/catch/unit/streamperthread/hipStreamPerThread_MultiThread.cc +++ b/catch/unit/streamperthread/hipStreamPerThread_MultiThread.cc @@ -26,14 +26,14 @@ static void Copy_to_device() { int* A_h = nullptr; int* A_d = nullptr; - hipHostMalloc(&A_h, ele_size*sizeof(int)); - hipMalloc(&A_d, ele_size * sizeof(int)); + HIP_CHECK(hipHostMalloc(&A_h, ele_size*sizeof(int))); + HIP_CHECK(hipMalloc(&A_d, ele_size * sizeof(int))); for (unsigned int i = 0; i < ele_size; ++i) { A_h[i] = 123; } - hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, - hipStreamPerThread); + HIP_CHECK(hipMemcpyAsync(A_d, A_h, ele_size * sizeof(int), hipMemcpyHostToDevice, + hipStreamPerThread)); } /* diff --git a/catch/unit/texture/hipBindTex2DPitch.cc b/catch/unit/texture/hipBindTex2DPitch.cc index 2a7aab6fa6..fc5c5e5b59 100644 --- a/catch/unit/texture/hipBindTex2DPitch.cc +++ b/catch/unit/texture/hipBindTex2DPitch.cc @@ -66,13 +66,13 @@ TEST_CASE("Unit_hipBindTexture2D_Pitch") { hipLaunchKernelGGL(texture2dCopyKernel, dim3(4, 4, 1), dim3(32, 32, 1), 0, 0, devPtrB); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy2D(B, SIZE_W*sizeof(TYPE_t), devPtrB, SIZE_W*sizeof(TYPE_t), SIZE_W*sizeof(TYPE_t), SIZE_H, hipMemcpyDeviceToHost)); HipTest::checkArray(A, B, SIZE_H, SIZE_W); delete []A; delete []B; - hipFree(devPtrA); - hipFree(devPtrB); + HIP_CHECK(hipFree(devPtrA)); + HIP_CHECK(hipFree(devPtrB)); } diff --git a/catch/unit/texture/hipTexObjPitch.cc b/catch/unit/texture/hipTexObjPitch.cc index 727d8a64f2..6c7184bd3a 100644 --- a/catch/unit/texture/hipTexObjPitch.cc +++ b/catch/unit/texture/hipTexObjPitch.cc @@ -93,6 +93,6 @@ TEMPLATE_TEST_CASE("Unit_hipTexObjPitch_texture2D", "", float, int, HipTest::checkArray(A, B, SIZE_H, SIZE_W); delete []A; delete []B; - hipFree(devPtrA); - hipFree(devPtrB); + HIP_CHECK(hipFree(devPtrA)); + HIP_CHECK(hipFree(devPtrB)); } diff --git a/catch/unit/texture/hipTextureObj1DCheckModes.cc b/catch/unit/texture/hipTextureObj1DCheckModes.cc index 7ff602ab79..a1c1ca2756 100644 --- a/catch/unit/texture/hipTextureObj1DCheckModes.cc +++ b/catch/unit/texture/hipTextureObj1DCheckModes.cc @@ -44,7 +44,7 @@ void runTest(const int width, const float offsetX) { hipChannelFormatDesc channelDesc = hipCreateChannelDesc( 32, 0, 0, 0, hipChannelFormatKindFloat); hipArray *hipArray; - hipMallocArray(&hipArray, &channelDesc, width); + HIP_CHECK(hipMallocArray(&hipArray, &channelDesc, width)); HIP_CHECK(hipMemcpy2DToArray(hipArray, 0, 0, hData, width * sizeof(float), width * sizeof(float), 1, hipMemcpyHostToDevice)); @@ -66,7 +66,7 @@ void runTest(const int width, const float offsetX) { HIP_CHECK(hipCreateTextureObject(&textureObject, &resDesc, &texDesc, NULL)); float *dData = nullptr; - hipMalloc((void**) &dData, size); + HIP_CHECK(hipMalloc((void**) &dData, size)); dim3 dimBlock(16, 1, 1); dim3 dimGrid((width + dimBlock.x - 1)/ dimBlock.x, 1, 1); @@ -74,11 +74,11 @@ void runTest(const int width, const float offsetX) { hipLaunchKernelGGL(tex1DKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, offsetX); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); float *hOutputData = (float*) malloc(size); memset(hOutputData, 0, size); - hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost); + HIP_CHECK(hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost)); bool result = true; for (int j = 0; j < width; j++) { @@ -91,9 +91,9 @@ void runTest(const int width, const float offsetX) { } } - hipDestroyTextureObject(textureObject); - hipFree(dData); - hipFreeArray(hipArray); + HIP_CHECK(hipDestroyTextureObject(textureObject)); + HIP_CHECK(hipFree(dData)); + HIP_CHECK(hipFreeArray(hipArray)); free(hData); free(hOutputData); REQUIRE(result); diff --git a/catch/unit/texture/hipTextureObj2DCheckModes.cc b/catch/unit/texture/hipTextureObj2DCheckModes.cc index 34696b32e3..a09946e008 100644 --- a/catch/unit/texture/hipTextureObj2DCheckModes.cc +++ b/catch/unit/texture/hipTextureObj2DCheckModes.cc @@ -51,7 +51,7 @@ void runTest(const int width, const int height, const float offsetX, const float hipChannelFormatDesc channelDesc = hipCreateChannelDesc( 32, 0, 0, 0, hipChannelFormatKindFloat); hipArray *hipArray; - hipMallocArray(&hipArray, &channelDesc, width, height); + HIP_CHECK(hipMallocArray(&hipArray, &channelDesc, width, height)); HIP_CHECK(hipMemcpy2DToArray(hipArray, 0, 0, hData, width * sizeof(float), width * sizeof(float), height, hipMemcpyHostToDevice)); @@ -74,7 +74,7 @@ void runTest(const int width, const int height, const float offsetX, const float HIP_CHECK(hipCreateTextureObject(&textureObject, &resDesc, &texDesc, NULL)); float *dData = nullptr; - hipMalloc((void**) &dData, size); + HIP_CHECK(hipMalloc((void**) &dData, size)); dim3 dimBlock(16, 16, 1); dim3 dimGrid((width + dimBlock.x - 1) / dimBlock.x, (height + dimBlock.y -1)/ dimBlock.y, 1); @@ -82,11 +82,11 @@ void runTest(const int width, const int height, const float offsetX, const float hipLaunchKernelGGL(tex2DKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, height, offsetX, offsetY); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); float *hOutputData = (float*) malloc(size); memset(hOutputData, 0, size); - hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost); + HIP_CHECK(hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost)); bool result = true; for (int i = 0; i < height; i++) { @@ -103,9 +103,9 @@ void runTest(const int width, const int height, const float offsetX, const float } } line1: - hipDestroyTextureObject(textureObject); - hipFree(dData); - hipFreeArray(hipArray); + HIP_CHECK(hipDestroyTextureObject(textureObject)); + HIP_CHECK(hipFree(dData)); + HIP_CHECK(hipFreeArray(hipArray)); free(hData); free(hOutputData); REQUIRE(result); diff --git a/catch/unit/texture/hipTextureObj3DCheckModes.cc b/catch/unit/texture/hipTextureObj3DCheckModes.cc index df5132972b..eb54713763 100644 --- a/catch/unit/texture/hipTextureObj3DCheckModes.cc +++ b/catch/unit/texture/hipTextureObj3DCheckModes.cc @@ -93,7 +93,7 @@ void runTest(const int width, const int height, const int depth, const float off hipTextureObject_t textureObject = 0; hipError_t res = hipCreateTextureObject(&textureObject, &resDesc, &texDesc, NULL); if (res != hipSuccess) { - hipFreeArray(arr); + HIP_CHECK(hipFreeArray(arr)); free(hData); if (res == hipErrorNotSupported && isGfx90a) { printf("gfx90a doesn't support 3D linear filter! Skipped!\n"); @@ -105,8 +105,8 @@ void runTest(const int width, const int height, const int depth, const float off } float *dData = nullptr; - hipMalloc((void**) &dData, size); - hipMemset(dData, 0, size); + HIP_CHECK(hipMalloc((void**) &dData, size)); + HIP_CHECK(hipMemset(dData, 0, size)); dim3 dimBlock(8, 8, 8); // 512 threads dim3 dimGrid((width + dimBlock.x - 1) / dimBlock.x, (height + dimBlock.y -1)/ dimBlock.y, (depth + dimBlock.z - 1) / dimBlock.z); @@ -114,11 +114,11 @@ void runTest(const int width, const int height, const int depth, const float off hipLaunchKernelGGL(tex3DKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, height, depth, offsetX, offsetY, offsetZ); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); float *hOutputData = (float*) malloc(size); memset(hOutputData, 0, size); - hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost); + HIP_CHECK(hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost)); for (int i = 0; i < depth; i++) { for (int j = 0; j < height; j++) { @@ -137,10 +137,10 @@ void runTest(const int width, const int height, const int depth, const float off } } line1: - hipDestroyTextureObject(textureObject); + HIP_CHECK(hipDestroyTextureObject(textureObject)); free(hOutputData); - hipFree(dData); - hipFreeArray(arr); + HIP_CHECK(hipFree(dData)); + HIP_CHECK(hipFreeArray(arr)); free(hData); REQUIRE(result); diff --git a/catch/unit/texture/hipTextureRef2D.cc b/catch/unit/texture/hipTextureRef2D.cc index a4abcd4975..b4c98d7ae9 100644 --- a/catch/unit/texture/hipTextureRef2D.cc +++ b/catch/unit/texture/hipTextureRef2D.cc @@ -69,7 +69,7 @@ TEST_CASE("Unit_hipTextureRef2D_Check") { dim3 dimGrid(width / dimBlock.x, height / dimBlock.y, 1); hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, width); - hipDeviceSynchronize(); + HIP_CHECK(hipDeviceSynchronize()); float* hOutputData = reinterpret_cast(malloc(size)); REQUIRE(hOutputData != nullptr);