From 201fe67e817cd0eb11ac9b4911eb8c8564b2be2b Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 00:29:06 +0530 Subject: [PATCH 01/39] SWDEV-327563 - Enable fixed tests linux and windows v3 (#2943) Change-Id: Ia5c47821268d7f31b70c473ef2a4785b6735a2f1 --- .../config/config_amd_windows_common.json | 15 +++------------ tests/catch/unit/memory/hipHostRegister.cc | 2 +- tests/catch/unit/memory/hipMemPoolApi.cc | 4 ++-- .../catch/unit/memory/hipPointerGetAttribute.cc | 3 ++- tests/catch/unit/stream/hipStreamValue.cc | 17 ----------------- 5 files changed, 8 insertions(+), 33 deletions(-) diff --git a/tests/catch/hipTestMain/config/config_amd_windows_common.json b/tests/catch/hipTestMain/config/config_amd_windows_common.json index 4264cb5946..96c3fc3a15 100644 --- a/tests/catch/hipTestMain/config/config_amd_windows_common.json +++ b/tests/catch/hipTestMain/config/config_amd_windows_common.json @@ -2,27 +2,18 @@ "DisabledTests": [ "Unit_hipMalloc_CoherentTst", - "Unit_printf_flags", - "Unit_printf_specifier", "Unit_hipTextureMipmapObj2D_Check", "Unit_hipGraphAddHostNode_ClonedGraphwithHostNode", "Unit_hipEventIpc", "Unit_hipMalloc3D_Negative", - "Unit_hipPointerGetAttribute_MappedMem", "Unit_hipStreamValue_Write", - "Unit_hipMemPoolApi_Basic", "Unit_hipMemPoolApi_BasicAlloc", "Unit_hipMemPoolApi_BasicTrim", "Unit_hipMemPoolApi_BasicReuse", "Unit_hipMemPoolApi_Opportunistic", - "Unit_hipMemPoolApi_Default", - "Unit_hipDeviceGetUuid", "Unit_hipGraphMemcpyNodeSetParams_Functional", "Unit_hipMalloc3D_ValidatePitch", "Unit_hipArrayCreate_happy", - "Unit_hipHostRegister_Negative - int", - "Unit_hipHostRegister_Negative - float", - "Unit_hipHostRegister_Negative - double", "Unit_hipMemAllocPitch_ValidatePitch", "Unit_hipArrayCreate_happy - int", "Unit_hipArrayCreate_happy - int4", @@ -32,7 +23,6 @@ "Unit_hipArrayCreate_happy - float", "Unit_hipArrayCreate_happy - float2", "Unit_hipArrayCreate_happy - float4", - "Unit_hipMemVmm_Basic", "Unit_hipGraphExecMemcpyNodeSetParamsToSymbol_Functional", "Unit_hipMallocManaged_MultiChunkMultiDevice", "Unit_hipMallocManaged_TwoPointers - int", @@ -43,9 +33,10 @@ "Unit_hipMallocManaged_DeviceContextChange - float", "Unit_hipMallocManaged_DeviceContextChange - double", "Unit_hipGraphNodeGetDependentNodes_Functional", - "Unit_hipGraphNodeGetDependentNodes_ParamValidation", "Unit_hipGraphNodeGetDependencies_Functional", - "Unit_hipGraphNodeGetDependencies_ParamValidation", + "Unit_hipMemGetInfo_Negative", + "Unit_hipStreamCreateWithPriority_ValidateWithEvents", + "Unit_hipStreamPerThread_StrmWaitEvt", "Unit_hipMemGetInfo_DifferentMallocSmall", "Unit_hipMemGetInfo_MallocArray - int", "Unit_hipMemGetInfo_MallocArray - int4", diff --git a/tests/catch/unit/memory/hipHostRegister.cc b/tests/catch/unit/memory/hipHostRegister.cc index 3ccc79d834..48fcd0e96a 100644 --- a/tests/catch/unit/memory/hipHostRegister.cc +++ b/tests/catch/unit/memory/hipHostRegister.cc @@ -216,7 +216,7 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_Negative", "", int, float, double) { REQUIRE(devMemAvail > 0); REQUIRE(hostMemFree > 0); - size_t memFree = (std::min)(devMemFree, hostMemFree); // which is the limiter cpu or gpu + size_t memFree = (std::max)(devMemFree, hostMemFree); // which is the limiter cpu or gpu SECTION("hipHostRegister Negative Test - invalid memory size") { HIP_CHECK_ERROR(hipHostRegister(hostPtr, memFree, 0), hipErrorInvalidValue); diff --git a/tests/catch/unit/memory/hipMemPoolApi.cc b/tests/catch/unit/memory/hipMemPoolApi.cc index bdb8ccfef4..b09d2432f4 100644 --- a/tests/catch/unit/memory/hipMemPoolApi.cc +++ b/tests/catch/unit/memory/hipMemPoolApi.cc @@ -162,7 +162,7 @@ TEST_CASE("Unit_hipMemPoolApi_BasicAlloc") { std::uint64_t res_after_sync = 0; HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &res_after_sync)); // Sync must releaae memory to OS - REQUIRE(res_after_sync < res_before_sync); + REQUIRE(res_after_sync <= res_before_sync); int value = 0; attr = hipMemPoolReuseFollowEventDependencies; @@ -189,7 +189,7 @@ TEST_CASE("Unit_hipMemPoolApi_BasicAlloc") { attr = hipMemPoolAttrReservedMemHigh; HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value64)); // Must be bigger than current - REQUIRE(value64 > res_after_sync); + REQUIRE(value64 >= res_after_sync); attr = hipMemPoolAttrUsedMemCurrent; HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value64)); diff --git a/tests/catch/unit/memory/hipPointerGetAttribute.cc b/tests/catch/unit/memory/hipPointerGetAttribute.cc index 967a55642b..f56f0a0e49 100644 --- a/tests/catch/unit/memory/hipPointerGetAttribute.cc +++ b/tests/catch/unit/memory/hipPointerGetAttribute.cc @@ -248,7 +248,8 @@ TEST_CASE("Unit_hipPointerGetAttribute_MappedMem") { } HIP_CHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice)); int *ptr1 = 0, *ptr2 = 0; - unsigned int hostMalloc_mapped, mallocManaged; + unsigned int hostMalloc_mapped = 0; + unsigned int mallocManaged = 0; HIP_CHECK(hipHostMalloc(&ptr1, Nbytes, hipHostMallocMapped)); HIP_CHECK(hipMallocManaged(&ptr2, Nbytes, hipMemAttachGlobal)); HIP_CHECK(hipPointerGetAttribute(&hostMalloc_mapped, diff --git a/tests/catch/unit/stream/hipStreamValue.cc b/tests/catch/unit/stream/hipStreamValue.cc index 5e70122195..164384acee 100644 --- a/tests/catch/unit/stream/hipStreamValue.cc +++ b/tests/catch/unit/stream/hipStreamValue.cc @@ -242,10 +242,6 @@ TEMPLATE_TEST_CASE("Unit_hipStreamValue_Write", "", (TestParams), (TestParams), (TestParams)) { -#endif -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-126"); - return; #endif if (!streamWaitValueSupported()) { HipTest::HIP_SKIP_TEST("hipStreamWaitValue not supported on this device."); @@ -303,11 +299,6 @@ void testWait(TEST_WAIT tc) { HipTest::HIP_SKIP_TEST("hipStreamWaitValue not supported on this device."); return; } -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-128"); - return; -#endif - using UIntT = typename TestType::UIntType; constexpr auto ptrType = TestType::ptrType; constexpr UIntT defaultMask = ~static_cast(0); @@ -478,10 +469,6 @@ DEFINE_STREAM_WAIT_VAL_TEST_CASES_INT64("NoMask_Nor", // Negative Tests TEST_CASE("Unit_hipStreamValue_Negative_InvalidMemory") { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-96"); - return; -#endif if (!streamWaitValueSupported()) { HipTest::HIP_SKIP_TEST("hipStreamWaitValue not supported on this device."); return; @@ -513,10 +500,6 @@ TEST_CASE("Unit_hipStreamValue_Negative_InvalidMemory") { } TEMPLATE_TEST_CASE("Unit_hipStreamWaitValue_Negative_InvalidFlag", "", uint32_t, uint64_t) { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-96"); - return; -#endif if (!streamWaitValueSupported()) { HipTest::HIP_SKIP_TEST("hipStreamWaitValue not supported on this device."); return; From 900ae2cc9562a719c17531ea8bd93e856c192360 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:12:28 +0530 Subject: [PATCH 02/39] SWDEV-351285 - Enable test - Unit_hipMemGetInfo_Negative (#2869) Change-Id: Ie3039eb458aedd276d85bc9e44f62e994c7be4c8 --- tests/catch/unit/memory/hipMemGetInfo.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/catch/unit/memory/hipMemGetInfo.cc b/tests/catch/unit/memory/hipMemGetInfo.cc index 93481eb347..24d42bd8b4 100644 --- a/tests/catch/unit/memory/hipMemGetInfo.cc +++ b/tests/catch/unit/memory/hipMemGetInfo.cc @@ -535,10 +535,6 @@ TEST_CASE("Unit_hipMemGetInfo_ParaMultiSmall") { TEST_CASE("Unit_hipMemGetInfo_Negative") { -#if HT_AMD - HipTest::HIP_SKIP_TEST(" EXSWCPHIPT-61"); - return; -#endif size_t freeMemInit; size_t totalMemInit; HIP_CHECK(hipMemGetInfo(&freeMemInit, &totalMemInit)); From 446a4372bc058ab6c87599323c535cd5060d2041 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:13:04 +0530 Subject: [PATCH 03/39] SWDEV-351031 - Enable test - Unit_hipHostRegister_Flags (#2890) Change-Id: I7048699272a40962b12619ffdf22cc17053400f2 --- tests/catch/unit/memory/hipHostRegister.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/catch/unit/memory/hipHostRegister.cc b/tests/catch/unit/memory/hipHostRegister.cc index 48fcd0e96a..8d30ae30f7 100644 --- a/tests/catch/unit/memory/hipHostRegister.cc +++ b/tests/catch/unit/memory/hipHostRegister.cc @@ -162,11 +162,6 @@ template __global__ void fill_kernel(T* dataPtr, T value) { } TEMPLATE_TEST_CASE("Unit_hipHostRegister_Flags", "", int, float, double) { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-138"); - return; -#else - size_t sizeBytes = 1 * sizeof(TestType); TestType* hostPtr = reinterpret_cast(malloc(sizeBytes)); @@ -193,7 +188,6 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_Flags", "", int, float, double) { } free(hostPtr); -#endif } TEMPLATE_TEST_CASE("Unit_hipHostRegister_Negative", "", int, float, double) { From c74e0fc3553b7e98a7a8c3c3b012105778688126 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:13:44 +0530 Subject: [PATCH 04/39] SWDEV-351225 - Enable test - Unit_hipArrayCreate_Nullptr (#2891) Change-Id: Ib9d43e0285ec50fdbf3ae05ed0d107b27280bfb0 --- tests/catch/unit/memory/hipArrayCreate.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/catch/unit/memory/hipArrayCreate.cc b/tests/catch/unit/memory/hipArrayCreate.cc index efffc344e5..1db90d8a1b 100644 --- a/tests/catch/unit/memory/hipArrayCreate.cc +++ b/tests/catch/unit/memory/hipArrayCreate.cc @@ -322,10 +322,6 @@ TEST_CASE("Unit_hipArrayCreate_ZeroWidth") { // HipArrayCreate will return an error when nullptr is used as the array argument TEST_CASE("Unit_hipArrayCreate_Nullptr") { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-130"); - return; -#endif DriverContext ctx; SECTION("Null array") { HIP_ARRAY_DESCRIPTOR desc; From 7d705d800a12a2c72b9844c7e14722f878462e1a Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:14:13 +0530 Subject: [PATCH 05/39] SWDEV-351192 - Enable test - Unit_hipMalloc3DArray_MaxTexture (#2892) Change-Id: Ie10d63a8a39ac5aabd6eae078f0423375cd7d230 --- tests/catch/unit/memory/hipMalloc3DArray.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/catch/unit/memory/hipMalloc3DArray.cc b/tests/catch/unit/memory/hipMalloc3DArray.cc index 03d08760d4..73d50ad943 100644 --- a/tests/catch/unit/memory/hipMalloc3DArray.cc +++ b/tests/catch/unit/memory/hipMalloc3DArray.cc @@ -163,11 +163,6 @@ TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_happy", "", char, uchar2, uint2, int4, TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_MaxTexture", "", int, uint4, short, ushort2, unsigned char, float, float4) { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-97"); - return; -#endif - hipArray_t array; const hipChannelFormatDesc desc = hipCreateChannelDesc(); #if HT_AMD From 0aea7409f001169d6ce66a263e76d09d7c0e7aa4 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:14:40 +0530 Subject: [PATCH 06/39] SWDEV-351282 - Enable test - Unit_hipArray3DCreate_Negative_NullDescPtr (#2896) Change-Id: I162db667e0557e172638dc6c0dc6ea82ac7db564 --- tests/catch/unit/memory/hipArray3DCreate.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/catch/unit/memory/hipArray3DCreate.cc b/tests/catch/unit/memory/hipArray3DCreate.cc index 46c31c1b52..973868eded 100644 --- a/tests/catch/unit/memory/hipArray3DCreate.cc +++ b/tests/catch/unit/memory/hipArray3DCreate.cc @@ -214,11 +214,6 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_NullArrayPtr") { // Providing the description pointer as nullptr should return an error TEST_CASE("Unit_hipArray3DCreate_Negative_NullDescPtr") { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-130"); - return; -#endif - DriverContext ctx; hiparray array; HIP_CHECK_ERROR(hipArray3DCreate(&array, nullptr), hipErrorInvalidValue); From cd1e9a2775d9dd267d73f6fcb4061b6a22f4a91e Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:15:27 +0530 Subject: [PATCH 07/39] SWDEV-351033 - Enable test - Unit_hipHostUnregister_* (#2897) Change-Id: Ibcde7a127546941fe1fc65ce2250dfdd2b24d88c --- tests/catch/unit/memory/hipHostUnregister.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/catch/unit/memory/hipHostUnregister.cc b/tests/catch/unit/memory/hipHostUnregister.cc index 2b54c10731..69373133d0 100644 --- a/tests/catch/unit/memory/hipHostUnregister.cc +++ b/tests/catch/unit/memory/hipHostUnregister.cc @@ -69,19 +69,11 @@ TEST_CASE("Unit_hipHostUnregister_NullPtr") { } TEST_CASE("Unit_hipHostUnregister_NotRegisteredPointer") { -#if HT_AMD - HipTest::HIP_SKIP_TEST("TODO-MATCH-ERRORCODE"); - return; -#endif auto x = std::unique_ptr(new int); HIP_CHECK_ERROR(hipHostUnregister(x.get()), hipErrorHostMemoryNotRegistered); } TEST_CASE("Unit_hipHostUnregister_AlreadyUnregisteredPointer") { -#if HT_AMD - HipTest::HIP_SKIP_TEST("TODO-MATCH-ERRORCODE"); - return; -#endif if (!hipHostRegisterSupported()) { return; } From 411a00b23260fddee9f756782f8fc7e4184104c9 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:35:04 +0530 Subject: [PATCH 08/39] SWDEV-312707 - Avoid Char[] memory corrption on high GPU systems by increasing array size. (#2954) Change-Id: Ia743e87d4cbcc9ccaa9e782109114dd878ab8b0d --- tests/src/runtimeApi/device/hipSetGetDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/runtimeApi/device/hipSetGetDevice.cpp b/tests/src/runtimeApi/device/hipSetGetDevice.cpp index d82ac5916e..63dd1b01c9 100644 --- a/tests/src/runtimeApi/device/hipSetGetDevice.cpp +++ b/tests/src/runtimeApi/device/hipSetGetDevice.cpp @@ -86,7 +86,7 @@ void getDeviceCount(int *numDevices) { #endif } -#define MAX_SIZE 30 +#define MAX_SIZE 1024 // Pass either -1 in deviceNumber or invalid device number bool testInvalidDevice(int numDevices, bool useRocrEnv, int deviceNumber) { From cac4154ddf48cd24596dec3c117175996e146666 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:35:27 +0530 Subject: [PATCH 09/39] SWDEV-306122 - [catch2][dtest] Tests for hipGraphHostNodeGetParams API (#2949) Added Negative and functional tests for hipGraphHostNodeGetParams API. Change-Id: Ic9e841875673c10cea9a47f98cd47ff4995f888a --- .../config/config_amd_windows_common.json | 5 +- tests/catch/unit/graph/CMakeLists.txt | 1 + .../unit/graph/hipGraphHostNodeGetParams.cc | 275 ++++++++++++++++++ 3 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 tests/catch/unit/graph/hipGraphHostNodeGetParams.cc diff --git a/tests/catch/hipTestMain/config/config_amd_windows_common.json b/tests/catch/hipTestMain/config/config_amd_windows_common.json index 96c3fc3a15..26c341d51d 100644 --- a/tests/catch/hipTestMain/config/config_amd_windows_common.json +++ b/tests/catch/hipTestMain/config/config_amd_windows_common.json @@ -64,6 +64,9 @@ "Unit_hipMultiThreadDevice_NearZero", "Unit_hipStreamPerThread_DeviceReset_1", "Unit_hipStreamCreateWithPriority_ValidateWithEvents", - "Unit_hipStreamPerThread_StrmWaitEvt" + "Unit_hipStreamPerThread_StrmWaitEvt", + "Unit_hipGraphHostNodeGetParams_ClonedGraphwithHostNode", + "Unit_hipGraphHostNodeGetParams_BasicFunc", + "Unit_hipGraphHostNodeGetParams_SetParams" ] } diff --git a/tests/catch/unit/graph/CMakeLists.txt b/tests/catch/unit/graph/CMakeLists.txt index 07e62fe261..244fbf6845 100644 --- a/tests/catch/unit/graph/CMakeLists.txt +++ b/tests/catch/unit/graph/CMakeLists.txt @@ -76,6 +76,7 @@ set(TEST_SRC hipGraphExecMemcpyNodeSetParamsToSymbol.cc hipGraphNodeGetDependentNodes.cc hipGraphNodeGetDependencies.cc + hipGraphHostNodeGetParams.cc ) hip_add_exe_to_target(NAME GraphsTest diff --git a/tests/catch/unit/graph/hipGraphHostNodeGetParams.cc b/tests/catch/unit/graph/hipGraphHostNodeGetParams.cc new file mode 100644 index 0000000000..a1c769ea47 --- /dev/null +++ b/tests/catch/unit/graph/hipGraphHostNodeGetParams.cc @@ -0,0 +1,275 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** +Testcase Scenarios of hipGraphHostNodeGetParams API: + +Functional Scenarios: +1) Create a graph, add Host node to graph with desired node params. Verify api fetches the node params + which were mentioned while adding the host node. +2) Set host node params with hipGraphHostNodeSetParams, now get the params and verify both are same. +3) Create graph, Add Graphnodes and clones the graph. Add Hostnode to the cloned graph, update + hostNode params using hipGraphHostNodeSetParams API now get the params and verify both are same + +Negative Scenarios: + +1) Pass pGraphNode as nullptr and verify api doesn’t crash, returns error code. +2) Pass pNodeParams as nullptr and verify api doesn’t crash, returns error code. +3) Pass unintialized graph node +*/ + +#include +#include + +#define SIZE 1024 + +static void callbackfunc(void *A_h) { + int *A = reinterpret_cast(A_h); + for (int i = 0; i < SIZE; i++) { + A[i] = i; + } +} + +static void callbackfunc_setparams(void *B_h) { + int *B = reinterpret_cast(B_h); + for (int i = 0; i < SIZE; i++) { + B[i] = i * i; + } +} + +/* +This testcase verifies the negative scenarios of +hipGraphHostNodeGetParams API +*/ +TEST_CASE("Unit_hipGraphHostNodeGetParams_Negative") { + constexpr size_t N = 1024; + hipGraph_t graph; + int *A_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *C_h{nullptr}; + HipTest::initArrays(&A_d, nullptr, &C_d, + &A_h, nullptr, &C_h, N, false); + + HIP_CHECK(hipGraphCreate(&graph, 0)); + + hipGraphNode_t hostNode; + hipHostNodeParams hostParams = {0, 0}; + hostParams.fn = callbackfunc; + hostParams.userData = A_h; + HIP_CHECK(hipGraphAddHostNode(&hostNode, graph, + nullptr, + 0, &hostParams)); + hipHostNodeParams GethostParams; + + SECTION("Passing nullptr to graph node") { + REQUIRE(hipGraphHostNodeGetParams(nullptr, &GethostParams) + == hipErrorInvalidValue); + } + + SECTION("Passing nullptr to hostParams") { + REQUIRE(hipGraphHostNodeGetParams(hostNode, nullptr) + == hipErrorInvalidValue); + } + + SECTION("Passing unintialized graphNode") { + hipGraphNode_t unint_graphnode{nullptr}; + REQUIRE(hipGraphHostNodeGetParams(unint_graphnode, &GethostParams) + == hipErrorInvalidValue); + } + HIP_CHECK(hipGraphDestroy(graph)); +} +/* +This testcase verifies hipGraphHostNodeGetParams API in cloned graph +Creates graph, Add graph nodes and clone the graph +Add HostNode to the cloned graph, update hostNode using hipGraphHostNodeSetParams, +then get the host node params using hipGraphHostNodeGetParams API and +compare it. +*/ +TEST_CASE("Unit_hipGraphHostNodeGetParams_ClonedGraphwithHostNode") { + constexpr size_t N = 1024; + constexpr size_t Nbytes = N * sizeof(int); + hipGraph_t graph; + hipGraphExec_t graphExec; + int *A_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *C_h{nullptr}; + HipTest::initArrays(&A_d, nullptr, &C_d, + &A_h, nullptr, &C_h, N, false); + + HIP_CHECK(hipGraphCreate(&graph, 0)); + hipGraphNode_t memcpyH2D_A, memcpyH2D_C, + memcpyD2H_AC; + hipStream_t streamForGraph; + HIP_CHECK(hipStreamCreate(&streamForGraph)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, + 0, A_d, A_h, + Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr, + 0, C_d, C_h, + Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_AC, graph, nullptr, + 0, A_h, C_d, + Nbytes, hipMemcpyDeviceToHost)); + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, + &memcpyD2H_AC, 1)); + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_C, + &memcpyD2H_AC, 1)); + + hipGraph_t clonedgraph; + HIP_CHECK(hipGraphClone(&clonedgraph, graph)); + + hipGraphNode_t hostNode; + hipHostNodeParams hostParams = {0, 0}; + hostParams.fn = callbackfunc; + hostParams.userData = A_h; + HIP_CHECK(hipGraphAddHostNode(&hostNode, clonedgraph, + nullptr, + 0, &hostParams)); + hipHostNodeParams sethostParams = {0, 0}; + sethostParams.fn = callbackfunc_setparams; + sethostParams.userData = C_h; + HIP_CHECK(hipGraphHostNodeSetParams(hostNode, &sethostParams)); + hipHostNodeParams gethostParams; + HIP_CHECK(hipGraphHostNodeGetParams(hostNode, &gethostParams)); + REQUIRE(memcmp(&sethostParams, &gethostParams, sizeof(hipHostNodeParams)) + == 0); + // Instantiate and launch the cloned graph + HIP_CHECK(hipGraphInstantiate(&graphExec, clonedgraph, nullptr, nullptr, 0)); + HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph)); + HIP_CHECK(hipStreamSynchronize(streamForGraph)); + + // Verify execution result + for (size_t i = 0; i < N; i++) { + if (C_h[i] != static_cast(i * i)) { + INFO("Validation failed i " << i << "C_h[i] "<< C_h[i]); + REQUIRE(false); + } + } + HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(graph)); + HIP_CHECK(hipGraphDestroy(clonedgraph)); + HIP_CHECK(hipStreamDestroy(streamForGraph)); + HipTest::freeArrays(A_d, nullptr, C_d, A_h, nullptr, C_h, false); +} + +/* +This testcase verifies the following scenarios +Create graph, Adds host node to the graph, updates it +with hipGraphHostNodeSetParams and gets the host node +params using hipGraphHostNodeGetParams API and validates +it +*/ +void hipGraphHostNodeGetParams_func(bool setparams) { + constexpr size_t N = 1024; + constexpr size_t Nbytes = N * sizeof(int); + hipGraph_t graph; + hipGraphExec_t graphExec; + int *A_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *C_h{nullptr}; + HipTest::initArrays(&A_d, nullptr, &C_d, + &A_h, nullptr, &C_h, N, false); + + HIP_CHECK(hipGraphCreate(&graph, 0)); + hipGraphNode_t memcpyH2D_A, memcpyD2H_AC, memcpyH2D_C; + hipStream_t streamForGraph; + HIP_CHECK(hipStreamCreate(&streamForGraph)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, + 0, A_d, A_h, + Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr, + 0, C_d, C_h, + Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_AC, graph, nullptr, + 0, A_h, C_d, + Nbytes, hipMemcpyDeviceToHost)); + hipGraphNode_t hostNode; + hipHostNodeParams hostParams = {0, 0}; + hostParams.fn = callbackfunc; + hostParams.userData = A_h; + HIP_CHECK(hipGraphAddHostNode(&hostNode, graph, + nullptr, + 0, &hostParams)); + + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, + &memcpyD2H_AC, 1)); + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_C, + &memcpyD2H_AC, 1)); + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyD2H_AC, + &hostNode, 1)); + + if (setparams) { + hipHostNodeParams sethostParams = {0, 0}; + sethostParams.fn = callbackfunc_setparams; + sethostParams.userData = C_h; + HIP_CHECK(hipGraphHostNodeSetParams(hostNode, &sethostParams)); + + hipHostNodeParams gethostParams; + HIP_CHECK(hipGraphHostNodeGetParams(hostNode, &gethostParams)); + REQUIRE(memcmp(&sethostParams, &gethostParams, sizeof(hipHostNodeParams)) + == 0); + } else { + hipHostNodeParams gethostParams; + HIP_CHECK(hipGraphHostNodeGetParams(hostNode, &gethostParams)); + REQUIRE(memcmp(&hostParams, &gethostParams, sizeof(hipHostNodeParams)) + == 0); + } + // Instantiate and launch the graph + HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0)); + HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph)); + HIP_CHECK(hipStreamSynchronize(streamForGraph)); + + // Verify execution result + + if (setparams) { + for (size_t i = 0; i < N; i++) { + if (C_h[i] != static_cast(i * i)) { + INFO("Validation failed i " << i << "C_h[i] "<< C_h[i]); + REQUIRE(false); + } + } + } else { + for (size_t i = 0; i < N; i++) { + if (A_h[i] != static_cast(i)) { + INFO("Validation failed i " << i << "C_h[i] "<< C_h[i]); + REQUIRE(false); + } + } + } + + HipTest::freeArrays(A_d, nullptr, C_d, A_h, nullptr, C_h, false); + HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(graph)); + HIP_CHECK(hipStreamDestroy(streamForGraph)); +} +/* +This testcase verifies hipGraphHostNodeGetParams API by +adding host node to graph and gets the host params and +validates it +*/ +TEST_CASE("Unit_hipGraphHostNodeGetParams_BasicFunc") { + hipGraphHostNodeGetParams_func(false); +} + +/* +This testcase verifies hipGraphHostNodeGetParams API by +adding host node to graph, updates host node params +using hipGraphHostNodeSetParams and gets the host params +validates it +*/ +TEST_CASE("Unit_hipGraphHostNodeGetParams_SetParams") { + hipGraphHostNodeGetParams_func(true); +} From cd0d73d3f15c42b67f1b4bbf982f615e6b5d90b5 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:36:45 +0530 Subject: [PATCH 10/39] SWDEV-306122 - [catch2][dtest] Tests for hipGraphExecChildGraphNodeSetParams API (#2948) Added Negative and functional tests for hipGraphExecChildGraphNodeSetParams API Change-Id: Ibe3ab74bc783a90daec153a8c74f039a2f977a71 --- .../config/config_amd_windows_common.json | 4 +- tests/catch/unit/graph/CMakeLists.txt | 1 + .../hipGraphExecChildGraphNodeSetParams.cc | 347 ++++++++++++++++++ 3 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 tests/catch/unit/graph/hipGraphExecChildGraphNodeSetParams.cc diff --git a/tests/catch/hipTestMain/config/config_amd_windows_common.json b/tests/catch/hipTestMain/config/config_amd_windows_common.json index 26c341d51d..f65e58c65a 100644 --- a/tests/catch/hipTestMain/config/config_amd_windows_common.json +++ b/tests/catch/hipTestMain/config/config_amd_windows_common.json @@ -67,6 +67,8 @@ "Unit_hipStreamPerThread_StrmWaitEvt", "Unit_hipGraphHostNodeGetParams_ClonedGraphwithHostNode", "Unit_hipGraphHostNodeGetParams_BasicFunc", - "Unit_hipGraphHostNodeGetParams_SetParams" + "Unit_hipGraphHostNodeGetParams_SetParams", + "Unit_hipGraphExecChildGraphNodeSetParams_BasicFunc", + "Unit_hipGraphExecChildGraphNodeSetParams_ChildTopology" ] } diff --git a/tests/catch/unit/graph/CMakeLists.txt b/tests/catch/unit/graph/CMakeLists.txt index 244fbf6845..5af1423bdc 100644 --- a/tests/catch/unit/graph/CMakeLists.txt +++ b/tests/catch/unit/graph/CMakeLists.txt @@ -77,6 +77,7 @@ set(TEST_SRC hipGraphNodeGetDependentNodes.cc hipGraphNodeGetDependencies.cc hipGraphHostNodeGetParams.cc + hipGraphExecChildGraphNodeSetParams.cc ) hip_add_exe_to_target(NAME GraphsTest diff --git a/tests/catch/unit/graph/hipGraphExecChildGraphNodeSetParams.cc b/tests/catch/unit/graph/hipGraphExecChildGraphNodeSetParams.cc new file mode 100644 index 0000000000..ab7d3ac9a9 --- /dev/null +++ b/tests/catch/unit/graph/hipGraphExecChildGraphNodeSetParams.cc @@ -0,0 +1,347 @@ +/*Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** + Testcase Scenarios of hipGraphExecChildGraphNodeSetParams API: + + Functional Scenarios: + 1. Create child graph, Instantiate the graph and update the child graph + using hipGraphExecChildGraphNodeSetParams API + 2. Create child graph with topology, Instantiate the graph + and update the child graph + using hipGraphExecChildGraphNodeSetParams API + + Negative Scenarios: + 1. Pass nullptr to child graph + 2. Pass nullptr to graphnode + 3. Pass nullptr to graphExec + 4. Pass uninitialized graph node + 5. Pass orginial graph node instead of child graph node + 6. Change topology of child graph node + **/ + +#include +#include +#include + + +TEST_CASE("Unit_hipGraphExecChildGraphNodeSetParams_Negative") { + constexpr size_t N = 1024; + constexpr size_t Nbytes = N * sizeof(int); + hipGraph_t graph, childgraph1, childgraph2; + hipGraphExec_t graphExec; + int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}; + HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); + HIP_CHECK(hipGraphCreate(&graph, 0)); + std::vector childdependencies; + hipStream_t streamForGraph; + HIP_CHECK(hipStreamCreate(&streamForGraph)); + HIP_CHECK(hipGraphCreate(&childgraph1, 0)); + HIP_CHECK(hipGraphCreate(&childgraph2, 0)); + hipGraphNode_t memcpyH2D_A, memcpyH2D_B, memcpyD2H_A, + memcpyH2D_B_child, childGraphNode1; + HIP_CHECK(hipMemcpy(C_d, C_h, Nbytes, hipMemcpyHostToDevice)); + + // Adding MemcpyNode to graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, + 0, A_d, A_h, + Nbytes, hipMemcpyHostToDevice)); + + // Adding memcpyNode to childgraph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, nullptr, + 0, B_d, A_d, + Nbytes, hipMemcpyDeviceToDevice)); + + // Adding childnode to graph + HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, + nullptr, 0, childgraph1)); + + // Adding memcpynode to graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A, graph, nullptr, + 0, B_h, B_d, + Nbytes, hipMemcpyDeviceToHost)); + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, &childGraphNode1, 1)); + HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyD2H_A, 1)); + + // Adding memcpynode to new childgraph which is used to update the + // childgraph node + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B_child, childgraph2, nullptr, + 0, B_d, C_d, + Nbytes, hipMemcpyDeviceToDevice)); + + // Instantiate and launch the graph + HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0)); + + SECTION("Pass nullptr to graphExec") { + REQUIRE(hipGraphExecChildGraphNodeSetParams(nullptr, childGraphNode1, + childgraph2) + == hipErrorInvalidValue); + } + SECTION("Pass nullptr to child graph node") { + REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec, nullptr, + childgraph2) + == hipErrorInvalidValue); + } + SECTION("Pass nullptr to child graph") { + REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec, + childGraphNode1, + nullptr) + == hipErrorInvalidValue); + } + SECTION("Passing parent graph instead of child graph") { + REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec, + childGraphNode1, graph) + != hipSuccess); + } + SECTION("Updating the child graph topology") { + hipGraphNode_t newnode; + HIP_CHECK(hipGraphAddMemcpyNode1D(&newnode, childgraph2, nullptr, + 0, B_d, C_d, + Nbytes, hipMemcpyDeviceToDevice)); + HIP_CHECK(hipGraphAddDependencies(childgraph2, &memcpyH2D_B_child, + &newnode, 1)); + + REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec, childGraphNode1, + childgraph2) + != hipSuccess); + } + + HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); + HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(childgraph1)); + HIP_CHECK(hipGraphDestroy(childgraph2)); + HIP_CHECK(hipGraphDestroy(graph)); + HIP_CHECK(hipStreamDestroy(streamForGraph)); +} + +/* + This testcase verifies the following scenario + Create graph, add child node to graph, Instantiate the graph + and update the child graph node with a new graph + using hipGraphExecChildGraphNodeSetParams API + and execute it + */ +TEST_CASE("Unit_hipGraphExecChildGraphNodeSetParams_BasicFunc") { + constexpr size_t N = 1024; + constexpr size_t Nbytes = N * sizeof(int); + hipGraph_t graph, childgraph1, childgraph2; + hipGraphExec_t graphExec; + int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}; + HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); + HIP_CHECK(hipGraphCreate(&graph, 0)); + std::vector childdependencies; + hipStream_t streamForGraph; + HIP_CHECK(hipStreamCreate(&streamForGraph)); + HIP_CHECK(hipGraphCreate(&childgraph1, 0)); + HIP_CHECK(hipGraphCreate(&childgraph2, 0)); + hipGraphNode_t memcpyH2D_A, memcpyH2D_B, memcpyD2H_A, + memcpyH2D_B_child, childGraphNode1; + HIP_CHECK(hipMemcpy(C_d, C_h, Nbytes, hipMemcpyHostToDevice)); + + // Adding MemcpyNode to graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, + 0, A_d, A_h, + Nbytes, hipMemcpyHostToDevice)); + + // Adding memcpyNode to childgraph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, nullptr, + 0, B_d, A_d, + Nbytes, hipMemcpyDeviceToDevice)); + + // Adding childnode to graph + HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, + nullptr, 0, childgraph1)); + + // Adding memcpynode to graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A, graph, nullptr, + 0, B_h, B_d, + Nbytes, hipMemcpyDeviceToHost)); + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, &childGraphNode1, 1)); + HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyD2H_A, 1)); + + // Adding memcpynode to new childgraph which is used to update the + // childgraph node + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B_child, childgraph2, nullptr, + 0, B_d, C_d, + Nbytes, hipMemcpyDeviceToDevice)); + + // Instantiate and launch the graph + HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0)); + + // Update the childgraph node + HIP_CHECK(hipGraphExecChildGraphNodeSetParams(graphExec, childGraphNode1, + childgraph2)); + + HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph)); + HIP_CHECK(hipStreamSynchronize(streamForGraph)); + + // Verify graph execution result + for (unsigned int i = 0; i < N; i++) { + if (B_h[i] != C_h[i]) { + WARN("Validation failed " << B_h[i] << "\t" << C_h[i]); + REQUIRE(false); + } + } + + HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); + HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(childgraph1)); + HIP_CHECK(hipGraphDestroy(childgraph2)); + HIP_CHECK(hipGraphDestroy(graph)); + HIP_CHECK(hipStreamDestroy(streamForGraph)); +} + +/* + This testcase verifies the following scenario + Create graph, Create child graph with a topology and + add child node to graph, Instantiate the graph + and update the child graph node with a new graph + using hipGraphExecChildGraphNodeSetParams API + and execute it + */ +TEST_CASE("Unit_hipGraphExecChildGraphNodeSetParams_ChildTopology") { + constexpr size_t N = 1024; + constexpr size_t Nbytes = N * sizeof(int); + constexpr auto blocksPerCU = 6; // to hide latency + size_t NElem{N}; + constexpr auto threadsPerBlock = 256; + hipGraph_t graph, childgraph1, childgraph2; + hipGraphExec_t graphExec; + hipKernelNodeParams kernelNodeParams{}; + hipGraphNode_t kernel_vecAdd; + int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}; + HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false); + unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N); + std::vector childdependencies, childdependencies1; + + HIP_CHECK(hipGraphCreate(&graph, 0)); + hipGraphNode_t memcpyH2D_A, memcpyH2D_B, memcpyH2D_C, childGraphNode1, + memcpyD2H_A, memcpyD2D_AB; + hipStream_t streamForGraph; + HIP_CHECK(hipStreamCreate(&streamForGraph)); + HIP_CHECK(hipGraphCreate(&childgraph1, 0)); + HIP_CHECK(hipGraphCreate(&childgraph2, 0)); + + // Adding memcpy node to graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, + 0, A_d, A_h, + Nbytes, hipMemcpyHostToDevice)); + + // Adding memcpy node to child graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2D_AB, childgraph1, nullptr, + 0, B_d, A_d, + Nbytes, hipMemcpyDeviceToDevice)); + childdependencies.push_back(memcpyD2D_AB); + + // Adding memcpy node to child graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, + childdependencies.data(), + childdependencies.size(), B_d, B_h, + Nbytes, hipMemcpyHostToDevice)); + + // Adding memcpy node to child graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, childgraph1, + childdependencies.data(), + childdependencies.size(), C_d, C_h, + Nbytes, hipMemcpyHostToDevice)); + + childdependencies.clear(); + childdependencies.push_back(memcpyH2D_B); + childdependencies.push_back(memcpyH2D_C); + + void* kernelArgs2[] = {&B_d, &C_d, &A_d, reinterpret_cast(&NElem)}; + kernelNodeParams.func = reinterpret_cast(HipTest::vectorADD); + kernelNodeParams.gridDim = dim3(blocks); + kernelNodeParams.blockDim = dim3(threadsPerBlock); + kernelNodeParams.sharedMemBytes = 0; + kernelNodeParams.kernelParams = reinterpret_cast(kernelArgs2); + kernelNodeParams.extra = nullptr; + + // Adding kernel node to child graph + HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd, childgraph1, + childdependencies.data(), + childdependencies.size(), + &kernelNodeParams)); + + // Adding child node to graph + HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, + nullptr, 0, childgraph1)); + + // Adding memcpy node to graph + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A, graph, nullptr, + 0, A_h, A_d, + Nbytes, hipMemcpyDeviceToHost)); + + + HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, &childGraphNode1, 1)); + HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyD2H_A, 1)); + + // Creating another child graph for updating parameters with the same topology + // and passing the new child graph to hipGraphExecChildGraphNodeSetParams API + hipGraphNode_t memcpyD2D_AB1, memcpyH2D_B1, memcpyH2D_C1, kernel_vecAdd1; + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2D_AB1, childgraph2, nullptr, + 0, B_d, A_d, + Nbytes, hipMemcpyDeviceToDevice)); + childdependencies.clear(); + childdependencies.push_back(memcpyD2D_AB1); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B1, childgraph2, + childdependencies.data(), + childdependencies.size(), B_d, B_h, + Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C1, childgraph2, + childdependencies.data(), + childdependencies.size(), C_d, B_h, + Nbytes, hipMemcpyHostToDevice)); + + childdependencies.clear(); + childdependencies.push_back(memcpyH2D_B1); + childdependencies.push_back(memcpyH2D_C1); + + void* kernelArgs21[] = {&B_d, &C_d, &A_d, reinterpret_cast(&NElem)}; + kernelNodeParams.func = reinterpret_cast(HipTest::vectorADD); + kernelNodeParams.gridDim = dim3(blocks); + kernelNodeParams.blockDim = dim3(threadsPerBlock); + kernelNodeParams.sharedMemBytes = 0; + kernelNodeParams.kernelParams = reinterpret_cast(kernelArgs21); + kernelNodeParams.extra = nullptr; + HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd1, childgraph2, + childdependencies.data(), + childdependencies.size(), + &kernelNodeParams)); + + // Instantiate and launch the graph + HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0)); + + HIP_CHECK(hipGraphExecChildGraphNodeSetParams(graphExec, + childGraphNode1, childgraph2)); + + HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph)); + HIP_CHECK(hipStreamSynchronize(streamForGraph)); + + // Verify child graph execution result + HipTest::checkVectorADD(B_h, B_h, A_h, N); + + HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); + HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(childgraph1)); + HIP_CHECK(hipGraphDestroy(graph)); + HIP_CHECK(hipStreamDestroy(streamForGraph)); +} From e8c5a72cff4e4e5bd887b9f6fe882462c0a67cae Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:36:57 +0530 Subject: [PATCH 11/39] SWDEV-344342 - Add sample using hiprtc target (#2946) Change-Id: Ie2a0b308862ac8db2e72a0170499139c7b46605b --- .../2_Cookbook/23_cmake_hiprtc/CMakeLists.txt | 36 ++++ samples/2_Cookbook/23_cmake_hiprtc/README.md | 9 + samples/2_Cookbook/23_cmake_hiprtc/saxpy.cpp | 156 ++++++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 samples/2_Cookbook/23_cmake_hiprtc/CMakeLists.txt create mode 100644 samples/2_Cookbook/23_cmake_hiprtc/README.md create mode 100644 samples/2_Cookbook/23_cmake_hiprtc/saxpy.cpp diff --git a/samples/2_Cookbook/23_cmake_hiprtc/CMakeLists.txt b/samples/2_Cookbook/23_cmake_hiprtc/CMakeLists.txt new file mode 100644 index 0000000000..f22b063bb3 --- /dev/null +++ b/samples/2_Cookbook/23_cmake_hiprtc/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (C) 2022 Advanced Micro Devices, Inc. All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +project(cmake_hiprtc_test) + +cmake_minimum_required(VERSION 3.10.2) + +# Find hiprtc +find_package(hiprtc REQUIRED) +# Find hip +find_package(hip REQUIRED) + +# Create the excutable +add_executable(test saxpy.cpp) + +# Link with HIPRTC +target_link_libraries(test hiprtc::hiprtc) +# Link with HIP +target_link_libraries(test hip::device) diff --git a/samples/2_Cookbook/23_cmake_hiprtc/README.md b/samples/2_Cookbook/23_cmake_hiprtc/README.md new file mode 100644 index 0000000000..2831619d19 --- /dev/null +++ b/samples/2_Cookbook/23_cmake_hiprtc/README.md @@ -0,0 +1,9 @@ +### This will test linking hiprtc::hiprtc interface in cmake +I. Build +mkdir -p build; cd build +rm -rf *; CXX=amdclang++ cmake -DCMAKE_PREFIX_PATH=/opt/rocm/hip .. +make + +II. Test +$ ./test +SAXPY test completed diff --git a/samples/2_Cookbook/23_cmake_hiprtc/saxpy.cpp b/samples/2_Cookbook/23_cmake_hiprtc/saxpy.cpp new file mode 100644 index 0000000000..9c24091f0f --- /dev/null +++ b/samples/2_Cookbook/23_cmake_hiprtc/saxpy.cpp @@ -0,0 +1,156 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include + +static constexpr auto NUM_THREADS{128}; +static constexpr auto NUM_BLOCKS{32}; + +static constexpr auto saxpy{ +R"( +#include "test_header.h" +#include "test_header1.h" +extern "C" +__global__ +void saxpy(real a, realptr x, realptr y, realptr out, size_t n) +{ + size_t tid = blockIdx.x * blockDim.x + threadIdx.x; + if (tid < n) { + out[tid] = a * x[tid] + y[tid] ; + } +} +)"}; + +int main() +{ + using namespace std; + + hiprtcProgram prog; + int num_headers = 2; + vector header_names; + vector header_sources; + header_names.push_back("test_header.h"); + header_names.push_back("test_header1.h"); + header_sources.push_back("#ifndef HIPRTC_TEST_HEADER_H\n#define HIPRTC_TEST_HEADER_H\ntypedef float real;\n#endif //HIPRTC_TEST_HEADER_H\n"); + header_sources.push_back("#ifndef HIPRTC_TEST_HEADER1_H\n#define HIPRTC_TEST_HEADER1_H\ntypedef float* realptr;\n#endif //HIPRTC_TEST_HEADER1_H\n"); + hiprtcCreateProgram(&prog, // prog + saxpy, // buffer + "saxpy.cu", // name + num_headers, // numHeaders + &header_sources[0], // headers + &header_names[0]); // includeNames + + hipDeviceProp_t props; + int device = 0; + hipGetDeviceProperties(&props, device); + + const char* options[] = {}; + + hiprtcResult compileResult{hiprtcCompileProgram(prog, 0, options)}; + + size_t logSize; + hiprtcGetProgramLogSize(prog, &logSize); + + if (logSize) { + string log(logSize, '\0'); + hiprtcGetProgramLog(prog, &log[0]); + + cout << log << '\n'; + } + + if (compileResult != HIPRTC_SUCCESS) { + cout << "Compilation failed." << endl; + } + + size_t codeSize; + hiprtcGetCodeSize(prog, &codeSize); + + vector code(codeSize); + hiprtcGetCode(prog, code.data()); + + hiprtcDestroyProgram(&prog); + + hipModule_t module; + hipFunction_t kernel; + + hipModuleLoadData(&module, code.data()); + hipModuleGetFunction(&kernel, module, "saxpy"); + + size_t n = NUM_THREADS * NUM_BLOCKS; + size_t bufferSize = n * sizeof(float); + + float a = 5.1f; + unique_ptr hX{new float[n]}; + unique_ptr hY{new float[n]}; + unique_ptr hOut{new float[n]}; + + for (size_t i = 0; i < n; ++i) { + hX[i] = static_cast(i); + hY[i] = static_cast(i * 2); + } + + hipDeviceptr_t dX, dY, dOut; + hipMalloc((void **)&dX, bufferSize); + hipMalloc((void **)&dY, bufferSize); + hipMalloc((void **)&dOut, bufferSize); + hipMemcpyHtoD(dX, hX.get(), bufferSize); + hipMemcpyHtoD(dY, hY.get(), bufferSize); + + struct { + float a_; + hipDeviceptr_t b_; + hipDeviceptr_t c_; + hipDeviceptr_t d_; + size_t e_; + } args{a, dX, dY, dOut, n}; + + auto size = sizeof(args); + 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); + hipMemcpyDtoH(hOut.get(), dOut, bufferSize); + + for (size_t i = 0; i < n; ++i) { + if (fabs(a * hX[i] + hY[i] - hOut[i]) > fabs(hOut[i])* 1e-6) { + cout << "Validation failed." << endl; + } + } + + hipFree((void *)dX); + hipFree((void *)dY); + hipFree((void *)dOut); + + hipModuleUnload(module); + + cout << "SAXPY test completed" << endl; +} From 9d03fdc13df984fcb1281b5bac9926851be052e8 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:37:10 +0530 Subject: [PATCH 12/39] SWDEV-340007 - Adding per-thread stream in HIP documents (#2945) Change-Id: If675dbb8792549fb70ff4423782d618594526ac6 --- docs/markdown/hip_faq.md | 15 ++++++++++++++- docs/markdown/hip_programming_guide.md | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/markdown/hip_faq.md b/docs/markdown/hip_faq.md index d30f63f1d3..cdf45fb2c3 100644 --- a/docs/markdown/hip_faq.md +++ b/docs/markdown/hip_faq.md @@ -33,6 +33,7 @@ - [Why _OpenMP is undefined when compiling with -fopenmp?](#why-_openmp-is-undefined-when-compiling-with--fopenmp) - [Does the HIP-Clang compiler support extern shared declarations?](#does-the-hip-clang-compiler-support-extern-shared-declarations) - [I have multiple HIP enabled devices and I am getting an error message hipErrorNoBinaryForGpu: Unable to find code object for all current devices?](#i-have-multiple-hip-enabled-devices-and-i-am-getting-an-error-message-hipErrorNoBinaryForGpu-unable-to-find-code-object-for-all-current-devices) +- [How to use per-thread default stream in HIP?](#how-to-use-per-thread-default-stream-in-hip) - [How can I know the version of HIP?](#how-can-I-know-the-version-of-hip) @@ -94,7 +95,7 @@ However, we can provide a rough summary of the features included in each CUDA SD - CUDA 6.5 : - __shfl intriniscs (supported) - CUDA 7.0 : - - Per-thread-streams (under development) + - Per-thread default streams (supported) - C++11 (Hip-Clang supports all of C++11, all of C++14 and some C++17 features) - CUDA 7.5 : - float16 (supported) @@ -260,6 +261,18 @@ If you have a precompiled application/library (like rocblas, tensorflow etc) whi - The application/library does not ship code object bundles for *all* of your device(s): in this case you need to recompile the application/library yourself with correct `--offload-arch`. - The application/library does not ship code object bundles for *some* of your device(s), for example you have a system with an APU + GPU and the library does not ship code objects for your APU. For this you can set the environment variable `HIP_VISIBLE_DEVICES` to only enable GPUs for which code object is available. This will limit the GPUs visible to your application and allow it to run. +### How to use per-thread default stream in HIP? + +The per-thread default stream is an implicit stream local to both the thread and the current device. It does not do any implicit synchronization with other streams (like explicitly created streams), or default per-thread stream on other threads. + +The per-thread default stream is a blocking stream and will synchronize with the default null stream if both are used in a program. + +In ROCm, a compilation option should be added in order to compile the translation unit with per-thread default stream enabled. +“-fgpu-default-stream=per-thread”. +Once source is compiled with per-thread default stream enabled, all APIs will be executed on per thread default stream, hence there will not be any implicit synchronization with other streams. + +Besides, per-thread default stream be enabled per translation unit, users can compile some files with feature enabled and some with feature disabled. Feature enabled translation unit will have default stream as per thread and there will not be any implicit synchronization done but other modules will have legacy default stream which will do implicit synchronization. + ### How can I know the version of HIP? HIP version definition has been updated since ROCm 4.2 release as the following: diff --git a/docs/markdown/hip_programming_guide.md b/docs/markdown/hip_programming_guide.md index 9f48870300..1fc966e898 100644 --- a/docs/markdown/hip_programming_guide.md +++ b/docs/markdown/hip_programming_guide.md @@ -139,6 +139,15 @@ This implementation does not require the use of `hipDeviceSetLimit(hipLimitMallo The test codes in the link (https://github.com/ROCm-Developer-Tools/HIP/blob/develop/tests/src/deviceLib/hipDeviceMalloc.cpp) show how to implement application using malloc and free functions in device kernels. +## Use of Per-thread default stream + +The per-thread default stream is supported in HIP. It is an implicit stream local to both the thread and the current device. This means that the command issued to the per-thread default stream by the thread does not implicitly synchronize with other streams (like explicitly created streams), or default per-thread stream on other threads. +The per-thread default stream is a blocking stream and will synchronize with the default null stream if both are used in a program. +The per-thread default stream can be enabled via adding a compilation option, +“-fgpu-default-stream=per-thread”. + +And users can explicitly use "hipStreamPerThread" as per-thread default stream handle as input in API commands. There are test codes as examples in the link (https://github.com/ROCm-Developer-Tools/HIP/tree/develop/tests/catch/unit/streamperthread). + ## Use of Long Double Type In HIP-Clang, long double type is 80-bit extended precision format for x86_64, which is not supported by AMDGPU. HIP-Clang treats long double type as IEEE double type for AMDGPU. Using long double type in HIP source code will not cause issue as long as data of long double type is not transferred between host and device. However, long double type should not be used as kernel argument type. From 8c8499be7771b7af9d75acedbe6ac858009a6721 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:37:25 +0530 Subject: [PATCH 13/39] SWDEV-344309 - Enable some filter tests in Windows (#2944) Enable tests that should work now Change-Id: I903d7e73d7b5df94da72cb41f2bde9ab2eec653d --- tests/catch/unit/texture/hipTextureObj1DCheckModes.cc | 4 ---- tests/catch/unit/texture/hipTextureObj2DCheckModes.cc | 4 ---- tests/catch/unit/texture/hipTextureObj3DCheckModes.cc | 4 ---- 3 files changed, 12 deletions(-) diff --git a/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc b/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc index 052967e2f0..55f4910370 100644 --- a/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc +++ b/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc @@ -102,10 +102,6 @@ static void runTest(const int width, const float offsetX) { TEST_CASE("Unit_hipTextureObj1DCheckModes") { CHECK_IMAGE_SUPPORT -#ifdef _WIN32 - INFO("Unit_hipTextureObj1DCheckModes skipped on Windows"); - return; -#endif SECTION("hipAddressModeClamp, hipFilterModePoint, regularCoords") { runTest(256, -3); runTest(256, 4); diff --git a/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc b/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc index 19562f8966..e9d1665c20 100644 --- a/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc +++ b/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc @@ -114,10 +114,6 @@ line1: TEST_CASE("Unit_hipTextureObj2DCheckModes") { CHECK_IMAGE_SUPPORT -#ifdef _WIN32 - INFO("Unit_hipTextureObj2DCheckModes skipped on Windows"); - return; -#endif SECTION("hipAddressModeClamp, hipFilterModePoint, regularCoords") { runTest(256, 256, -3.9, 6.1); runTest(256, 256, 4.4, -7.0); diff --git a/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc b/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc index d219763a91..b7f0a6215e 100644 --- a/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc +++ b/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc @@ -148,10 +148,6 @@ line1: TEST_CASE("Unit_hipTextureObj3DCheckModes") { CHECK_IMAGE_SUPPORT -#ifdef _WIN32 - INFO("Unit_hipTextureObj3DCheckModes skipped on Windows"); - return; -#endif int device = 0; hipDeviceProp_t props; From 2b09d94ea2614ea5feb3777af66b6e0eb527f671 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:37:42 +0530 Subject: [PATCH 14/39] SWDEV-287351 - Fix hipStreamWithCUMask hang on Navi21 (#2939) - For gfx >= 10, one work group processor encompasses 2 CUs & hence the CUs need to be enabled in pair Change-Id: I359df1b221b4400b260b02201b7b0385054784f3 --- tests/catch/unit/stream/hipStreamGetCUMask.cc | 14 ++++++++++- .../catch/unit/stream/hipStreamWithCUMask.cc | 22 +++++++++++------- .../runtimeApi/stream/hipStreamGetCUMask.cpp | 8 ++++++- .../runtimeApi/stream/hipStreamWithCUMask.cpp | 23 ++++++++++++------- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/tests/catch/unit/stream/hipStreamGetCUMask.cc b/tests/catch/unit/stream/hipStreamGetCUMask.cc index 49f21bdbda..f63acc212a 100644 --- a/tests/catch/unit/stream/hipStreamGetCUMask.cc +++ b/tests/catch/unit/stream/hipStreamGetCUMask.cc @@ -117,9 +117,21 @@ TEST_CASE("Unit_hipExtStreamGetCUMask_verifyDefaultAndCustomMask") { } SECTION("Verify with custom mask set") { + hipDeviceProp_t props; std::vector customMask(defaultCUMask); hipStream_t stream; - customMask[0] = 0xe; + int deviceId; + + HIP_CHECK(hipGetDevice(&deviceId)); + HIP_CHECK(hipGetDeviceProperties(&props, deviceId)); + + if (props.major >= 10) { + // For gfx >= 10, one work group processor encompasses 2 CUs & + // hence the CUs need to be enabled in pair + customMask[0] = 0xc; + } else { + customMask[0] = 0xe; + } HIP_CHECK(hipExtStreamCreateWithCUMask(&stream, customMask.size(), customMask.data())); diff --git a/tests/catch/unit/stream/hipStreamWithCUMask.cc b/tests/catch/unit/stream/hipStreamWithCUMask.cc index ea6b033d9c..adf1db3e80 100644 --- a/tests/catch/unit/stream/hipStreamWithCUMask.cc +++ b/tests/catch/unit/stream/hipStreamWithCUMask.cc @@ -204,21 +204,27 @@ TEST_CASE("Unit_hipExtStreamCreateWithCUMask_Functionality") { hA[i] = CONSTANT + i; } + int cuCountPerGroup = 1; + if (props.major >= 10) { + cuCountPerGroup = 2; // For gfx >= 10, one work group processor encompasses 2 CUs + } + + unsigned long mask = pow(2, cuCountPerGroup) - 1; for (int np = 0; np < KNumPartition; np++) { HIP_CHECK(hipMalloc(&dA[np], Nbytes)); HIP_CHECK(hipMalloc(&dC[np], Nbytes)); // make unique CU masks in the multiple of dwords for each stream uint32_t temp = 0; - uint32_t bit_index = np; - for (int i = np; i < props.multiProcessorCount; i = i + 4) { - temp |= 1UL << bit_index; + uint32_t bit_index = cuCountPerGroup * np; + for (int i = np; i < props.multiProcessorCount; i = i + cuCountPerGroup * 4) { + temp |= mask << bit_index; if (bit_index >= 32) { cuMasks[np].push_back(temp); temp = 0; - bit_index = np; - temp |= 1UL << bit_index; + bit_index = cuCountPerGroup * np; + temp |= mask << bit_index; } - bit_index += 4; + bit_index += cuCountPerGroup * 4; } if (bit_index != 0) { cuMasks[np].push_back(temp); @@ -229,9 +235,9 @@ TEST_CASE("Unit_hipExtStreamCreateWithCUMask_Functionality") { HIP_CHECK(hipMemcpy(dA[np], hA, Nbytes, hipMemcpyHostToDevice)); - ss[np] << std::hex; + ss[np] << std::hex << std::setfill('0'); for (int i = cuMasks[np].size() - 1; i >= 0; i--) { - ss[np] << cuMasks[np][i]; + ss[np] << std::setw(8) << cuMasks[np][i]; } } diff --git a/tests/src/runtimeApi/stream/hipStreamGetCUMask.cpp b/tests/src/runtimeApi/stream/hipStreamGetCUMask.cpp index 3468a1fa53..ec3722f91d 100644 --- a/tests/src/runtimeApi/stream/hipStreamGetCUMask.cpp +++ b/tests/src/runtimeApi/stream/hipStreamGetCUMask.cpp @@ -124,7 +124,13 @@ int main(int argc, char* argv[]) { cout << "info: CU mask for the default stream is: 0x" << ss.str().c_str() << endl; vector cuMask1(defaultCUMask); - cuMask1[0] = 0xe; + if (props.major >= 10) { + // For gfx >= 10, one work group processor encompasses 2 CUs & + // hence the CUs need to be enabled in pair + cuMask1[0] = 0xc; + } else { + cuMask1[0] = 0xe; + } HIPCHECK(hipExtStreamCreateWithCUMask(&stream, cuMask1.size(), cuMask1.data())); ss.str(""); diff --git a/tests/src/runtimeApi/stream/hipStreamWithCUMask.cpp b/tests/src/runtimeApi/stream/hipStreamWithCUMask.cpp index efe98a8bae..07ac4c527b 100644 --- a/tests/src/runtimeApi/stream/hipStreamWithCUMask.cpp +++ b/tests/src/runtimeApi/stream/hipStreamWithCUMask.cpp @@ -72,6 +72,13 @@ int main(int argc, char* argv[]) { hA[i] = 1.618f + i; } + int cuCountPerGroup = 1; + if (props.major >= 10) { + cuCountPerGroup = 2; // For gfx >= 10, one work group processor encompasses 2 CUs + } + + unsigned long mask = pow(2, cuCountPerGroup) - 1; + for (int np = 0; np < numPartition; np++) { HIPCHECK(hipMalloc(&dA[np], Nbytes)); @@ -79,16 +86,16 @@ int main(int argc, char* argv[]) { // make unique CU masks in the multiple of dwords for each stream uint32_t temp = 0; - uint32_t bit_index = np; - for (int i = np; i < props.multiProcessorCount; i = i + 4) { - temp |= 1UL << bit_index; + uint32_t bit_index = cuCountPerGroup * np; + for (int i = np; i < props.multiProcessorCount; i = i + cuCountPerGroup * 4) { + temp |= mask << bit_index; if (bit_index >= 32) { cuMasks[np].push_back(temp); temp = 0; - bit_index = np; - temp |= 1UL << bit_index; + bit_index = cuCountPerGroup * np; + temp |= mask << bit_index; } - bit_index += 4; + bit_index += cuCountPerGroup * 4; } if (bit_index != 0) { cuMasks[np].push_back(temp); @@ -98,9 +105,9 @@ int main(int argc, char* argv[]) { HIPCHECK(hipMemcpy(dA[np], hA, Nbytes, hipMemcpyHostToDevice)); - ss[np] << std::hex; + ss[np] << std::hex << std::setfill('0'); for (int i = cuMasks[np].size() - 1; i >= 0; i--) { - ss[np] << cuMasks[np][i]; + ss[np] << std::setw(8) << cuMasks[np][i]; } } From dc386a0805b8eac0afc6830f08205374ac287936 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:38:59 +0530 Subject: [PATCH 15/39] SWDEV-351055 - Enable hipMallocArray and hipArrayCreate happy cases, disabling a REQUIRE case (#2929) Change-Id: Ie5eb423d1c1b9b32101c9a9fae4c372612839c4d --- tests/catch/unit/memory/hipArrayCreate.cc | 15 --------------- tests/catch/unit/memory/hipMallocArray.cc | 12 ------------ 2 files changed, 27 deletions(-) diff --git a/tests/catch/unit/memory/hipArrayCreate.cc b/tests/catch/unit/memory/hipArrayCreate.cc index 1db90d8a1b..6cc535593a 100644 --- a/tests/catch/unit/memory/hipArrayCreate.cc +++ b/tests/catch/unit/memory/hipArrayCreate.cc @@ -212,13 +212,6 @@ void testArrayAsTexture(hiparray array, const size_t width, const size_t height) // Test the happy path of the hipArrayCreate TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, short2, char, uchar2, char4, float, float2, float4) { -#if HT_AMD - if (std::is_same::value || std::is_same::value || - std::is_same::value) { - HipTest::HIP_SKIP_TEST("Probably EXSWCPHIPT-62"); - return; - } -#endif using vec_info = vector_info; DriverContext ctx; @@ -228,8 +221,6 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, sho desc.Width = 1024; desc.Height = GENERATE(0, 1024); - size_t initFree = getFreeMem(); - // pointer to the array in device memory hiparray array{}; @@ -237,12 +228,6 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, sho testArrayAsTexture(array, desc.Width, desc.Height); - size_t finalFree = getFreeMem(); - - const size_t allocSize = sizeof(TestType) * desc.Width * (desc.Height ? desc.Height : 1); - // will be aligned to some size, so this is not exact - REQUIRE(initFree - finalFree >= allocSize); - HIP_CHECK(hipArrayDestroy(array)); } diff --git a/tests/catch/unit/memory/hipMallocArray.cc b/tests/catch/unit/memory/hipMallocArray.cc index 680d08057c..b6c4939b1e 100644 --- a/tests/catch/unit/memory/hipMallocArray.cc +++ b/tests/catch/unit/memory/hipMallocArray.cc @@ -385,15 +385,9 @@ void testArrayAsSurface(hipArray_t arrayPtr, const size_t width, const size_t he // Selection of types chosen to reduce compile times TEMPLATE_TEST_CASE("Unit_hipMallocArray_happy", "", uint, int, int4, ushort, short2, char, uchar2, char4, float, float2, float4) { -#if HT_AMD - HipTest::HIP_SKIP_TEST("EXSWCPHIPT-62"); - return; -#endif hipChannelFormatDesc desc = hipCreateChannelDesc(); - size_t init_free = getFreeMem(); - // pointer to the array in device memory hipArray_t arrayPtr{}; size_t width = 1024; @@ -426,12 +420,6 @@ TEMPLATE_TEST_CASE("Unit_hipMallocArray_happy", "", uint, int, int4, ushort, sho } #endif - size_t final_free = getFreeMem(); - - const size_t alloc_size = getAllocSize(width, height); - // alloc will be chunked, so this is not exact - REQUIRE(init_free - final_free >= alloc_size); - HIP_CHECK(hipFreeArray(arrayPtr)); } From 7731299752b91f12f9d322e6a9098bf77690e0a4 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:39:12 +0530 Subject: [PATCH 16/39] SWDEV-354045 - Update hipModuleLoad comments about releasing file and other resources. (#2927) Change-Id: I88e5a37d3fd56b874eba19f73b0be0217caa58f8 --- include/hip/hip_runtime_api.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/hip/hip_runtime_api.h b/include/hip/hip_runtime_api.h index c3c11c883b..1d8a6cc731 100644 --- a/include/hip/hip_runtime_api.h +++ b/include/hip/hip_runtime_api.h @@ -4483,6 +4483,8 @@ hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags); * @param [in] fname * @param [out] module * + * @warning File/memory resources allocated in this function are released only in hipModuleUnload. + * * @returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidContext, hipErrorFileNotFound, * hipErrorOutOfMemory, hipErrorSharedObjectInitFailed, hipErrorNotInitialized * From c5ba2bb19672e3f4b5f1611ba055393143680b95 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:39:26 +0530 Subject: [PATCH 17/39] SWDEV-350985 - Address hipIpcEventHandle test failure on MI200 (#2926) Change-Id: Ie9a278caccbcc98bfa99968bc8ad974f83b2ee98 --- tests/catch/multiproc/hipIpcEventHandle.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/catch/multiproc/hipIpcEventHandle.cc b/tests/catch/multiproc/hipIpcEventHandle.cc index 484915f1db..4a4be2eb5a 100644 --- a/tests/catch/multiproc/hipIpcEventHandle.cc +++ b/tests/catch/multiproc/hipIpcEventHandle.cc @@ -44,7 +44,7 @@ Negative/Argument Validation: #define BUF_SIZE 4096 -#define MAX_DEVICES 8 +#define MAX_DEVICES 16 typedef struct ipcEventInfo { @@ -250,7 +250,7 @@ TEST_CASE("Unit_hipIpcEventHandle_Functional") { return; } - g_processCnt = shmDevices->count; + g_processCnt = (shmDevices->count > MAX_DEVICES) ? MAX_DEVICES : shmDevices->count; // Barrier is used to synchronize processes created. g_Barrier = reinterpret_cast (mmap(NULL, sizeof(*g_Barrier), From 2e641ee60bf940ce67621c9032af019f25caaa7d Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:39:45 +0530 Subject: [PATCH 18/39] SWDEV-339488 - Catch2 test for hipRTC include path (#2898) * SWDEV-339488 - Catch2 test for hipRTC include path Change-Id: I1f5502d1ea72ac4133f79207f2d60f86b934cf36 --- tests/catch/unit/rtc/headers/test_header1.h | 4 + tests/catch/unit/rtc/headers/test_header2.h | 4 + tests/catch/unit/rtc/includepath.cc | 128 ++++++++++++++++++++ tests/catch/unit/rtc/saxpy.h | 11 ++ 4 files changed, 147 insertions(+) create mode 100644 tests/catch/unit/rtc/headers/test_header1.h create mode 100644 tests/catch/unit/rtc/headers/test_header2.h create mode 100644 tests/catch/unit/rtc/includepath.cc create mode 100644 tests/catch/unit/rtc/saxpy.h diff --git a/tests/catch/unit/rtc/headers/test_header1.h b/tests/catch/unit/rtc/headers/test_header1.h new file mode 100644 index 0000000000..6cb37c331c --- /dev/null +++ b/tests/catch/unit/rtc/headers/test_header1.h @@ -0,0 +1,4 @@ +#ifndef HIPRTC_TEST_HEADER1_H +#define HIPRTC_TEST_HEADER1_H +typedef float real; +#endif //HIPRTC_TEST_HEADER1_H diff --git a/tests/catch/unit/rtc/headers/test_header2.h b/tests/catch/unit/rtc/headers/test_header2.h new file mode 100644 index 0000000000..16b639dd34 --- /dev/null +++ b/tests/catch/unit/rtc/headers/test_header2.h @@ -0,0 +1,4 @@ +#ifndef HIPRTC_TEST_HEADER2_H +#define HIPRTC_TEST_HEADER2_H +typedef float* realptr; +#endif //HIPRTC_TEST_HEADER2_H diff --git a/tests/catch/unit/rtc/includepath.cc b/tests/catch/unit/rtc/includepath.cc new file mode 100644 index 0000000000..e70c0eebb7 --- /dev/null +++ b/tests/catch/unit/rtc/includepath.cc @@ -0,0 +1,128 @@ +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static constexpr auto NUM_THREADS{128}; +static constexpr auto NUM_BLOCKS{32}; + +// This test verifies hiprtc compilation by passing include path option using -I with spaces +// before the path. eg: -I ../ or -I /path/to/headers etc. + +TEST_CASE("Unit_hiprtc_includepath") { + using namespace std; + + string saxpy = ""; + { + fstream f("saxpy.h"); + if (f.is_open()) { + size_t sizeFile; + f.seekg(0, fstream::end); + size_t size = sizeFile = (size_t)f.tellg(); + f.seekg(0, fstream::beg); + saxpy.resize(size, ' '); + f.read(&saxpy[0], size); + f.close(); + } + } + + hiprtcProgram prog; + hiprtcCreateProgram(&prog, // prog + saxpy.c_str(), // buffer + "saxpy.cu", // name + 0, nullptr, nullptr); + + hipDeviceProp_t props; + int device = 0; + HIP_CHECK(hipGetDeviceProperties(&props, device)); +#ifdef __HIP_PLATFORM_AMD__ + string sarg = string("--gpu-architecture=") + props.gcnArchName; +#else + string sarg = string("--gpu-architecture=compute_") + + to_string(props.major) + to_string(props.minor); +#endif + // Need to find the header files from the include path + // It is set to headers in the current directory here + const char* options[] = { + sarg.c_str(), "-I./headers" + }; + + hiprtcResult compileResult{hiprtcCompileProgram(prog, 2, options)}; + size_t logSize; + HIPRTC_CHECK(hiprtcGetProgramLogSize(prog, &logSize)); + if (logSize) { + string log(logSize, '\0'); + HIPRTC_CHECK(hiprtcGetProgramLog(prog, &log[0])); + cout << log << '\n'; + } + REQUIRE(compileResult == HIPRTC_SUCCESS); + size_t codeSize; + HIPRTC_CHECK(hiprtcGetCodeSize(prog, &codeSize)); + + vector code(codeSize); + HIPRTC_CHECK(hiprtcGetCode(prog, code.data())); + + HIPRTC_CHECK(hiprtcDestroyProgram(&prog)); + + // Do hip malloc first so that we donot need to do a cuInit manually before calling hipModule APIs + size_t n = NUM_THREADS * NUM_BLOCKS; + size_t bufferSize = n * sizeof(float); + + float *dX, *dY, *dOut; + HIP_CHECK(hipMalloc(&dX, bufferSize)); + HIP_CHECK(hipMalloc(&dY, bufferSize)); + HIP_CHECK(hipMalloc(&dOut, bufferSize)); + + hipModule_t module; + hipFunction_t kernel; + HIP_CHECK(hipModuleLoadData(&module, code.data())); + HIP_CHECK(hipModuleGetFunction(&kernel, module, "saxpy")); + + float a = 5.1f; + unique_ptr hX{new float[n]}; + unique_ptr hY{new float[n]}; + unique_ptr hOut{new float[n]}; + for (size_t i = 0; i < n; ++i) { + hX[i] = static_cast(i); + hY[i] = static_cast(i * 2); + } + + HIP_CHECK(hipMemcpy(dX, hX.get(), bufferSize, hipMemcpyHostToDevice)); + HIP_CHECK(hipMemcpy(dY, hY.get(), bufferSize, hipMemcpyHostToDevice)); + + struct { + float a_; + float* b_; + float* c_; + float* d_; + size_t e_; + } args{a, dX, dY, dOut, n}; + + auto size = sizeof(args); + 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(hipMemcpy(hOut.get(), dOut, bufferSize, hipMemcpyDeviceToHost)); + + hipFree(dX); + hipFree(dY); + hipFree(dOut); + + HIP_CHECK(hipModuleUnload(module)); + + for (size_t i = 0; i < n; ++i) { + INFO("For " << i << " Value: " << fabs(a * hX[i] + hY[i] - hOut[i]) + << " with: " << (fabs(hOut[i] * 1.0f) * 1e-6)); + REQUIRE(fabs(a * hX[i] + hY[i] - hOut[i]) <= fabs(hOut[i]) * 1e-6); + } +} diff --git a/tests/catch/unit/rtc/saxpy.h b/tests/catch/unit/rtc/saxpy.h new file mode 100644 index 0000000000..6e1e88f0ac --- /dev/null +++ b/tests/catch/unit/rtc/saxpy.h @@ -0,0 +1,11 @@ +#include "test_header1.h" +#include "test_header2.h" + +extern "C" +__global__ +void saxpy(real a, realptr x, realptr y, realptr out, size_t n) { + size_t tid = blockIdx.x * blockDim.x + threadIdx.x; + if (tid < n) { + out[tid] = a * x[tid] + y[tid]; + } +} From 7b8feec24681f7f7e3b39966f1d681526f70360b Mon Sep 17 00:00:00 2001 From: nives-vukovic <110852104+nives-vukovic@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:32:00 +0200 Subject: [PATCH 19/39] EXSWHTEC-16 - Implement hipEventSynchronize tests (#2904) - Add hipEventSynchronize.cc file with positive unit tests: Simple recorded event synchronization and without event recording - Add newly created file into CMakeLists.txt --- tests/catch/unit/event/CMakeLists.txt | 1 + tests/catch/unit/event/hipEventSynchronize.cc | 130 ++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 tests/catch/unit/event/hipEventSynchronize.cc diff --git a/tests/catch/unit/event/CMakeLists.txt b/tests/catch/unit/event/CMakeLists.txt index ba5d37e746..b9f57c1451 100644 --- a/tests/catch/unit/event/CMakeLists.txt +++ b/tests/catch/unit/event/CMakeLists.txt @@ -7,6 +7,7 @@ set(TEST_SRC Unit_hipEventIpc.cc hipEventDestroy.cc hipEventCreateWithFlags.cc + hipEventSynchronize.cc ) # The test used wait mechanism and doesnt play well with all arch of nvidia diff --git a/tests/catch/unit/event/hipEventSynchronize.cc b/tests/catch/unit/event/hipEventSynchronize.cc new file mode 100644 index 0000000000..e3c07bb395 --- /dev/null +++ b/tests/catch/unit/event/hipEventSynchronize.cc @@ -0,0 +1,130 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/* +Testcase Scenarios : +Unit_hipEventSynchronize_Default_Positive- Test synchronization of an event that is completed after a simple kernel launch (on null/created stream) +Unit_hipEventSynchronize_NoEventRecord_Positive - Test synchronization of an event that has not been recorded +*/ + +#include + +#include +#include + +void testSynchronize(hipStream_t stream) { + + constexpr size_t N = 1024; + + constexpr int blocks = 1024; + + constexpr size_t Nbytes = N * sizeof(float); + + float *A_h, *B_h, *C_h; + float *A_d, *B_d, *C_d; + HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N); + + hipEvent_t end_event; + HIP_CHECK(hipEventCreate(&end_event)); + + HIP_CHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice)); + + HipTest::launchKernel(HipTest::vectorADD, blocks, 1, 0, stream, + static_cast(A_d), static_cast(B_d), + C_d, N); + + if ( stream != nullptr ) + { + HIP_CHECK(hipStreamSynchronize(stream)); + } + + // Record the end_event + HIP_CHECK(hipEventRecord(end_event, nullptr)); + // Wait for the end_event to complete + HIP_CHECK(hipEventSynchronize(end_event)); + + HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); + + HIP_CHECK(hipEventDestroy(end_event)); + + HipTest::checkVectorADD(A_h, B_h, C_h, N, true); + HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); +} + +TEST_CASE("Unit_hipEventSynchronize_Default_Positive") { + hipStream_t stream{nullptr}; + + SECTION("Kernel launched in null stream") { + testSynchronize(stream); + } + + SECTION ("Kernel launched in created stream") { + HIP_CHECK(hipStreamCreate(&stream)); + testSynchronize(stream); + HIP_CHECK(hipStreamDestroy(stream)); + } +} + +TEST_CASE("Unit_hipEventSynchronize_NoEventRecord_Positive") { + constexpr size_t N = 1024; + + constexpr int blocks = 1024; + + constexpr size_t Nbytes = N * sizeof(float); + + float *A_h, *B_h, *C_h; + float *A_d, *B_d, *C_d; + HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N); + + hipEvent_t dummy_event; + HIP_CHECK(hipEventCreate(&dummy_event)); + + hipEvent_t end_event; + HIP_CHECK(hipEventCreate(&end_event)); + + HIP_CHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice)); + HIP_CHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice)); + + HipTest::launchKernel(HipTest::vectorADD, blocks, 1, 0, 0, + static_cast(A_d), static_cast(B_d), + C_d, N); + + // Record the end_event + HIP_CHECK(hipEventRecord(end_event, NULL)); + + // When hipEventSynchronized is called on event that has not been recorded, + // the function returns immediately + HIP_CHECK(hipEventSynchronize(dummy_event)); + + // End event has not been completed + HIP_CHECK_ERROR(hipEventQuery(end_event), hipErrorNotReady); + // Wait for end_event to complete + HIP_CHECK(hipEventSynchronize(end_event)); + + HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); + + HIP_CHECK(hipEventDestroy(dummy_event)); + HIP_CHECK(hipEventDestroy(end_event)); + + HipTest::checkVectorADD(A_h, B_h, C_h, N, true); + HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); +} From 66471b01c946e22efbea84bb1a1e28d4d851164a Mon Sep 17 00:00:00 2001 From: nives-vukovic <110852104+nives-vukovic@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:32:49 +0200 Subject: [PATCH 20/39] EXSWHTEC-18 - Implement positive test for hipDeviceGetStreamPriorityRange (#2911) - Add hipDeviceGetStreamPriorityRange.cc file with a test for simple device stream priority range check - Add newly created file into CMakeLists.txt --- tests/catch/unit/stream/CMakeLists.txt | 2 + .../stream/hipDeviceGetStreamPriorityRange.cc | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/catch/unit/stream/hipDeviceGetStreamPriorityRange.cc diff --git a/tests/catch/unit/stream/CMakeLists.txt b/tests/catch/unit/stream/CMakeLists.txt index 7d7c6de46f..0fbb211593 100644 --- a/tests/catch/unit/stream/CMakeLists.txt +++ b/tests/catch/unit/stream/CMakeLists.txt @@ -17,6 +17,7 @@ set(TEST_SRC hipStreamSynchronize.cc hipStreamQuery.cc hipStreamWaitEvent.cc + hipDeviceGetStreamPriorityRange.cc ) else() set(TEST_SRC @@ -36,6 +37,7 @@ set(TEST_SRC hipStreamValue.cc hipStreamSynchronize.cc hipStreamQuery.cc + hipDeviceGetStreamPriorityRange.cc ) # set_source_files_properties(hipStreamAttachMemAsync.cc PROPERTIES COMPILE_FLAGS -std=c++17) diff --git a/tests/catch/unit/stream/hipDeviceGetStreamPriorityRange.cc b/tests/catch/unit/stream/hipDeviceGetStreamPriorityRange.cc new file mode 100644 index 0000000000..eb813f9086 --- /dev/null +++ b/tests/catch/unit/stream/hipDeviceGetStreamPriorityRange.cc @@ -0,0 +1,37 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/* +Testcase Scenarios : +Unit_hipDeviceGetStreamPriorityRange_Default - Check if device stream piority range is valid +*/ + +#include + +TEST_CASE("Unit_hipDeviceGetStreamPriorityRange_Default") { + int priority_low = 0; + int priority_high = 0; + int devID = GENERATE(range(0, HipTest::getDeviceCount())); + HIP_CHECK(hipSetDevice(devID)); + HIP_CHECK(hipDeviceGetStreamPriorityRange(&priority_low, &priority_high)); + + REQUIRE(priority_low >= priority_high); +} From d60b65b5dc5e22ae1838cda891658a8a3f84db9a Mon Sep 17 00:00:00 2001 From: nives-vukovic <110852104+nives-vukovic@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:33:18 +0200 Subject: [PATCH 21/39] EXSWHTEC-24 - Fix issues and refactor code in Stream Management tests (#2916) - Fix bug in calculation of normal priority in Unit_hipStreamGetPriority_StreamsWithCUMask tests - Delete duplicate test Unit_hipStreamGetPriority_InvalidPriorityPointer - Separate Unit_hipStreamAddCallback_ParamTst into positive and negative test - Remove Unit_hipStreamDestroy_Negative_DoubleDestroy test for Nvidia devices due to error --- .../catch/unit/stream/hipStreamAddCallback.cc | 67 +++++++++++-------- .../catch/unit/stream/hipStreamGetPriority.cc | 12 +--- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/tests/catch/unit/stream/hipStreamAddCallback.cc b/tests/catch/unit/stream/hipStreamAddCallback.cc index b03aede98b..15dd98741d 100644 --- a/tests/catch/unit/stream/hipStreamAddCallback.cc +++ b/tests/catch/unit/stream/hipStreamAddCallback.cc @@ -161,16 +161,52 @@ using hipStreaAddCallbackTest::Callback_ChkStreamValue; /* * Validates parameter list of hipStreamAddCallback. */ -TEST_CASE("Unit_hipStreamAddCallback_ParamTst") { +TEST_CASE("Unit_hipStreamAddCallback_ParamTst_Positive") { hipStream_t mystream; HIP_CHECK(hipStreamCreate(&mystream)); + // Scenario1 - SECTION("callback is nullptr") { + SECTION("userData pointer value validation") { + gstream = mystream; + gusrptr = ptr0xff; + gPassed = true; + gcbDone = false; + HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkUsrdataPtr, + gusrptr, 0)); + while (!gcbDone) { + std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms + } + REQUIRE(gPassed); + } + // Scenario2 + SECTION("stream value validation") { + gstream = mystream; + gPassed = true; + gcbDone = false; + HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkStreamValue, + nullptr, 0)); + while (!gcbDone) { + std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms + } + REQUIRE(gPassed); + } + HIP_CHECK(hipStreamDestroy(mystream)); +} + +/* + * Negative tests for validation of hipStreamAddCallback parameter list. + */ +TEST_CASE("Unit_hipStreamAddCallback_ParamTst_Negative") { + hipStream_t mystream; + HIP_CHECK(hipStreamCreate(&mystream)); + + // Scenario1 + SECTION("callback is nullptr for non-default stream") { REQUIRE_FALSE(hipSuccess == hipStreamAddCallback(mystream, nullptr, nullptr, 0)); } // Scenario2 - SECTION("stream is default") { + SECTION("callback is nullptr for default stream") { REQUIRE_FALSE(hipSuccess == hipStreamAddCallback(0, nullptr, nullptr, 0)); } @@ -184,31 +220,6 @@ TEST_CASE("Unit_hipStreamAddCallback_ParamTst") { REQUIRE_FALSE(hipSuccess == hipStreamAddCallback(0, Callback, nullptr, 10)); } - // Scenario5 - SECTION("userData pointer value validation") { - gstream = mystream; - gusrptr = ptr0xff; - gPassed = true; - gcbDone = false; - HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkUsrdataPtr, - gusrptr, 0)); - while (!gcbDone) { - std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms - } - REQUIRE_FALSE(!gPassed); - } - // Scenario6 - SECTION("stream value validation") { - gstream = mystream; - gPassed = true; - gcbDone = false; - HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkStreamValue, - nullptr, 0)); - while (!gcbDone) { - std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms - } - REQUIRE_FALSE(!gPassed); - } HIP_CHECK(hipStreamDestroy(mystream)); } diff --git a/tests/catch/unit/stream/hipStreamGetPriority.cc b/tests/catch/unit/stream/hipStreamGetPriority.cc index e2384edd8e..b3a85d30ae 100644 --- a/tests/catch/unit/stream/hipStreamGetPriority.cc +++ b/tests/catch/unit/stream/hipStreamGetPriority.cc @@ -29,16 +29,6 @@ priority should be clamped to the priority range. #include -/** - * Check the error returned when an invalid pointer to a priority is used. - */ -TEST_CASE("Unit_hipStreamGetPriority_InvalidPriorityPointer") { - hipStream_t stream{}; - HIP_CHECK(hipStreamCreate(&stream)); - HIP_CHECK_ERROR(hipStreamGetPriority(stream, nullptr), hipErrorInvalidValue); - HIP_CHECK(hipStreamDestroy(stream)); -} - /** * Create stream and check priority. */ @@ -145,7 +135,7 @@ TEST_CASE("Unit_hipStreamGetPriority_StreamsWithCUMask") { int priority_high = 0; // Test is to get the Stream Priority Range HIP_CHECK(hipDeviceGetStreamPriorityRange(&priority_low, &priority_high)); - priority_normal = priority_low + priority_high; + priority_normal = (priority_low + priority_high) / 2; // Check if priorities are indeed supported REQUIRE_FALSE(priority_low == priority_high); // Creating a stream with hipExtStreamCreateWithCUMask and checking From 4afc7866b5f8491e9b5bb6724990715e0380ec97 Mon Sep 17 00:00:00 2001 From: nives-vukovic <110852104+nives-vukovic@users.noreply.github.com> Date: Mon, 26 Sep 2022 07:33:30 +0200 Subject: [PATCH 22/39] EXSWHTEC-37 - Expand tests for hipStreamQuery (#2921) - Add testing for null stream in Unit_hipStreamQuery_WithNoWork - Add testing for null stream in Unit_hipStreamQuery_WithFinishedWork --- tests/catch/unit/stream/hipStreamQuery.cc | 32 +++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/catch/unit/stream/hipStreamQuery.cc b/tests/catch/unit/stream/hipStreamQuery.cc index ea2e9d0476..8b99dc712c 100644 --- a/tests/catch/unit/stream/hipStreamQuery.cc +++ b/tests/catch/unit/stream/hipStreamQuery.cc @@ -26,9 +26,16 @@ THE SOFTWARE. **/ TEST_CASE("Unit_hipStreamQuery_WithNoWork") { hipStream_t stream{nullptr}; - HIP_CHECK(hipStreamCreate(&stream)); - HIP_CHECK(hipStreamQuery(stream)); - HIP_CHECK(hipStreamDestroy(stream)); + + SECTION("Null Stream") { + HIP_CHECK(hipStreamQuery(stream)); + } + + SECTION ("Created Stream") { + HIP_CHECK(hipStreamCreate(&stream)); + HIP_CHECK(hipStreamQuery(stream)); + HIP_CHECK(hipStreamDestroy(stream)); + } } /** @@ -37,13 +44,22 @@ TEST_CASE("Unit_hipStreamQuery_WithNoWork") { **/ TEST_CASE("Unit_hipStreamQuery_WithFinishedWork") { hipStream_t stream{nullptr}; - HIP_CHECK(hipStreamCreate(&stream)); - hip::stream::empty_kernel<<>>(); - HIP_CHECK(hipStreamSynchronize(stream)); + SECTION("Null Stream") { + hip::stream::empty_kernel<<>>(); + HIP_CHECK(hipStreamSynchronize(stream)); - HIP_CHECK(hipStreamQuery(stream)); - HIP_CHECK(hipStreamDestroy(stream)); + HIP_CHECK(hipStreamQuery(stream)); + } + + SECTION ("Created Stream") { + HIP_CHECK(hipStreamCreate(&stream)); + hip::stream::empty_kernel<<>>(); + HIP_CHECK(hipStreamSynchronize(stream)); + + HIP_CHECK(hipStreamQuery(stream)); + HIP_CHECK(hipStreamDestroy(stream)); + } } #if !HT_NVIDIA From 8cb701166d3da5dc36cf2b80d5b6ce80fb71ef73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirza=20Halil=C4=8Devi=C4=87?= <109971222+mirza-halilcevic@users.noreply.github.com> Date: Mon, 26 Sep 2022 10:16:38 +0200 Subject: [PATCH 23/39] EXSWHTEC-4 - Implement printing of certain device information (#2884) * Implement printing out of device count to standard output * Implement printing out of device attributes retrieved by hipDeviceGetAttribute. * Implement printing of device properties retrieved by hipGetDeviceProperties. --- .../unit/device/hipGetDeviceAttribute.cc | 192 +++++++++++++++++- tests/catch/unit/device/hipGetDeviceCount.cc | 21 +- .../unit/device/hipGetDeviceProperties.cc | 119 +++++++++++ 3 files changed, 324 insertions(+), 8 deletions(-) diff --git a/tests/catch/unit/device/hipGetDeviceAttribute.cc b/tests/catch/unit/device/hipGetDeviceAttribute.cc index fb11f64d54..62b1aceed4 100644 --- a/tests/catch/unit/device/hipGetDeviceAttribute.cc +++ b/tests/catch/unit/device/hipGetDeviceAttribute.cc @@ -21,13 +21,16 @@ THE SOFTWARE. */ // Test the device info API extensions for HIP -#include #include #ifdef __linux__ #include #endif + +#include #include +#include + static hipError_t test_hipDeviceGetAttribute(int deviceId, hipDeviceAttribute_t attr, int expectedValue = -1) { @@ -366,3 +369,190 @@ TEST_CASE("Unit_hipDeviceGetAttribute_NegTst") { device)); } } + +template +using AttributeToStringMap = std::array, n>; + +namespace { + +constexpr AttributeToStringMap<56> kCommonAttributes{{ + {hipDeviceAttributeEccEnabled, "hipDeviceAttributeEccEnabled"}, + {hipDeviceAttributeCanMapHostMemory, "hipDeviceAttributeCanMapHostMemory"}, + {hipDeviceAttributeClockRate, "hipDeviceAttributeClockRate"}, + {hipDeviceAttributeComputeMode, "hipDeviceAttributeComputeMode"}, + {hipDeviceAttributeConcurrentKernels, "hipDeviceAttributeConcurrentKernels"}, + {hipDeviceAttributeConcurrentManagedAccess, "hipDeviceAttributeConcurrentManagedAccess"}, + {hipDeviceAttributeCooperativeLaunch, "hipDeviceAttributeCooperativeLaunch"}, + {hipDeviceAttributeCooperativeMultiDeviceLaunch, + "hipDeviceAttributeCooperativeMultiDeviceLaunch"}, + {hipDeviceAttributeDirectManagedMemAccessFromHost, + "hipDeviceAttributeDirectManagedMemAccessFromHost"}, + {hipDeviceAttributeIntegrated, "hipDeviceAttributeIntegrated"}, + {hipDeviceAttributeIsMultiGpuBoard, "hipDeviceAttributeIsMultiGpuBoard"}, + {hipDeviceAttributeKernelExecTimeout, "hipDeviceAttributeKernelExecTimeout"}, + {hipDeviceAttributeL2CacheSize, "hipDeviceAttributeL2CacheSize"}, + {hipDeviceAttributeLocalL1CacheSupported, "hipDeviceAttributeLocalL1CacheSupported"}, + {hipDeviceAttributeComputeCapabilityMajor, "hipDeviceAttributeComputeCapabilityMajor"}, + {hipDeviceAttributeManagedMemory, "hipDeviceAttributeManagedMemory"}, + {hipDeviceAttributeMaxBlockDimX, "hipDeviceAttributeMaxBlockDimX"}, + {hipDeviceAttributeMaxBlockDimY, "hipDeviceAttributeMaxBlockDimY"}, + {hipDeviceAttributeMaxBlockDimZ, "hipDeviceAttributeMaxBlockDimZ"}, + {hipDeviceAttributeMaxGridDimX, "hipDeviceAttributeMaxGridDimX"}, + {hipDeviceAttributeMaxGridDimY, "hipDeviceAttributeMaxGridDimY"}, + {hipDeviceAttributeMaxGridDimZ, "hipDeviceAttributeMaxGridDimZ"}, + {hipDeviceAttributeMaxSurface1D, "hipDeviceAttributeMaxSurface1D"}, + {hipDeviceAttributeMaxSurface2D, "hipDeviceAttributeMaxSurface2D"}, + {hipDeviceAttributeMaxSurface3D, "hipDeviceAttributeMaxSurface3D"}, + {hipDeviceAttributeMaxTexture1DWidth, "hipDeviceAttributeMaxTexture1DWidth"}, + {hipDeviceAttributeMaxTexture1DLinear, "hipDeviceAttributeMaxTexture1DLinear"}, + {hipDeviceAttributeMaxTexture2DWidth, "hipDeviceAttributeMaxTexture2DWidth"}, + {hipDeviceAttributeMaxTexture2DHeight, "hipDeviceAttributeMaxTexture2DHeight"}, + {hipDeviceAttributeMaxTexture3DWidth, "hipDeviceAttributeMaxTexture3DWidth"}, + {hipDeviceAttributeMaxTexture3DHeight, "hipDeviceAttributeMaxTexture3DHeight"}, + {hipDeviceAttributeMaxTexture3DDepth, "hipDeviceAttributeMaxTexture3DDepth"}, + {hipDeviceAttributeMaxThreadsDim, "hipDeviceAttributeMaxThreadsDim"}, + {hipDeviceAttributeMaxThreadsPerBlock, "hipDeviceAttributeMaxThreadsPerBlock"}, + {hipDeviceAttributeMaxThreadsPerMultiProcessor, + "hipDeviceAttributeMaxThreadsPerMultiProcessor"}, + {hipDeviceAttributeMaxPitch, "hipDeviceAttributeMaxPitch"}, + {hipDeviceAttributeMemoryBusWidth, "hipDeviceAttributeMemoryBusWidth"}, + {hipDeviceAttributeMemoryClockRate, "hipDeviceAttributeMemoryClockRate"}, + {hipDeviceAttributeComputeCapabilityMinor, "hipDeviceAttributeComputeCapabilityMinor"}, + {hipDeviceAttributeMultiprocessorCount, "hipDeviceAttributeMultiprocessorCount"}, + {hipDeviceAttributeName, "hipDeviceAttributeName"}, + {hipDeviceAttributePageableMemoryAccess, "hipDeviceAttributePageableMemoryAccess"}, + {hipDeviceAttributePageableMemoryAccessUsesHostPageTables, + "hipDeviceAttributePageableMemoryAccessUsesHostPageTables"}, + {hipDeviceAttributePciBusId, "hipDeviceAttributePciBusId"}, + {hipDeviceAttributePciDeviceId, "hipDeviceAttributePciDeviceId"}, + {hipDeviceAttributePciDomainID, "hipDeviceAttributePciDomainID"}, + {hipDeviceAttributeMaxRegistersPerBlock, "hipDeviceAttributeMaxRegistersPerBlock"}, + {hipDeviceAttributeMaxRegistersPerMultiprocessor, + "hipDeviceAttributeMaxRegistersPerMultiprocessor"}, + {hipDeviceAttributeMaxSharedMemoryPerBlock, "hipDeviceAttributeMaxSharedMemoryPerBlock"}, + {hipDeviceAttributeTextureAlignment, "hipDeviceAttributeTextureAlignment"}, + {hipDeviceAttributeTexturePitchAlignment, "hipDeviceAttributeTexturePitchAlignment"}, + {hipDeviceAttributeTotalConstantMemory, "hipDeviceAttributeTotalConstantMemory"}, + {hipDeviceAttributeTotalGlobalMem, "hipDeviceAttributeTotalGlobalMem"}, + {hipDeviceAttributeWarpSize, "hipDeviceAttributeWarpSize"}, + {hipDeviceAttributeMemoryPoolsSupported, "hipDeviceAttributeMemoryPoolsSupported"}, + {hipDeviceAttributeVirtualMemoryManagementSupported, + "hipDeviceAttributeVirtualMemoryManagementSupported"} +}}; + +#if HT_NVIDIA +constexpr AttributeToStringMap<34> kCudaOnlyAttributes{ + {{hipDeviceAttributeAccessPolicyMaxWindowSize, "hipDeviceAttributeAccessPolicyMaxWindowSize"}, + {hipDeviceAttributeAsyncEngineCount, "hipDeviceAttributeAsyncEngineCount"}, + {hipDeviceAttributeCanUseHostPointerForRegisteredMem, + "hipDeviceAttributeCanUseHostPointerForRegisteredMem"}, + {hipDeviceAttributeComputePreemptionSupported, "hipDeviceAttributeComputePreemptionSupported"}, + {hipDeviceAttributeDeviceOverlap, "hipDeviceAttributeDeviceOverlap"}, + {hipDeviceAttributeGlobalL1CacheSupported, "hipDeviceAttributeGlobalL1CacheSupported"}, + {hipDeviceAttributeHostNativeAtomicSupported, "hipDeviceAttributeHostNativeAtomicSupported"}, + {hipDeviceAttributeLuid, "hipDeviceAttributeLuid"}, + {hipDeviceAttributeLuidDeviceNodeMask, "hipDeviceAttributeLuidDeviceNodeMask"}, + {hipDeviceAttributeMaxBlocksPerMultiProcessor, "hipDeviceAttributeMaxBlocksPerMultiProcessor"}, + {hipDeviceAttributeMaxSurface1DLayered, "hipDeviceAttributeMaxSurface1DLayered"}, + {hipDeviceAttributeMaxSurface2DLayered, "hipDeviceAttributeMaxSurface2DLayered"}, + {hipDeviceAttributeMaxSurfaceCubemap, "hipDeviceAttributeMaxSurfaceCubemap"}, + {hipDeviceAttributeMaxSurfaceCubemapLayered, "hipDeviceAttributeMaxSurfaceCubemapLayered"}, + {hipDeviceAttributeMaxTexture1DLayered, "hipDeviceAttributeMaxTexture1DLayered"}, + {hipDeviceAttributeMaxTexture1DMipmap, "hipDeviceAttributeMaxTexture1DMipmap"}, + {hipDeviceAttributeMaxTexture2DGather, "hipDeviceAttributeMaxTexture2DGather"}, + {hipDeviceAttributeMaxTexture2DLayered, "hipDeviceAttributeMaxTexture2DLayered"}, + {hipDeviceAttributeMaxTexture2DLinear, "hipDeviceAttributeMaxTexture2DLinear"}, + {hipDeviceAttributeMaxTexture2DMipmap, "hipDeviceAttributeMaxTexture2DMipmap"}, + {hipDeviceAttributeMaxTexture3DAlt, "hipDeviceAttributeMaxTexture3DAlt"}, + {hipDeviceAttributeMaxTextureCubemap, "hipDeviceAttributeMaxTextureCubemap"}, + {hipDeviceAttributeMaxTextureCubemapLayered, "hipDeviceAttributeMaxTextureCubemapLayered"}, + {hipDeviceAttributeMultiGpuBoardGroupID, "hipDeviceAttributeMultiGpuBoardGroupID"}, + {hipDeviceAttributePersistingL2CacheMaxSize, "hipDeviceAttributePersistingL2CacheMaxSize"}, + {hipDeviceAttributeReservedSharedMemPerBlock, "hipDeviceAttributeReservedSharedMemPerBlock"}, + {hipDeviceAttributeSharedMemPerBlockOptin, "hipDeviceAttributeSharedMemPerBlockOptin"}, + {hipDeviceAttributeSharedMemPerMultiprocessor, "hipDeviceAttributeSharedMemPerMultiprocessor"}, + {hipDeviceAttributeSingleToDoublePrecisionPerfRatio, + "hipDeviceAttributeSingleToDoublePrecisionPerfRatio"}, + {hipDeviceAttributeStreamPrioritiesSupported, "hipDeviceAttributeStreamPrioritiesSupported"}, + {hipDeviceAttributeSurfaceAlignment, "hipDeviceAttributeSurfaceAlignment"}, + {hipDeviceAttributeTccDriver, "hipDeviceAttributeTccDriver"}, + {hipDeviceAttributeUnifiedAddressing, "hipDeviceAttributeUnifiedAddressing"}, + {hipDeviceAttributeUuid, "hipDeviceAttributeUuid"}}}; +#endif + +#if HT_AMD +constexpr AttributeToStringMap<17> kAmdOnlyAttributes{{ + {hipDeviceAttributeClockInstructionRate, "hipDeviceAttributeClockInstructionRate"}, + {hipDeviceAttributeArch, "hipDeviceAttributeArch"}, + {hipDeviceAttributeMaxSharedMemoryPerMultiprocessor, + "hipDeviceAttributeMaxSharedMemoryPerMultiprocessor"}, + {hipDeviceAttributeGcnArch, "hipDeviceAttributeGcnArch"}, + {hipDeviceAttributeGcnArchName, "hipDeviceAttributeGcnArchName"}, + {hipDeviceAttributeHdpMemFlushCntl, "hipDeviceAttributeHdpMemFlushCntl"}, + {hipDeviceAttributeHdpRegFlushCntl, "hipDeviceAttributeHdpRegFlushCntl"}, + {hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc, + "hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc"}, + {hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim, + "hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim"}, + {hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim, + "hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim"}, + {hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem, + "hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem"}, + {hipDeviceAttributeIsLargeBar, "hipDeviceAttributeIsLargeBar"}, + {hipDeviceAttributeAsicRevision, "hipDeviceAttributeAsicRevision"}, + {hipDeviceAttributeCanUseStreamWaitValue, "hipDeviceAttributeCanUseStreamWaitValue"}, + {hipDeviceAttributeImageSupport, "hipDeviceAttributeImageSupport"}, + {hipDeviceAttributePhysicalMultiProcessorCount, + "hipDeviceAttributePhysicalMultiProcessorCount"}, + {hipDeviceAttributeFineGrainSupport, "hipDeviceAttributeFineGrainSupport"} + // {hipDeviceAttributeWallClockRate, "hipDeviceAttributeWallClockRate"} +}}; +#endif + +constexpr int kW = 60; + +} // anonymous namespace + +template void printAttributes(const AttributeToStringMap& attributes, const int device) { + int attribute_value; + hipError_t ret_val; + for (const auto& attribute : attributes) { + ret_val = hipDeviceGetAttribute(&attribute_value, attribute.first, device); + std::cout << std::setw(kW) << std::string(attribute.second).append(": "); + if (ret_val == hipSuccess) + std::cout << attribute_value << "\n"; + else + std::cout << "unsupported\n"; + } + std::flush(std::cout); +} + +TEST_CASE("Print_Out_Attributes") { + const auto device = GENERATE(range(0, HipTest::getDeviceCount())); + hipDeviceProp_t properties; + HIP_CHECK(hipGetDeviceProperties(&properties, device)); + + std::cout << std::left; + std::cout << std::setw(kW) << "device#: " << device << "\n"; + std::cout << std::setw(kW) << "name: " << properties.name << "\n"; + + printAttributes(kCommonAttributes, device); + +#if HT_NVIDIA + std::cout << "\nCUDA only\n"; + std::cout << std::setw(kW) + << "--------------------------------------------------------------------------------" + << "\n"; + printAttributes(kCudaOnlyAttributes, device); +#endif + +#if HT_AMD + std::cout << "\nAMD only\n"; + std::cout << std::setw(kW) + << "--------------------------------------------------------------------------------" + << "\n"; + printAttributes(kAmdOnlyAttributes, device); +#endif + + std::flush(std::cout); +} \ No newline at end of file diff --git a/tests/catch/unit/device/hipGetDeviceCount.cc b/tests/catch/unit/device/hipGetDeviceCount.cc index 2facbf9515..387afc5ff6 100644 --- a/tests/catch/unit/device/hipGetDeviceCount.cc +++ b/tests/catch/unit/device/hipGetDeviceCount.cc @@ -1,19 +1,22 @@ /* -Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR -IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @@ -55,3 +58,7 @@ TEST_CASE("Unit_hipGetDeviceCount_HideDevices") { REQUIRE(proc.run(visibleStr) == i); } } + +TEST_CASE("Print_Out_Device_Count") { + std::cout << "Device Count: " << HipTest::getDeviceCount() << std::endl; +} \ No newline at end of file diff --git a/tests/catch/unit/device/hipGetDeviceProperties.cc b/tests/catch/unit/device/hipGetDeviceProperties.cc index fe5ba6ffd6..0bb97af52c 100644 --- a/tests/catch/unit/device/hipGetDeviceProperties.cc +++ b/tests/catch/unit/device/hipGetDeviceProperties.cc @@ -199,3 +199,122 @@ TEST_CASE("Unit_hipGetDeviceProperties_NegTst") { REQUIRE_FALSE(hipSuccess == hipGetDeviceProperties(&prop, deviceCount)); } } + +TEST_CASE("Print_Out_Properties") { + constexpr int w = 42; + const auto device = GENERATE(range(0, HipTest::getDeviceCount())); + + hipDeviceProp_t properties; + HIP_CHECK(hipGetDeviceProperties(&properties, device)); + + std::cout << std::left; + std::cout << std::setw(w) << "device#: " << device << "\n"; + std::cout << std::setw(w) << "name: " << std::string(properties.name, 256) << "\n"; + std::cout << std::setw(w) << "totalGlobalMem: " << properties.totalGlobalMem << "\n"; + std::cout << std::setw(w) << "sharedMemPerBlock: " << properties.sharedMemPerBlock << "\n"; + std::cout << std::setw(w) << "regsPerBlock: " << properties.regsPerBlock << "\n"; + std::cout << std::setw(w) << "warpSize: " << properties.warpSize << "\n"; + std::cout << std::setw(w) << "maxThreadsPerBlock: " << properties.maxThreadsPerBlock << "\n"; + std::cout << std::setw(w) << "maxThreadsDim.x: " << properties.maxThreadsDim[0] << "\n"; + std::cout << std::setw(w) << "maxThreadsDim.y: " << properties.maxThreadsDim[1] << "\n"; + std::cout << std::setw(w) << "maxThreadsDim.z: " << properties.maxThreadsDim[2] << "\n"; + std::cout << std::setw(w) << "maxGridSize.x: " << properties.maxGridSize[0] << "\n"; + std::cout << std::setw(w) << "maxGridSize.y: " << properties.maxGridSize[1] << "\n"; + std::cout << std::setw(w) << "maxGridSize.z: " << properties.maxGridSize[2] << "\n"; + std::cout << std::setw(w) << "clockRate: " << properties.clockRate << "\n"; + std::cout << std::setw(w) << "memoryClockRate: " << properties.memoryClockRate << "\n"; + std::cout << std::setw(w) << "memoryBusWidth: " << properties.memoryBusWidth << "\n"; + std::cout << std::setw(w) << "totalConstMem: " << properties.totalConstMem << "\n"; + std::cout << std::setw(w) << "major: " << properties.major << "\n"; + std::cout << std::setw(w) << "minor: " << properties.minor << "\n"; + std::cout << std::setw(w) << "multiProcessorCount: " << properties.multiProcessorCount << "\n"; + std::cout << std::setw(w) << "l2CacheSize: " << properties.l2CacheSize << "\n"; + std::cout << std::setw(w) + << "maxThreadsPerMultiProcessor: " << properties.maxThreadsPerMultiProcessor << "\n"; + std::cout << std::setw(w) << "computeMode: " << properties.computeMode << "\n"; + std::cout << std::setw(w) << "concurrentKernels: " << properties.concurrentKernels << "\n"; + std::cout << std::setw(w) << "pciDomainID: " << properties.pciDomainID << "\n"; + std::cout << std::setw(w) << "pciBusID: " << properties.pciBusID << "\n"; + std::cout << std::setw(w) << "pciDeviceID: " << properties.pciDeviceID << "\n"; + std::cout << std::setw(w) << "isMultiGpuBoard: " << properties.isMultiGpuBoard << "\n"; + std::cout << std::setw(w) << "canMapHostMemory: " << properties.canMapHostMemory << "\n"; + std::cout << std::setw(w) << "integrated: " << properties.integrated << "\n"; + std::cout << std::setw(w) << "cooperativeLaunch: " << properties.cooperativeLaunch << "\n"; + std::cout << std::setw(w) + << "cooperativeMultiDeviceLaunch: " << properties.cooperativeMultiDeviceLaunch << "\n"; + std::cout << std::setw(w) << "maxTexture1DLinear: " << properties.maxTexture1DLinear << "\n"; + std::cout << std::setw(w) << "maxTexture1D: " << properties.maxTexture1D << "\n"; + std::cout << std::setw(w) << "maxTexture2D.width: " << properties.maxTexture2D[0] << "\n"; + std::cout << std::setw(w) << "maxTexture2D.height: " << properties.maxTexture2D[1] << "\n"; + std::cout << std::setw(w) << "maxTexture3D.width: " << properties.maxTexture3D[0] << "\n"; + std::cout << std::setw(w) << "maxTexture3D.height: " << properties.maxTexture3D[1] << "\n"; + std::cout << std::setw(w) << "maxTexture3D.depth: " << properties.maxTexture3D[2] << "\n"; + std::cout << std::setw(w) << "memPitch: " << properties.memPitch << "\n"; + std::cout << std::setw(w) << "textureAlignment: " << properties.textureAlignment << "\n"; + std::cout << std::setw(w) << "texturePitchAlignment: " << properties.texturePitchAlignment + << "\n"; + std::cout << std::setw(w) << "kernelExecTimeoutEnabled: " << properties.kernelExecTimeoutEnabled + << "\n"; + std::cout << std::setw(w) << "ECCEnabled: " << properties.ECCEnabled << "\n"; + std::cout << std::setw(w) << "tccDriver: " << properties.tccDriver << "\n"; + std::cout << std::setw(w) << "managedMemory: " << properties.managedMemory << "\n"; + std::cout << std::setw(w) + << "directManagedMemAccessFromHost: " << properties.directManagedMemAccessFromHost + << "\n"; + std::cout << std::setw(w) << "concurrentManagedAccess: " << properties.concurrentManagedAccess + << "\n"; + std::cout << std::setw(w) << "pageableMemoryAccess: " << properties.pageableMemoryAccess << "\n"; + std::cout << std::setw(w) << "pageableMemoryAccessUsesHostPageTables: " + << properties.pageableMemoryAccessUsesHostPageTables << "\n"; + +#if HT_AMD + std::cout << std::setw(w) << "gcnArch: " << properties.gcnArch << "\n"; + std::cout << std::setw(w) << "gcnArchName: " << std::string(properties.gcnArchName, 256) << "\n"; + std::cout << std::setw(w) << "asicRevision: " << properties.asicRevision << "\n"; + std::cout << std::setw(w) + << "arch.hasGlobalInt32Atomics: " << properties.arch.hasGlobalInt32Atomics << "\n"; + std::cout << std::setw(w) + << "arch.hasGlobalFloatAtomicExch: " << properties.arch.hasGlobalFloatAtomicExch + << "\n"; + std::cout << std::setw(w) + << "arch.hasSharedInt32Atomics: " << properties.arch.hasSharedInt32Atomics << "\n"; + std::cout << std::setw(w) + << "arch.hasSharedFloatAtomicExch: " << properties.arch.hasSharedFloatAtomicExch + << "\n"; + std::cout << std::setw(w) << "arch.hasFloatAtomicAdd: " << properties.arch.hasFloatAtomicAdd + << "\n"; + std::cout << std::setw(w) + << "arch.hasGlobalInt64Atomics: " << properties.arch.hasGlobalInt64Atomics << "\n"; + std::cout << std::setw(w) + << "arch.hasSharedInt64Atomics: " << properties.arch.hasSharedInt64Atomics << "\n"; + std::cout << std::setw(w) << "arch.hasDoubles: " << properties.arch.hasDoubles << "\n"; + std::cout << std::setw(w) << "arch.hasWarpVote: " << properties.arch.hasWarpVote << "\n"; + std::cout << std::setw(w) << "arch.hasWarpBallot: " << properties.arch.hasWarpBallot << "\n"; + std::cout << std::setw(w) << "arch.hasWarpShuffle: " << properties.arch.hasWarpShuffle << "\n"; + std::cout << std::setw(w) << "arch.hasFunnelShift: " << properties.arch.hasFunnelShift << "\n"; + std::cout << std::setw(w) << "arch.hasThreadFenceSystem: " << properties.arch.hasThreadFenceSystem + << "\n"; + std::cout << std::setw(w) << "arch.hasSyncThreadsExt: " << properties.arch.hasSyncThreadsExt + << "\n"; + std::cout << std::setw(w) << "arch.hasSurfaceFuncs: " << properties.arch.hasSurfaceFuncs << "\n"; + std::cout << std::setw(w) << "arch.has3dGrid: " << properties.arch.has3dGrid << "\n"; + std::cout << std::setw(w) + << "arch.hasDynamicParallelism: " << properties.arch.hasDynamicParallelism << "\n"; + std::cout << std::setw(w) << "isLargeBar: " << properties.isLargeBar << "\n"; + std::cout << std::setw(w) + << "maxSharedMemoryPerMultiProcessor: " << properties.maxSharedMemoryPerMultiProcessor + << "\n"; + std::cout << std::setw(w) << "hdpMemFlushCntl: " << properties.hdpMemFlushCntl << "\n"; + std::cout << std::setw(w) << "hdpRegFlushCntl: " << properties.hdpRegFlushCntl << "\n"; + std::cout << std::setw(w) << "clockInstructionRate: " << properties.clockInstructionRate << "\n"; + std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedFunc: " + << properties.cooperativeMultiDeviceUnmatchedFunc << "\n"; + std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedGridDim: " + << properties.cooperativeMultiDeviceUnmatchedGridDim << "\n"; + std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedBlockDim: " + << properties.cooperativeMultiDeviceUnmatchedBlockDim << "\n"; + std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedSharedMem: " + << properties.cooperativeMultiDeviceUnmatchedSharedMem << "\n"; +#endif + std::flush(std::cout); +} \ No newline at end of file From 5bf0dbe5ad6a47dbe0de168f8dbc21be7d2ecb4d Mon Sep 17 00:00:00 2001 From: nives-vukovic <110852104+nives-vukovic@users.noreply.github.com> Date: Mon, 26 Sep 2022 10:17:12 +0200 Subject: [PATCH 24/39] EXSWHTEC-15 - Implement additional HipEventElapsedTime tests (#2903) - Fix minor bug in helper test function in Unit_hipEvent.cc - Move negative test from Unit_hipEventElapsedTime_DifferentDevices to Unit_hipEventRecord_Negative - Add Unit_hipEventElapsedTime_NotReady_Negative test when function is called on event that has not been completed --- tests/catch/unit/event/Unit_hipEvent.cc | 3 +- .../unit/event/Unit_hipEventElapsedTime.cc | 44 ++++++++++++++++--- tests/catch/unit/event/Unit_hipEventRecord.cc | 25 ++++++++++- 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/tests/catch/unit/event/Unit_hipEvent.cc b/tests/catch/unit/event/Unit_hipEvent.cc index ceeaa54db7..d0b2fd0a1e 100644 --- a/tests/catch/unit/event/Unit_hipEvent.cc +++ b/tests/catch/unit/event/Unit_hipEvent.cc @@ -114,7 +114,8 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_ if (e == hipSuccess) assert(t == 0.0f); // stop usually ready unless we skipped the synchronization (syncNone) - HIP_ASSERT(hipEventElapsedTime(&t, stop, stop) == expectedStopError); + e = hipEventElapsedTime(&t, stop, stop); + HIP_ASSERT(e == expectedStopError); if (e == hipSuccess) assert(t == 0.0f); e = hipEventElapsedTime(&t, start, stop); diff --git a/tests/catch/unit/event/Unit_hipEventElapsedTime.cc b/tests/catch/unit/event/Unit_hipEventElapsedTime.cc index e2fd695fa9..a3ebad3e88 100644 --- a/tests/catch/unit/event/Unit_hipEventElapsedTime.cc +++ b/tests/catch/unit/event/Unit_hipEventElapsedTime.cc @@ -19,8 +19,19 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* +Testcase Scenarios : +Unit_hipEventElapsedTime_NullCheck - Test unsuccessful hipEventElapsedTime when either event passed as nullptr +Unit_hipEventElapsedTime_DisableTiming - Test unsuccessful hipEventElapsedTime when events are created with hipEventDisableTiming flag +Unit_hipEventElapsedTime_DifferentDevices - Test unsuccessful hipEventElapsedTime when events are recorded on different devices +Unit_hipEventElapsedTime_NotReady_Negative - Test unsuccessful hipEventElapsedTime when an event has not been completed +Unit_hipEventElapsedTime - Test time elapsed between two recorded events with hipEventElapsedTime api +*/ #include + +#include + #include TEST_CASE("Unit_hipEventElapsedTime_NullCheck") { @@ -51,9 +62,7 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") { // create event on dev=0 HIP_CHECK(hipSetDevice(0)); hipEvent_t start; - hipEvent_t start1; HIP_CHECK(hipEventCreate(&start)); - HIP_CHECK(hipEventCreate(&start1)); HIP_CHECK(hipEventRecord(start, nullptr)); HIP_CHECK(hipEventSynchronize(start)); @@ -63,9 +72,6 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") { hipEvent_t stop; HIP_CHECK(hipEventCreate(&stop)); - // start1 on device 0 but null stream on device 1 - HIP_ASSERT(hipEventRecord(start1, nullptr) == hipErrorInvalidHandle); - HIP_CHECK(hipEventRecord(stop, nullptr)); HIP_CHECK(hipEventSynchronize(stop)); @@ -74,11 +80,37 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") { HIP_ASSERT(hipEventElapsedTime(&tElapsed,start,stop) == hipErrorInvalidHandle); HIP_CHECK(hipEventDestroy(start)); - HIP_CHECK(hipEventDestroy(start1)); HIP_CHECK(hipEventDestroy(stop)); } } + +#if HT_AMD /* Disabled because frequency based wait is timing out on nvidia platforms */ +TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") { + hipEvent_t start; + HIP_CHECK(hipEventCreate(&start)); + + hipEvent_t stop; + HIP_CHECK(hipEventCreate(&stop)); + + // Record start event + HIP_CHECK(hipEventRecord(start, nullptr)); + + HipTest::runKernelForDuration(std::chrono::milliseconds(1000)); + + // Record stop event + HIP_CHECK(hipEventRecord(stop, nullptr)); + + // stop event has not been completed + float tElapsed = 1.0f; + HIP_CHECK_ERROR(hipEventQuery(stop), hipErrorNotReady); + HIP_ASSERT(hipEventElapsedTime(&tElapsed,start,stop) == hipErrorNotReady); + + HIP_CHECK(hipEventDestroy(start)); + HIP_CHECK(hipEventDestroy(stop)); +} +#endif // HT_AMD + TEST_CASE("Unit_hipEventElapsedTime") { hipEvent_t start; HIP_CHECK(hipEventCreate(&start)); diff --git a/tests/catch/unit/event/Unit_hipEventRecord.cc b/tests/catch/unit/event/Unit_hipEventRecord.cc index 41c793d23e..7bf5462637 100644 --- a/tests/catch/unit/event/Unit_hipEventRecord.cc +++ b/tests/catch/unit/event/Unit_hipEventRecord.cc @@ -19,8 +19,12 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -// Test hipEventRecord serialization behavior. +/* +Testcase Scenarios : +Unit_hipEventRecord- Test hipEventRecord serialization behavior +Unit_hipEventRecord_Negative - Test unsuccessful hipEventRecord when event is passed as nullptr + - Test unsuccessful hipEventRecord when event is created/recorded on different devices +*/ #include @@ -117,4 +121,21 @@ TEST_CASE("Unit_hipEventRecord_Negative") { SECTION("Nullptr event") { HIP_CHECK_ERROR(hipEventRecord(nullptr, nullptr), hipErrorInvalidResourceHandle); } + + SECTION("Different devices") { + int devCount = 0; + HIP_CHECK(hipGetDeviceCount(&devCount)); + if (devCount > 1) { + // create event on dev=0 + HIP_CHECK(hipSetDevice(0)); + hipEvent_t start; + HIP_CHECK(hipEventCreate(&start)); + + // start on device 0 but null stream on device 1 + HIP_CHECK(hipSetDevice(1)); + HIP_CHECK_ERROR(hipEventRecord(start, nullptr), hipErrorInvalidHandle) + + HIP_CHECK(hipEventDestroy(start)); + } + } } \ No newline at end of file From 2d53608d4991bb0f377d273af379201ff595418a Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Mon, 26 Sep 2022 19:49:00 +0530 Subject: [PATCH 25/39] SWDEV-331160 - [catch2][dtest] Test cases to test api hipDeviceSetLimit() (#2863) Change-Id: Ifb78392b55b60ce8b3eb7822a0b32c8fac8cc594 --- tests/catch/unit/device/CMakeLists.txt | 1 + tests/catch/unit/device/hipDeviceSetLimit.cc | 101 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 tests/catch/unit/device/hipDeviceSetLimit.cc diff --git a/tests/catch/unit/device/CMakeLists.txt b/tests/catch/unit/device/CMakeLists.txt index b0b1a495b9..4dc6c79021 100644 --- a/tests/catch/unit/device/CMakeLists.txt +++ b/tests/catch/unit/device/CMakeLists.txt @@ -18,6 +18,7 @@ set(TEST_SRC hipDeviceGetUuid.cc hipDeviceGetP2PAttribute.cc hipExtGetLinkTypeAndHopCount.cc + hipDeviceSetLimit.cc ) set_source_files_properties(hipGetDeviceCount.cc PROPERTIES COMPILE_FLAGS -std=c++17) diff --git a/tests/catch/unit/device/hipDeviceSetLimit.cc b/tests/catch/unit/device/hipDeviceSetLimit.cc new file mode 100644 index 0000000000..0007a942e7 --- /dev/null +++ b/tests/catch/unit/device/hipDeviceSetLimit.cc @@ -0,0 +1,101 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR +IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* + * Conformance test for checking functionality of + * hipError_t hipDeviceSetLimit ( enum hipLimit_t limit, size_t value ); + */ +#include + +// Currently the HIGHER_VALUE is fixed to 16 KB based on currently +// set maximum value for hipLimitStackSize. In future, this value +// might need to change to avoid test case failure. In the same way +// LOWER_VALUE is empirically determined. +#define HIGHER_VALUE (16*1024) // 16 KB +#define LOWER_VALUE (512) // 512 bytes + +/** + * hipDeviceSetLimit tests => + */ +static bool testSetLimitFunc(hipLimit_t limit_to_test) { + size_t value = 0; + size_t setValue = LOWER_VALUE; + // Set Value to low Value. + HIP_CHECK(hipDeviceSetLimit(limit_to_test, setValue)); + HIP_CHECK(hipDeviceGetLimit(&value, limit_to_test)); + // The returned value could be rounded to maximum or minimum + REQUIRE(value >= LOWER_VALUE); + // Set Value to High value. + setValue = HIGHER_VALUE; + HIP_CHECK(hipDeviceSetLimit(limit_to_test, setValue)); + HIP_CHECK(hipDeviceGetLimit(&value, limit_to_test)); + // The returned value could be rounded to maximum or minimum + REQUIRE(value >= HIGHER_VALUE); + return true; +} + +/** + * hipDeviceSetLimit tests => + * + * Scenario1: Single device Set-Get test for hipLimitStackSize flag. + * + * Scenario2: Single device Set-Get test for hipLimitPrintfFifoSize flag. + * + * Scenario3: Single device Set-Get test for hipLimitMallocHeapSize flag. + * + * Scenario4: Multidevice Set-Get test for all the flags + * + * Scenario5: Negative Scenario - Invalid flag value + */ +TEST_CASE("Unit_hipDeviceSetLimit_SetGet") { + size_t value = 0; + // Scenario1 + SECTION("Set Get Test hipLimitStackSize") { + REQUIRE(true == testSetLimitFunc(hipLimitStackSize)); + } +#if HT_NVIDIA + // Scenario2 + SECTION("Set Get Test hipLimitPrintfFifoSize") { + REQUIRE(true == testSetLimitFunc(hipLimitPrintfFifoSize)); + } + // Scenario3 + SECTION("Set Get Test hipLimitMallocHeapSize") { + REQUIRE(true == testSetLimitFunc(hipLimitMallocHeapSize)); + } +#endif + // Scenario4 + SECTION("Multi device Set-Get test for all flags") { + int numDevices = 0; + HIP_CHECK(hipGetDeviceCount(&numDevices)); + for (int dev = 0; dev < numDevices; dev++) { + HIP_CHECK(hipSetDevice(dev)); + REQUIRE(true == testSetLimitFunc(hipLimitStackSize)); +#if HT_NVIDIA + REQUIRE(true == testSetLimitFunc(hipLimitPrintfFifoSize)); + REQUIRE(true == testSetLimitFunc(hipLimitMallocHeapSize)); +#endif + } + } + // Scenario5 + SECTION("Negative Scenario: Invalid Flag") { + HIP_CHECK(hipDeviceGetLimit(&value, hipLimitMallocHeapSize)); + REQUIRE(hipErrorInvalidValue == hipDeviceSetLimit( + static_cast(0xffff), value/2)); + } +} From 924db1d9e9db5bed60900571c09ffe821ef81858 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 05:11:34 +0530 Subject: [PATCH 26/39] SWDEV-355608 - deprecate a few hipcc-only options (#2962) Change-Id: I0a57e4afebbad9c4b93b70331869c22c39f1b38e --- bin/hipcc.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index fa833c023d..c725318ed9 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -321,6 +321,9 @@ foreach $arg (@ARGV) # Check target selection option: --offload-arch= and --amdgpu-target=... foreach my $targetOpt (@targetOpts) { if (substr($arg, 0, length($targetOpt)) eq $targetOpt) { + if ($targetOpt eq '--amdgpu-target=') { + print "Warning: The --amdgpu-target option has been deprecated and will be removed in the future. Use --offload-arch instead.\n"; + } # If targets string is not empty, add a comma before adding new target option value. $targetsStr .= ($targetsStr ? ',' : ''); $targetsStr .= substr($arg, length($targetOpt)); @@ -376,6 +379,7 @@ foreach $arg (@ARGV) } if($arg =~ '--amdhsa-code-object-version=') { + print "Warning: The --amdhsa-code-object-version option has been deprecated and will be removed in the future. Use -mllvm -mcode-object-version instead.\n"; $arg =~ s/--amdhsa-code-object-version=//; $hsacoVersion = $arg; $swallowArg = 1; @@ -534,12 +538,11 @@ foreach $arg (@ARGV) # Process HIPCC options here: if ($arg =~ m/^--hipcc/) { $swallowArg = 1; - #if $arg eq "--hipcc_profile") { # Example argument here, hipcc - # - #} if ($arg eq "--hipcc-func-supp") { + print "Warning: The --hipcc-func-supp option has been deprecated and will be removed in the future.\n"; $funcSupp = 1; } elsif ($arg eq "--hipcc-no-func-supp") { + print "Warning: The --hipcc-no-func-supp option has been deprecated and will be removed in the future.\n"; $funcSupp = 0; } } else { From cb084f40729750121a8f1850056b9cfc4f26308b Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 07:45:11 +0530 Subject: [PATCH 27/39] SWDEV-355608 - hipcc: remove -use_fast_math (#2965) It doesn't seem to provide any functionality, probably leftover from some experimental codes. Change-Id: I1720ccf29e057d7f2e18a7dfd1adccd3d51fa80c --- bin/hipcc.pl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index c725318ed9..e6aae1627e 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -358,10 +358,6 @@ foreach $arg (@ARGV) $compileOnly = 1; $buildDeps = 1; } - if($trimarg eq '-use_fast_math') { - $HIPCXXFLAGS .= " -DHIP_FAST_MATH "; - $HIPCFLAGS .= " -DHIP_FAST_MATH "; - } if(($trimarg eq '-use-staticlib') and ($setLinkType eq 0)) { $linkType = 0; From 5e7b7e11a51400f7d336fd8d538902d858dd2af1 Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Tue, 27 Sep 2022 02:16:06 +0000 Subject: [PATCH 28/39] SWDEV-355588 - [hipcc] remove --enable-new-dtags (#2955) Don't pass the --enable-new-dtags flag to clang, just the LLVM's default Change-Id: I2bd06181c490e1c0fec3241a404b546de3ebe970 --- bin/hipcc.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index e6aae1627e..06097fa0cd 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -707,7 +707,7 @@ if ($HIP_PLATFORM eq "amd") { if ($linkType eq 0) { $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L$ROCM_PATH/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs}; } else { - $toolArgs = ${toolArgs} . " -Wl,--enable-new-dtags -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 "; + $toolArgs = ${toolArgs} . " -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 "; } # To support __fp16 and _Float16, explicitly link with compiler-rt $HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a"; From 3a9866730db35e3e3ad0eee62dc69720ccaf0b04 Mon Sep 17 00:00:00 2001 From: Janek van Oirschot <5994977+JanekvO@users.noreply.github.com> Date: Tue, 27 Sep 2022 03:16:29 +0100 Subject: [PATCH 29/39] Prevent chomp return from overriding HIP_CLANG_TARGET triple information (#2958) --- bin/hipcc.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 06097fa0cd..76163d97b6 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -163,7 +163,7 @@ if ($HIP_PLATFORM eq "amd") { # Figure out the target with which llvm is configured $HIP_CLANG_TARGET = `$HIPCC -print-target-triple`; - $HIP_CLANG_TARGET = chomp($HIP_CLANG_TARGET); + chomp($HIP_CLANG_TARGET); if (! defined $HIP_CLANG_INCLUDE_PATH) { $HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include"); From 1f6cb120fe5ba0c8066bd9b2e523cd6088acf2e4 Mon Sep 17 00:00:00 2001 From: Saad Rahim <44449863+saadrahim@users.noreply.github.com> Date: Mon, 26 Sep 2022 20:24:07 -0600 Subject: [PATCH 30/39] Removing outdated API documentation (#2888) --- docs/markdown/CUBLAS_API_supported_by_HIP.md | 538 ------------ docs/markdown/CUDNN_API_supported_by_HIP.md | 586 ------------- docs/markdown/CUFFT_API_supported_by_HIP.md | 81 -- docs/markdown/CURAND_API_supported_by_HIP.md | 172 ---- .../markdown/CUSPARSE_API_supported_by_HIP.md | 797 ------------------ 5 files changed, 2174 deletions(-) delete mode 100644 docs/markdown/CUBLAS_API_supported_by_HIP.md delete mode 100644 docs/markdown/CUDNN_API_supported_by_HIP.md delete mode 100644 docs/markdown/CUFFT_API_supported_by_HIP.md delete mode 100644 docs/markdown/CURAND_API_supported_by_HIP.md delete mode 100644 docs/markdown/CUSPARSE_API_supported_by_HIP.md diff --git a/docs/markdown/CUBLAS_API_supported_by_HIP.md b/docs/markdown/CUBLAS_API_supported_by_HIP.md deleted file mode 100644 index 3aac9f126e..0000000000 --- a/docs/markdown/CUBLAS_API_supported_by_HIP.md +++ /dev/null @@ -1,538 +0,0 @@ -# CUBLAS API supported by HIP - -## **1. CUBLAS Data types** - -| **type** | **CUDA** |**CUDA version\***| **HIP** |**HIP value** (if differs) | -|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|---------------------------| -| define |`CUBLAS_VER_MAJOR` | 10.1 Update 2 | | -| define |`CUBLAS_VER_MINOR` | 10.1 Update 2 | | -| define |`CUBLAS_VER_PATCH` | 10.1 Update 2 | | -| define |`CUBLAS_VER_BUILD` | 10.1 Update 2 | | -| define |`CUBLAS_VERSION` | 10.1 Update 2 | | -| enum |***`cublasStatus`*** | |***`hipblasStatus_t`*** | -| enum |***`cublasStatus_t`*** | |***`hipblasStatus_t`*** | -| 0 |*`CUBLAS_STATUS_SUCCESS`* | |*`HIPBLAS_STATUS_SUCCESS`* | -| 1 |*`CUBLAS_STATUS_NOT_INITIALIZED`* | |*`HIPBLAS_STATUS_NOT_INITIALIZED`* | -| 3 |*`CUBLAS_STATUS_ALLOC_FAILED`* | |*`HIPBLAS_STATUS_ALLOC_FAILED`* | 2 | -| 7 |*`CUBLAS_STATUS_INVALID_VALUE`* | |*`HIPBLAS_STATUS_INVALID_VALUE`* | 3 | -| 8 |*`CUBLAS_STATUS_ARCH_MISMATCH`* | |*`HIPBLAS_STATUS_ARCH_MISMATCH`* | | -| 11 |*`CUBLAS_STATUS_MAPPING_ERROR`* | |*`HIPBLAS_STATUS_MAPPING_ERROR`* | 4 | -| 13 |*`CUBLAS_STATUS_EXECUTION_FAILED`* | |*`HIPBLAS_STATUS_EXECUTION_FAILED`* | 5 | -| 14 |*`CUBLAS_STATUS_INTERNAL_ERROR`* | |*`HIPBLAS_STATUS_INTERNAL_ERROR`* | 6 | -| 15 |*`CUBLAS_STATUS_NOT_SUPPORTED`* | |*`HIPBLAS_STATUS_NOT_SUPPORTED`* | 7 | -| 16 |*`CUBLAS_STATUS_LICENSE_ERROR`* | | | -| enum |***`cublasOperation_t`*** | |***`hipblasOperation_t`*** | -| 0 |*`CUBLAS_OP_N`* | |*`HIPBLAS_OP_N`* | 111 | -| 1 |*`CUBLAS_OP_T`* | |*`HIPBLAS_OP_T`* | 112 | -| 2 |*`CUBLAS_OP_C`* | |*`HIPBLAS_OP_C`* | 113 | -| 2 |*`CUBLAS_OP_HERMITAN`* | 10.1 |*`HIPBLAS_OP_C`* | 113 | -| 3 |*`CUBLAS_OP_CONJG`* | 10.1 | | -| enum |***`cublasFillMode_t`*** | |***`hipblasFillMode_t`*** | -| 0 |*`CUBLAS_FILL_MODE_LOWER`* | |*`HIPBLAS_FILL_MODE_LOWER`* | 121 | -| 1 |*`CUBLAS_FILL_MODE_UPPER`* | |*`HIPBLAS_FILL_MODE_UPPER`* | 122 | -| 2 |*`CUBLAS_FILL_MODE_FULL`* | 10.1 |*`HIPBLAS_FILL_MODE_FULL`* | 123 | -| enum |***`cublasDiagType_t`*** | |***`hipblasDiagType_t`*** | -| 0 |*`CUBLAS_DIAG_NON_UNIT`* | |*`HIPBLAS_DIAG_NON_UNIT`* | 131 | -| 1 |*`CUBLAS_DIAG_UNIT`* | |*`HIPBLAS_DIAG_UNIT`* | 132 | -| enum |***`cublasSideMode_t`*** | |***`hipblasSideMode_t`*** | -| 0 |*`CUBLAS_SIDE_LEFT`* | |*`HIPBLAS_SIDE_LEFT`* | 141 | -| 1 |*`CUBLAS_SIDE_RIGHT`* | |*`HIPBLAS_SIDE_RIGHT`* | 142 | -| enum |***`cublasPointerMode_t`*** | |***`hipblasPointerMode_t`*** | -| 0 |*`CUBLAS_POINTER_MODE_HOST`* | |*`HIPBLAS_POINTER_MODE_HOST`* | -| 1 |*`CUBLAS_POINTER_MODE_DEVICE`* | |*`HIPBLAS_POINTER_MODE_DEVICE`* | -| enum |***`cublasAtomicsMode_t`*** | | | -| 0 |*`CUBLAS_ATOMICS_NOT_ALLOWED`* | | | -| 1 |*`CUBLAS_ATOMICS_ALLOWED`* | | | -| enum |***`cublasGemmAlgo_t`*** | 8.0 |***`hipblasGemmAlgo_t`*** | -| -1 |*`CUBLAS_GEMM_DFALT`* | 8.0 |*`HIPBLAS_GEMM_DEFAULT`* | 160 | -| -1 |*`CUBLAS_GEMM_DEFAULT`* | 8.0 |*`HIPBLAS_GEMM_DEFAULT`* | 160 | -| 0 |*`CUBLAS_GEMM_ALGO0`* | 8.0 | | -| 1 |*`CUBLAS_GEMM_ALGO1`* | 8.0 | | -| 2 |*`CUBLAS_GEMM_ALGO2`* | 8.0 | | -| 3 |*`CUBLAS_GEMM_ALGO3`* | 8.0 | | -| 4 |*`CUBLAS_GEMM_ALGO4`* | 8.0 | | -| 5 |*`CUBLAS_GEMM_ALGO5`* | 8.0 | | -| 6 |*`CUBLAS_GEMM_ALGO6`* | 8.0 | | -| 7 |*`CUBLAS_GEMM_ALGO7`* | 8.0 | | -| 8 |*`CUBLAS_GEMM_ALGO8`* | 9.0 | | -| 9 |*`CUBLAS_GEMM_ALGO9`* | 9.0 | | -| 10 |*`CUBLAS_GEMM_ALGO10`* | 9.0 | | -| 11 |*`CUBLAS_GEMM_ALGO11`* | 9.0 | | -| 12 |*`CUBLAS_GEMM_ALGO12`* | 9.0 | | -| 13 |*`CUBLAS_GEMM_ALGO13`* | 9.0 | | -| 14 |*`CUBLAS_GEMM_ALGO14`* | 9.0 | | -| 15 |*`CUBLAS_GEMM_ALGO15`* | 9.0 | | -| 16 |*`CUBLAS_GEMM_ALGO16`* | 9.0 | | -| 17 |*`CUBLAS_GEMM_ALGO17`* | 9.0 | | -| 18 |*`CUBLAS_GEMM_ALGO18`* | 9.2 | | -| 19 |*`CUBLAS_GEMM_ALGO19`* | 9.2 | | -| 20 |*`CUBLAS_GEMM_ALGO20`* | 9.2 | | -| 21 |*`CUBLAS_GEMM_ALGO21`* | 9.2 | | -| 22 |*`CUBLAS_GEMM_ALGO22`* | 9.2 | | -| 23 |*`CUBLAS_GEMM_ALGO23`* | 9.2 | | -| 99 |*`CUBLAS_GEMM_DEFAULT_TENSOR_OP`* | 9.0 | | -| 99 |*`CUBLAS_GEMM_DFALT_TENSOR_OP`* | 9.0 | | -| 100 |*`CUBLAS_GEMM_ALGO0_TENSOR_OP`* | 9.0 | | -| 101 |*`CUBLAS_GEMM_ALGO1_TENSOR_OP`* | 9.0 | | -| 102 |*`CUBLAS_GEMM_ALGO2_TENSOR_OP`* | 9.0 | | -| 103 |*`CUBLAS_GEMM_ALGO3_TENSOR_OP`* | 9.0 | | -| 104 |*`CUBLAS_GEMM_ALGO4_TENSOR_OP`* | 9.0 | | -| 105 |*`CUBLAS_GEMM_ALGO5_TENSOR_OP`* | 9.2 | | -| 106 |*`CUBLAS_GEMM_ALGO6_TENSOR_OP`* | 9.2 | | -| 107 |*`CUBLAS_GEMM_ALGO7_TENSOR_OP`* | 9.2 | | -| 108 |*`CUBLAS_GEMM_ALGO8_TENSOR_OP`* | 9.2 | | -| 109 |*`CUBLAS_GEMM_ALGO9_TENSOR_OP`* | 9.2 | | -| 110 |*`CUBLAS_GEMM_ALGO10_TENSOR_OP`* | 9.2 | | -| 111 |*`CUBLAS_GEMM_ALGO11_TENSOR_OP`* | 9.2 | | -| 112 |*`CUBLAS_GEMM_ALGO12_TENSOR_OP`* | 9.2 | | -| 113 |*`CUBLAS_GEMM_ALGO13_TENSOR_OP`* | 9.2 | | -| 114 |*`CUBLAS_GEMM_ALGO14_TENSOR_OP`* | 9.2 | | -| 115 |*`CUBLAS_GEMM_ALGO15_TENSOR_OP`* | 9.2 | | -| enum |***`cublasMath_t`*** | 9.0 | | -| 0 |*`CUBLAS_DEFAULT_MATH`* | 9.0 | | -| 1 |*`CUBLAS_TENSOR_OP_MATH`* | 9.0 | | -| enum* |`cublasDataType_t` | 7.5 | | -| struct |`cublasContext` | | | -| struct* |`cublasHandle_t` | |`hipblasHandle_t` | - -## **2. CUBLAS API functions** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cublasCreate` |`hipblasCreate` | -|`cublasCreate_v2` |`hipblasCreate` | -|`cublasDestroy` |`hipblasDestroy` | -|`cublasDestroy_v2` |`hipblasDestroy` | -|`cublasGetVersion` | | -|`cublasGetVersion_v2` | | -|`cublasGetProperty` | | 8.0 | -|`cublasGetCudartVersion` | | 10.1 | -|`cublasGetStream` |`hipblasGetStream` | -|`cublasGetStream_v2` |`hipblasGetStream` | -|`cublasSetStream` |`hipblasSetStream` | -|`cublasSetStream_v2` |`hipblasSetStream` | -|`cublasGetPointerMode` |`hipblasGetPointerMode` | -|`cublasGetPointerMode_v2` |`hipblasGetPointerMode` | -|`cublasSetPointerMode` |`hipblasSetPointerMode` | -|`cublasSetPointerMode_v2` |`hipblasSetPointerMode` | -|`cublasGetAtomicsMode` | | -|`cublasSetAtomicsMode` | | -|`cublasGetMathMode` | | 9.0 | -|`cublasSetMathMode` | | 9.0 | -|`cublasLogCallback` | | 9.2 | -|`cublasLoggerConfigure` | | 9.2 | -|`cublasSetLoggerCallback` | | 9.2 | -|`cublasGetLoggerCallback` | | 9.2 | -|`cublasSetVector` |`hipblasSetVector` | -|`cublasGetVector` |`hipblasGetVector` | -|`cublasSetMatrix` |`hipblasSetMatrix` | -|`cublasGetMatrix` |`hipblasGetMatrix` | -|`cublasSetVectorAsync` | | -|`cublasGetVectorAsync` | | -|`cublasSetMatrixAsync` | | -|`cublasGetMatrixAsync` | | -|`cublasXerbla` | | -|`cublasNrm2Ex` | | 8.0 | -|`cublasSnrm2` |`hipblasSnrm2` | -|`cublasSnrm2_v2` |`hipblasSnrm2` | -|`cublasDnrm2` |`hipblasDnrm2` | -|`cublasDnrm2_v2` |`hipblasDnrm2` | -|`cublasScnrm2` |`hipblasScnrm2` | -|`cublasScnrm2_v2` |`hipblasScnrm2` | -|`cublasDznrm2` |`hipblasDznrm2` | -|`cublasDznrm2_v2` |`hipblasDznrm2` | -|`cublasDotEx` | | 8.0 | -|`cublasDotcEx` | | 8.0 | -|`cublasSdot` |`hipblasSdot` | -|`cublasSdot_v2` |`hipblasSdot` | -|`cublasDdot` |`hipblasDdot` | -|`cublasDdot_v2` |`hipblasDdot` | -|`cublasCdotu` |`hipblasCdotu` | -|`cublasCdotu_v2` |`hipblasCdotu` | -|`cublasCdotc` |`hipblasCdotc` | -|`cublasCdotc_v2` |`hipblasCdotc` | -|`cublasZdotu` |`hipblasZdotu` | -|`cublasZdotu_v2` |`hipblasZdotu` | -|`cublasZdotc` |`hipblasZdotc` | -|`cublasZdotc_v2` |`hipblasZdotc` | -|`cublasScalEx` | | 8.0 | -|`cublasSscal` |`hipblasSscal` | -|`cublasSscal_v2` |`hipblasSscal` | -|`cublasDscal` |`hipblasDscal` | -|`cublasDscal_v2` |`hipblasDscal` | -|`cublasCscal` |`hipblasCscal` | -|`cublasCscal_v2` |`hipblasCscal` | -|`cublasCsscal` |`hipblasCsscal` | -|`cublasCsscal_v2` |`hipblasCsscal` | -|`cublasZscal` |`hipblasZscal` | -|`cublasZscal_v2` |`hipblasZscal` | -|`cublasZdscal` |`hipblasZdscal` | -|`cublasZdscal_v2` |`hipblasZdscal` | -|`cublasAxpyEx` | | 8.0 | -|`cublasSaxpy` |`hipblasSaxpy` | -|`cublasSaxpy_v2` |`hipblasSaxpy` | -|`cublasDaxpy` |`hipblasDaxpy` | -|`cublasDaxpy_v2` |`hipblasDaxpy` | -|`cublasCaxpy` |`hipblasCaxpy` | -|`cublasCaxpy_v2` |`hipblasCaxpy` | -|`cublasZaxpy` |`hipblasZaxpy` | -|`cublasZaxpy_v2` |`hipblasZaxpy` | -|`cublasScopy` |`hipblasScopy` | -|`cublasScopy_v2` |`hipblasScopy` | -|`cublasDcopy` |`hipblasDcopy` | -|`cublasDcopy_v2` |`hipblasDcopy` | -|`cublasCcopy` |`hipblasCcopy` | -|`cublasCopyEx` | | 10.1 | -|`cublasCcopy_v2` |`hipblasCcopy` | -|`cublasZcopy` |`hipblasZcopy` | -|`cublasZcopy_v2` |`hipblasZcopy` | -|`cublasSswap` |`hipblasSswap` | -|`cublasSswap_v2` |`hipblasSswap` | -|`cublasDswap` |`hipblasDswap` | -|`cublasDswap_v2` |`hipblasDswap` | -|`cublasCswap` |`hipblasCswap` | -|`cublasCswap_v2` |`hipblasCswap` | -|`cublasZswap` |`hipblasZswap` | -|`cublasZswap_v2` |`hipblasZswap` | -|`cublasIamaxEx` | | 10.1 | -|`cublasIsamax` |`hipblasIsamax` | -|`cublasIsamax_v2` |`hipblasIsamax` | -|`cublasIdamax` |`hipblasIdamax` | -|`cublasIdamax_v2` |`hipblasIdamax` | -|`cublasIcamax` |`hipblasIcamax` | -|`cublasIcamax_v2` |`hipblasIcamax` | -|`cublasIzamax` |`hipblasIzamax` | -|`cublasIzamax_v2` |`hipblasIzamax` | -|`cublasIaminEx` | | 10.1 | -|`cublasIsamin` |`hipblasIsamin` | -|`cublasIsamin_v2` |`hipblasIsamin` | -|`cublasIdamin` |`hipblasIdamin` | -|`cublasIdamin_v2` |`hipblasIdamin` | -|`cublasIcamin` |`hipblasIcamin` | -|`cublasIcamin_v2` |`hipblasIcamin` | -|`cublasIzamin` |`hipblasIzamin` | -|`cublasIzamin_v2` |`hipblasIzamin` | -|`cublasAsumEx` | | 10.1 | -|`cublasSasum` |`hipblasSasum` | -|`cublasSasum_v2` |`hipblasSasum` | -|`cublasDasum` |`hipblasDasum` | -|`cublasDasum_v2` |`hipblasDasum` | -|`cublasScasum` |`hipblasScasum` | -|`cublasScasum_v2` |`hipblasScasum` | -|`cublasDzasum` |`hipblasDzasum` | -|`cublasDzasum_v2` |`hipblasDzasum` | -|`cublasRotEx` | | 10.1 | -|`cublasSrot` |`hipblasSrot` | -|`cublasSrot_v2` |`hipblasSrot` | -|`cublasDrot` |`hipblasDrot` | -|`cublasDrot_v2` |`hipblasDrot` | -|`cublasCrot` |`hipblasCrot` | -|`cublasCrot_v2` |`hipblasCrot` | -|`cublasCsrot` |`hipblasCsrot` | -|`cublasCsrot_v2` |`hipblasCsrot` | -|`cublasZrot` |`hipblasZrot` | -|`cublasZrot_v2` |`hipblasZrot` | -|`cublasRotgEx` | | 10.1 | -|`cublasZdrot` |`hipblasZdrot` | -|`cublasZdrot_v2` |`hipblasZdrot` | -|`cublasSrotg` |`hipblasSrotg` | -|`cublasSrotg_v2` |`hipblasSrotg` | -|`cublasDrotg` |`hipblasDrotg` | -|`cublasDrotg_v2` |`hipblasDrotg` | -|`cublasCrotg` |`hipblasCrotg` | -|`cublasCrotg_v2` |`hipblasCrotg` | -|`cublasZrotg` |`hipblasZrotg` | -|`cublasZrotg_v2` |`hipblasZrotg` | -|`cublasRotmEx` | | 10.1 | -|`cublasSrotm` |`hipblasSrotm` | -|`cublasSrotm_v2` |`hipblasSrotm` | -|`cublasDrotm` |`hipblasDrotm` | -|`cublasDrotm_v2` |`hipblasDrotm` | -|`cublasRotmgEx` | | 10.1 | -|`cublasSrotmg` |`hipblasSrotmg` | -|`cublasSrotmg_v2` |`hipblasSrotmg` | -|`cublasDrotmg` |`hipblasDrotmg` | -|`cublasDrotmg_v2` |`hipblasDrotmg` | -|`cublasSgemv` |`hipblasSgemv` | -|`cublasSgemv_v2` |`hipblasSgemv` | -|`cublasSgemvBatched` |`hipblasSgemvBatched` | -|`cublasDgemv` |`hipblasDgemv` | -|`cublasDgemv_v2` |`hipblasDgemv` | -|`cublasCgemv` |`hipblasCgemv` | -|`cublasCgemv_v2` |`hipblasCgemv` | -|`cublasZgemv` |`hipblasZgemv` | -|`cublasZgemv_v2` |`hipblasZgemv` | -|`cublasSgbmv` | | -|`cublasSgbmv_v2` | | -|`cublasDgbmv` | | -|`cublasDgbmv_v2` | | -|`cublasCgbmv` | | -|`cublasCgbmv_v2` | | -|`cublasZgbmv` | | -|`cublasZgbmv_v2` | | -|`cublasStrmv` | | -|`cublasStrmv_v2` | | -|`cublasDtrmv` | | -|`cublasDtrmv_v2` | | -|`cublasCtrmv` | | -|`cublasCtrmv_v2` | | -|`cublasZtrmv` | | -|`cublasZtrmv_v2` | | -|`cublasStbmv` | | -|`cublasStbmv_v2` | | -|`cublasDtbmv` | | -|`cublasDtbmv_v2` | | -|`cublasCtbmv` | | -|`cublasCtbmv_v2` | | -|`cublasZtbmv` | | -|`cublasZtbmv_v2` | | -|`cublasStpmv` | | -|`cublasStpmv_v2` | | -|`cublasDtpmv` | | -|`cublasDtpmv_v2` | | -|`cublasCtpmv` | | -|`cublasCtpmv_v2` | | -|`cublasZtpmv` | | -|`cublasZtpmv_v2` | | -|`cublasStrsv` |`hipblasStrsv` | -|`cublasStrsv_v2` |`hipblasStrsv` | -|`cublasDtrsv` |`hipblasDtrsv` | -|`cublasDtrsv_v2` |`hipblasDtrsv` | -|`cublasCtrsv` | | -|`cublasCtrsv_v2` | | -|`cublasZtrsv` | | -|`cublasZtrsv_v2` | | -|`cublasStpsv` | | -|`cublasStpsv_v2` | | -|`cublasDtpsv` | | -|`cublasDtpsv_v2` | | -|`cublasCtpsv` | | -|`cublasCtpsv_v2` | | -|`cublasZtpsv` | | -|`cublasZtpsv_v2` | | -|`cublasStbsv` | | -|`cublasStbsv_v2` | | -|`cublasDtbsv` | | -|`cublasDtbsv_v2` | | -|`cublasCtbsv` | | -|`cublasCtbsv_v2` | | -|`cublasZtbsv` | | -|`cublasZtbsv_v2` | | -|`cublasSsymv` | | -|`cublasSsymv_v2` | | -|`cublasDsymv` | | -|`cublasDsymv_v2` | | -|`cublasCsymv` | | -|`cublasCsymv_v2` | | -|`cublasZsymv` | | -|`cublasZsymv_v2` | | -|`cublasChemv` | | -|`cublasChemv_v2` | | -|`cublasZhemv` | | -|`cublasZhemv_v2` | | -|`cublasSsbmv` | | -|`cublasSsbmv_v2` | | -|`cublasDsbmv` | | -|`cublasDsbmv_v2` | | -|`cublasChbmv` | | -|`cublasChbmv_v2` | | -|`cublasZhbmv` | | -|`cublasZhbmv_v2` | | -|`cublasSspmv` | | -|`cublasSspmv_v2` | | -|`cublasDspmv` | | -|`cublasDspmv_v2` | | -|`cublasChpmv` | | -|`cublasChpmv_v2` | | -|`cublasZhpmv` | | -|`cublasZhpmv_v2` | | -|`cublasSger` |`hipblasSger` | -|`cublasSger_v2` |`hipblasSger` | -|`cublasDger` |`hipblasDger` | -|`cublasDger_v2` |`hipblasDger` | -|`cublasCgeru` | | -|`cublasCgeru_v2` | | -|`cublasCgerc` | | -|`cublasCgerc_v2` | | -|`cublasZgeru` | | -|`cublasZgeru_v2` | | -|`cublasZgerc` | | -|`cublasZgerc_v2` | | -|`cublasSsyr` |`hipblasSsyr` | -|`cublasSsyr_v2` |`hipblasSsyr` | -|`cublasDsyr` |`hipblasDsyr` | -|`cublasDsyr_v2` |`hipblasDsyr` | -|`cublasCsyr` | | -|`cublasCsyr_v2` | | -|`cublasZsyr` | | -|`cublasZsyr_v2` | | -|`cublasCher` | | -|`cublasCher_v2` | | -|`cublasZher` | | -|`cublasZher_v2` | | -|`cublasSspr` | | -|`cublasSspr_v2` | | -|`cublasDspr` | | -|`cublasDspr_v2` | | -|`cublasChpr` | | -|`cublasChpr_v2` | | -|`cublasZhpr` | | -|`cublasZhpr_v2` | | -|`cublasSsyr2` | | -|`cublasSsyr2_v2` | | -|`cublasDsyr2` | | -|`cublasDsyr2_v2` | | -|`cublasCsyr2` | | -|`cublasCsyr2_v2` | | -|`cublasZsyr2` | | -|`cublasZsyr2_v2` | | -|`cublasCher2` | | -|`cublasCher2_v2` | | -|`cublasZher2` | | -|`cublasZher2_v2` | | -|`cublasSspr2` | | -|`cublasSspr2_v2` | | -|`cublasDspr2` | | -|`cublasDspr2_v2` | | -|`cublasChpr2` | | -|`cublasChpr2_v2` | | -|`cublasZhpr2` | | -|`cublasZhpr2_v2` | | -|`cublasSgemm` |`hipblasSgemm` | -|`cublasSgemm_v2` |`hipblasSgemm` | -|`cublasDgemm` |`hipblasDgemm` | -|`cublasDgemm_v2` |`hipblasDgemm` | -|`cublasCgemm` | | -|`cublasCgemm_v2` | | -|`cublasCgemm3m` | | 8.0 | -|`cublasCgemm3mEx` | | 8.0 | -|`cublasZgemm` |`hipblasZgemm` | -|`cublasZgemm_v2` |`hipblasZgemm` | -|`cublasZgemm3m` | | 8.0 | -|`cublasHgemm` |`hipblasHgemm` | 7.5 | -|`cublasSgemmEx` | | 7.5 | -|`cublasGemmEx` |`hipblasGemmEx` | 8.0 | -|`cublasCgemmEx` | | 8.0 | -|`cublasUint8gemmBias` | | 8.0 | -|`cublasSsyrk` | | -|`cublasSsyrk_v2` | | -|`cublasDsyrk` | | -|`cublasDsyrk_v2` | | -|`cublasCsyrk` | | -|`cublasCsyrk_v2` | | -|`cublasZsyrk` | | -|`cublasZsyrk_v2` | | -|`cublasCsyrkEx` | | 8.0 | -|`cublasCsyrk3mEx` | | 8.0 | -|`cublasCherk` | | -|`cublasCherk_v2` | | -|`cublasZherk` | | -|`cublasZherk_v2` | | -|`cublasCherkEx` | | 8.0 | -|`cublasCherk3mEx` | | 8.0 | -|`cublasSsyr2k` | | -|`cublasSsyr2k_v2` | | -|`cublasDsyr2k` | | -|`cublasDsyr2k_v2` | | -|`cublasCsyr2k` | | -|`cublasCsyr2k_v2` | | -|`cublasZsyr2k` | | -|`cublasZsyr2k_v2` | | -|`cublasCher2k` | | -|`cublasCher2k_v2` | | -|`cublasZher2k` | | -|`cublasZher2k_v2` | | -|`cublasSsyrkx` | | -|`cublasDsyrkx` | | -|`cublasCsyrkx` | | -|`cublasZsyrkx` | | -|`cublasCherkx` | | -|`cublasZherkx` | | -|`cublasSsymm` | | -|`cublasSsymm_v2` | | -|`cublasDsymm` | | -|`cublasDsymm_v2` | | -|`cublasCsymm` | | -|`cublasCsymm_v2` | | -|`cublasZsymm` | | -|`cublasZsymm_v2` | | -|`cublasChemm` | | -|`cublasChemm_v2` | | -|`cublasZhemm` | | -|`cublasZhemm_v2` | | -|`cublasStrsm` |`hipblasStrsm` | -|`cublasStrsm_v2` |`hipblasStrsm` | -|`cublasDtrsm` |`hipblasDtrsm` | -|`cublasDtrsm_v2` |`hipblasDtrsm` | -|`cublasCtrsm` | | -|`cublasCtrsm_v2` | | -|`cublasZtrsm` | | -|`cublasZtrsm_v2` | | -|`cublasStrmm` | | -|`cublasStrmm_v2` | | -|`cublasDtrmm` | | -|`cublasDtrmm_v2` | | -|`cublasCtrmm` | | -|`cublasCtrmm_v2` | | -|`cublasZtrmm` | | -|`cublasZtrmm_v2` | | -|`cublasHgemmBatched` |`hipblasHgemmBatched` | 9.0 | -|`cublasSgemmBatched` |`hipblasSgemmBatched` | -|`cublasDgemmBatched` |`hipblasDgemmBatched` | -|`cublasCgemmBatched` |`hipblasCgemmBatched` | -|`cublasCgemm3mBatched` | | 8.0 | -|`cublasZgemmBatched` |`hipblasZgemmBatched` | -|`cublasGemmBatchedEx` | | 9.1 | -|`cublasGemmStridedBatchedEx` | | 9.1 | -|`cublasSgemmStridedBatched` |`hipblasSgemmStridedBatched` | 8.0 | -|`cublasDgemmStridedBatched` |`hipblasDgemmStridedBatched` | 8.0 | -|`cublasCgemmStridedBatched` |`hipblasCgemmStridedBatched` | 8.0 | -|`cublasCgemm3mStridedBatched` | | 8.0 | -|`cublasZgemmStridedBatched` |`hipblasZgemmStridedBatched` | 8.0 | -|`cublasHgemmStridedBatched` |`hipblasHgemmStridedBatched` | 8.0 | -|`cublasSgeam` |`hipblasSgeam` | -|`cublasDgeam` |`hipblasDgeam` | -|`cublasCgeam` | | -|`cublasZgeam` | | -|`cublasSgetrfBatched` | | -|`cublasDgetrfBatched` | | -|`cublasCgetrfBatched` | | -|`cublasZgetrfBatched` | | -|`cublasSgetriBatched` | | -|`cublasDgetriBatched` | | -|`cublasCgetriBatched` | | -|`cublasZgetriBatched` | | -|`cublasSgetrsBatched` | | -|`cublasDgetrsBatched` | | -|`cublasCgetrsBatched` | | -|`cublasZgetrsBatched` | | -|`cublasStrsmBatched` | | -|`cublasDtrsmBatched` | | -|`cublasCtrsmBatched` | | -|`cublasZtrsmBatched` | | -|`cublasSmatinvBatched` | | -|`cublasDmatinvBatched` | | -|`cublasCmatinvBatched` | | -|`cublasZmatinvBatched` | | -|`cublasSgeqrfBatched` | | -|`cublasDgeqrfBatched` | | -|`cublasCgeqrfBatched` | | -|`cublasZgeqrfBatched` | | -|`cublasSgelsBatched` | | -|`cublasDgelsBatched` | | -|`cublasCgelsBatched` | | -|`cublasZgelsBatched` | | -|`cublasSdgmm` | | -|`cublasDdgmm` | | -|`cublasCdgmm` | | -|`cublasZdgmm` | | -|`cublasStpttr` | | -|`cublasDtpttr` | | -|`cublasCtpttr` | | -|`cublasZtpttr` | | -|`cublasStrttp` | | -|`cublasDtrttp` | | -|`cublasCtrttp` | | -|`cublasZtrttp` | | - -\* CUDA version, in which API has appeared and (optional) last version before abandoning it; no value in case of earlier versions < 7.5. diff --git a/docs/markdown/CUDNN_API_supported_by_HIP.md b/docs/markdown/CUDNN_API_supported_by_HIP.md deleted file mode 100644 index 7efa922a21..0000000000 --- a/docs/markdown/CUDNN_API_supported_by_HIP.md +++ /dev/null @@ -1,586 +0,0 @@ -# CUDNN API supported by HIP - -## **1. CUDNN Data types** - -| **type** | **CUDA** |**CUDA version\***| **HIP** |**HIP value** (if differs) | -|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|---------------------------| -| define |`CUDNN_VERSION` | |`HIPDNN_VERSION` | -| struct |`cudnnContext` | | | -| struct* |`cudnnHandle_t` | |`hipdnnHandle_t` | -| enum |***`cudnnStatus_t`*** | |***`hipdnnStatus_t`*** | -| 0 |*`CUDNN_STATUS_SUCCESS`* | |*`HIPDNN_STATUS_SUCCESS`* | -| 1 |*`CUDNN_STATUS_NOT_INITIALIZED`* | |*`HIPDNN_STATUS_NOT_INITIALIZED`* | -| 2 |*`CUDNN_STATUS_ALLOC_FAILED`* | |*`HIPDNN_STATUS_ALLOC_FAILED`* | -| 3 |*`CUDNN_STATUS_BAD_PARAM`* | |*`HIPDNN_STATUS_BAD_PARAM`* | -| 4 |*`CUDNN_STATUS_INTERNAL_ERROR`* | |*`HIPDNN_STATUS_INTERNAL_ERROR`* | -| 5 |*`CUDNN_STATUS_INVALID_VALUE`* | |*`HIPDNN_STATUS_INVALID_VALUE`* | -| 6 |*`CUDNN_STATUS_ARCH_MISMATCH`* | |*`HIPDNN_STATUS_ARCH_MISMATCH`* | -| 7 |*`CUDNN_STATUS_MAPPING_ERROR`* | |*`HIPDNN_STATUS_MAPPING_ERROR`* | -| 8 |*`CUDNN_STATUS_EXECUTION_FAILED`* | |*`HIPDNN_STATUS_EXECUTION_FAILED`* | -| 9 |*`CUDNN_STATUS_NOT_SUPPORTED`* | |*`HIPDNN_STATUS_NOT_SUPPORTED`* | -| 10 |*`CUDNN_STATUS_LICENSE_ERROR`* | |*`HIPDNN_STATUS_LICENSE_ERROR`* | -| 11 |*`CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING`* | 7.5 |*`HIPDNN_STATUS_RUNTIME_PREREQUISITE_MISSING`* | -| 12 |*`CUDNN_STATUS_RUNTIME_IN_PROGRESS`* | 8.0 | | -| 13 |*`CUDNN_STATUS_RUNTIME_FP_OVERFLOW`* | 8.0 | | -| struct |`cudnnRuntimeTag_t` | 8.0 | | -| enum |***`cudnnErrQueryMode_t`*** | 8.0 | | -| 0 |*`CUDNN_ERRQUERY_RAWCODE`* | 8.0 | | -| 1 |*`CUDNN_ERRQUERY_NONBLOCKING`* | 8.0 | | -| 2 |*`CUDNN_ERRQUERY_BLOCKING`* | 8.0 | | -| struct |`cudnnTensorStruct` | | | -| struct* |`cudnnTensorDescriptor_t` | |`hipdnnTensorDescriptor_t` | -| struct |`cudnnConvolutionStruct` | | | -| struct* |`cudnnConvolutionDescriptor_t` | |`hipdnnConvolutionDescriptor_t` | -| struct |`cudnnPoolingStruct` | | | -| struct* |`cudnnPoolingDescriptor_t` | |`hipdnnPoolingDescriptor_t` | -| struct |`cudnnFilterStruct` | | | -| struct* |`cudnnFilterDescriptor_t` | |`hipdnnFilterDescriptor_t` | -| struct |`cudnnLRNStruct` | | | -| struct* |`cudnnLRNDescriptor_t` | |`hipdnnLRNDescriptor_t` | -| struct |`cudnnActivationStruct` | | | -| struct* |`cudnnActivationDescriptor_t` | |`hipdnnActivationDescriptor_t` | -| struct |`cudnnSpatialTransformerStruct` | 7.5 | | -| struct* |`cudnnSpatialTransformerDescriptor_t` | 7.5 | | -| struct |`cudnnOpTensorStruct` | 7.5 | | -| struct* |`cudnnOpTensorDescriptor_t` | 7.5 |`hipdnnOpTensorDescriptor_t` | -| struct |`cudnnReduceTensorStruct` | 7.5 | | -| struct* |`cudnnReduceTensorDescriptor_t` | 7.5 |`hipdnnReduceTensorDescriptor_t` | -| struct |`cudnnCTCLossStruct` | 8.0 | | -| struct* |`cudnnCTCLossDescriptor_t` | 8.0 | | -| struct |`cudnnTensorTransformStruct` | 9.0 | | -| struct* |`cudnnTensorTransformDescriptor_t` | 9.0 | | -| enum |***`cudnnDataType_t`*** | |***`hipdnnDataType_t`*** | -| 0 |*`CUDNN_DATA_FLOAT`* | |*`HIPDNN_DATA_FLOAT`* | -| 1 |*`CUDNN_DATA_DOUBLE`* | |*`HIPDNN_DATA_DOUBLE`* | -| 2 |*`CUDNN_DATA_HALF`* | |*`HIPDNN_DATA_HALF`* | -| 3 |*`CUDNN_DATA_INT8`* | 7.5 |*`HIPDNN_DATA_INT8`* | -| 4 |*`CUDNN_DATA_INT32`* | 7.5 |*`HIPDNN_DATA_INT32`* | -| 5 |*`CUDNN_DATA_INT8x4`* | 7.5 |*`HIPDNN_DATA_INT8x4`* | -| 6 |*`CUDNN_DATA_UINT8`* | 8.0 | | -| 7 |*`CUDNN_DATA_UINT8x4`* | 8.0 | | -| 8 |*`CUDNN_DATA_INT8x32`* | 9.0 | | -| enum |***`cudnnMathType_t`*** | 8.0 |***`hipdnnMathType_t`*** | -| 0 |*`CUDNN_DEFAULT_MATH`* | 8.0 |*`HIPDNN_DEFAULT_MATH`* | -| 1 |*`CUDNN_TENSOR_OP_MATH`* | 8.0 |*`HIPDNN_TENSOR_OP_MATH`* | -| enum |***`cudnnNanPropagation_t`*** | |***`hipdnnNanPropagation_t`*** | -| 0 |*`CUDNN_NOT_PROPAGATE_NAN`* | |*`HIPDNN_NOT_PROPAGATE_NAN`* | -| 1 |*`CUDNN_PROPAGATE_NAN`* | |*`HIPDNN_PROPAGATE_NAN`* | -| enum |***`cudnnDeterminism_t`*** | 7.5 | | -| 0 |*`CUDNN_NON_DETERMINISTIC`* | 7.5 | | -| 1 |*`CUDNN_DETERMINISTIC`* | 7.5 | | -| define |`CUDNN_DIM_MAX` | | | -| enum |***`cudnnTensorFormat_t`*** | |***`hipdnnTensorFormat_t`*** | -| 0 |*`CUDNN_TENSOR_NCHW`* | |*`HIPDNN_TENSOR_NCHW`* | -| 1 |*`CUDNN_TENSOR_NHWC`* | |*`HIPDNN_TENSOR_NHWC`* | -| 2 |*`CUDNN_TENSOR_NCHW_VECT_C`* | 7.5 |*`HIPDNN_TENSOR_NCHW_VECT_C`* | -| enum |***`cudnnFoldingDirection_t`*** | 9.0 | | -| 0 |*`CUDNN_TRANSFORM_FOLD`* | 9.0 | | -| 1 |*`CUDNN_TRANSFORM_UNFOLD`* | 9.0 | | -| enum |***`cudnnOpTensorOp_t`*** | 7.5 |***`hipdnnOpTensorOp_t`*** | -| 0 |*`CUDNN_OP_TENSOR_ADD`* | 7.5 |*`HIPDNN_OP_TENSOR_ADD`* | -| 1 |*`CUDNN_OP_TENSOR_MUL`* | 7.5 |*`HIPDNN_OP_TENSOR_MUL`* | -| 2 |*`CUDNN_OP_TENSOR_MIN`* | 7.5 |*`HIPDNN_OP_TENSOR_MIN`* | -| 3 |*`CUDNN_OP_TENSOR_MAX`* | 7.5 |*`HIPDNN_OP_TENSOR_MAX`* | -| 4 |*`CUDNN_OP_TENSOR_SQRT`* | 7.5 |*`HIPDNN_OP_TENSOR_SQRT`* | -| 5 |*`CUDNN_OP_TENSOR_NOT`* | 8.0 |*`HIPDNN_OP_TENSOR_NOT`* | -| enum |***`cudnnReduceTensorOp_t`*** | 7.5 |***`hipdnnReduceTensorOp_t`*** | -| 0 |*`CUDNN_REDUCE_TENSOR_ADD`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_ADD`* | -| 1 |*`CUDNN_REDUCE_TENSOR_MUL`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_MUL`* | -| 2 |*`CUDNN_REDUCE_TENSOR_MIN`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_MIN`* | -| 3 |*`CUDNN_REDUCE_TENSOR_MAX`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_MAX`* | -| 4 |*`CUDNN_REDUCE_TENSOR_AMAX`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_AMAX`* | -| 5 |*`CUDNN_REDUCE_TENSOR_AVG`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_AVG`* | -| 6 |*`CUDNN_REDUCE_TENSOR_NORM1`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_NORM1`* | -| 7 |*`CUDNN_REDUCE_TENSOR_NORM2`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_NORM2`* | -| 8 |*`CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS`* | 8.0 |*`HIPDNN_REDUCE_TENSOR_MUL_NO_ZEROS`* | -| enum |***`cudnnReduceTensorIndices_t`*** | 7.5 |***`hipdnnReduceTensorIndices_t`*** | -| 0 |*`CUDNN_REDUCE_TENSOR_NO_INDICES`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_NO_INDICES`* | -| 1 |*`CUDNN_REDUCE_TENSOR_FLATTENED_INDICES`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_FLATTENED_INDICES`* | -| enum |***`cudnnIndicesType_t`*** | 7.5 |***`hipdnnIndicesType_t`*** | -| 0 |*`CUDNN_32BIT_INDICES`* | 7.5 |*`HIPDNN_32BIT_INDICES`* | -| 1 |*`CUDNN_64BIT_INDICES`* | 7.5 |*`HIPDNN_64BIT_INDICES`* | -| 2 |*`CUDNN_16BIT_INDICES`* | 7.5 |*`HIPDNN_16BIT_INDICES`* | -| 3 |*`CUDNN_8BIT_INDICES`* | 7.5 |*`HIPDNN_8BIT_INDICES`* | -| enum |***`cudnnConvolutionMode_t`*** | |***`hipdnnConvolutionMode_t`*** | -| 0 |*`CUDNN_CONVOLUTION`* | |*`HIPDNN_CONVOLUTION`* | -| 1 |*`CUDNN_CROSS_CORRELATION`* | |*`HIPDNN_CROSS_CORRELATION`* | -| enum |***`cudnnConvolutionFwdPreference_t`*** | |***`hipdnnConvolutionFwdPreference_t`*** | -| 0 |*`CUDNN_CONVOLUTION_FWD_NO_WORKSPACE`* | |*`HIPDNN_CONVOLUTION_FWD_NO_WORKSPACE`* | -| 1 |*`CUDNN_CONVOLUTION_FWD_PREFER_FASTEST`* | |*`HIPDNN_CONVOLUTION_FWD_PREFER_FASTEST`* | -| 2 |*`CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT`* | |*`HIPDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT`* | -| enum |***`cudnnConvolutionFwdAlgo_t`*** | |***`hipdnnConvolutionFwdAlgo_t`*** | -| 0 |*`CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM`* | -| 1 |*`CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM`* | -| 2 |*`CUDNN_CONVOLUTION_FWD_ALGO_GEMM`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_GEMM`* | -| 3 |*`CUDNN_CONVOLUTION_FWD_ALGO_DIRECT`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_DIRECT`* | -| 4 |*`CUDNN_CONVOLUTION_FWD_ALGO_FFT`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_FFT`* | -| 5 |*`CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_FFT_TILING`* | -| 6 |*`CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD`* | 7.5 |*`HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD`* | -| 7 |*`CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED`* | 7.5 |*`HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED`* | -| 8 |*`CUDNN_CONVOLUTION_FWD_ALGO_COUNT`* | 7.5 |*`HIPDNN_CONVOLUTION_FWD_ALGO_COUNT`* | -| struct |`cudnnConvolutionFwdAlgoPerf_t` | |`hipdnnConvolutionFwdAlgoPerf_t` | -| enum |***`cudnnConvolutionBwdFilterPreference_t`*** | |***`hipdnnConvolutionBwdFilterPreference_t`*** | -| 0 |*`CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE`* | -| 1 |*`CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST`* | -| 2 |*`CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT`* | -| enum |***`cudnnConvolutionBwdFilterAlgo_t`*** | |***`hipdnnConvolutionBwdFilterAlgo_t`*** | -| 0 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_0`* | -| 1 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_1`* | -| 2 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT`* | -| 3 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_3`* | -| 4 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD`* | -| 5 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED`* | -| 6 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING`* | -| 7 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT`* | -| struct |`cudnnConvolutionBwdDataAlgoPerf_t` | |`hipdnnConvolutionBwdDataAlgoPerf_t` | -| enum |***`cudnnSoftmaxAlgorithm_t`*** | |***`hipdnnSoftmaxAlgorithm_t`*** | -| 0 |*`CUDNN_SOFTMAX_FAST`* | |*`HIPDNN_SOFTMAX_FAST`* | -| 1 |*`CUDNN_SOFTMAX_ACCURATE`* | |*`HIPDNN_SOFTMAX_ACCURATE`* | -| 2 |*`CUDNN_SOFTMAX_LOG`* | |*`HIPDNN_SOFTMAX_LOG`* | -| enum |***`cudnnSoftmaxMode_t`*** | |***`hipdnnSoftmaxMode_t`*** | -| 0 |*`CUDNN_SOFTMAX_MODE_INSTANCE`* | |*`HIPDNN_SOFTMAX_MODE_INSTANCE`* | -| 1 |*`CUDNN_SOFTMAX_MODE_CHANNEL`* | |*`HIPDNN_SOFTMAX_MODE_CHANNEL`* | -| enum |***`cudnnPoolingMode_t`*** | |***`hipdnnPoolingMode_t`*** | -| 0 |*`CUDNN_POOLING_MAX`* | |*`HIPDNN_POOLING_MAX`* | -| 1 |*`CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING`* | |*`HIPDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING`* | -| 2 |*`CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING`* | |*`HIPDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING`* | -| 3 |*`CUDNN_POOLING_MAX_DETERMINISTIC`* | 7.5 |*`HIPDNN_POOLING_MAX_DETERMINISTIC`* | -| enum |***`cudnnActivationMode_t`*** | |***`hipdnnActivationMode_t`*** | -| 0 |*`CUDNN_ACTIVATION_SIGMOID`* | |*`HIPDNN_ACTIVATION_SIGMOID`* | -| 1 |*`CUDNN_ACTIVATION_RELU`* | |*`HIPDNN_ACTIVATION_RELU`* | -| 2 |*`CUDNN_ACTIVATION_TANH`* | |*`HIPDNN_ACTIVATION_TANH`* | -| 3 |*`CUDNN_ACTIVATION_CLIPPED_RELU`* | |*`HIPDNN_ACTIVATION_CLIPPED_RELU`* | -| 4 |*`CUDNN_ACTIVATION_ELU`* | 7.5 |*`HIPDNN_ACTIVATION_ELU`* | -| 5 |*`CUDNN_ACTIVATION_IDENTITY`* | 8.0 |*`HIPDNN_ACTIVATION_PATHTRU`* | -| define |`CUDNN_LRN_MIN_N` | | | -| define |`CUDNN_LRN_MAX_N` | | | -| define |`CUDNN_LRN_MIN_K` | | | -| define |`CUDNN_LRN_MIN_BETA` | | | -| enum |***`cudnnLRNMode_t`*** | |***`hipdnnLRNMode_t`*** | -| 0 |*`CUDNN_LRN_CROSS_CHANNEL_DIM1`* | |*`HIPDNN_LRN_CROSS_CHANNEL`* | -| enum |***`cudnnDivNormMode_t`*** | | | -| 0 |*`CUDNN_DIVNORM_PRECOMPUTED_MEANS`* | | | -| enum |***`cudnnBatchNormMode_t`*** | |***`hipdnnBatchNormMode_t`*** | -| 0 |*`CUDNN_BATCHNORM_PER_ACTIVATION`* | |*`HIPDNN_BATCHNORM_PER_ACTIVATION`* | -| 1 |*`CUDNN_BATCHNORM_SPATIAL`* | |*`HIPDNN_BATCHNORM_SPATIAL`* | -| 2 |*`CUDNN_BATCHNORM_SPATIAL_PERSISTENT`* | 8.0 |*`HIPDNN_BATCHNORM_SPATIAL_PERSISTENT`* | -| define |`CUDNN_BN_MIN_EPSILON` | |`HIPDNN_BN_MIN_EPSILON` | -| enum |***`cudnnSamplerType_t`*** | 7.5 | | -| 0 |*`CUDNN_SAMPLER_BILINEAR`* | 7.5 | | -| struct |`cudnnDropoutStruct` | 7.5 | | -| struct* |`cudnnDropoutDescriptor_t` | 7.5 |`hipdnnDropoutDescriptor_t` | -| enum |***`cudnnRNNMode_t`*** | 7.5 |***`hipdnnRNNMode_t`*** | -| 0 |*`CUDNN_RNN_RELU`* | 7.5 |*`HIPDNN_RNN_RELU`* | -| 1 |*`CUDNN_RNN_TANH`* | 7.5 |*`HIPDNN_RNN_TANH`* | -| 2 |*`CUDNN_LSTM`* | 7.5 |*`HIPDNN_LSTM`* | -| 3 |*`CUDNN_GRU`* | 7.5 |*`HIPDNN_GRU`* | -| enum |***`cudnnRNNBiasMode_t`*** | 9.0 |***`hipdnnRNNBiasMode_t`*** | -| 0 |*`CUDNN_RNN_NO_BIAS`* | 9.0 |*`HIPDNN_RNN_NO_BIAS`* | -| 1 |*`CUDNN_RNN_SINGLE_INP_BIAS`* | 9.0 |*`HIPDNN_RNN_WITH_BIAS`* | -| 2 |*`CUDNN_RNN_DOUBLE_BIAS`* | 9.0 |*`HIPDNN_RNN_WITH_BIAS`* | 1 | -| 3 |*`CUDNN_RNN_SINGLE_REC_BIAS`* | 9.0 |*`HIPDNN_RNN_WITH_BIAS`* | 1 | -| enum |***`cudnnDirectionMode_t`*** | 7.5 |***`hipdnnDirectionMode_t`*** | -| 0 |*`CUDNN_UNIDIRECTIONAL`* | 7.5 |*`HIPDNN_UNIDIRECTIONAL`* | -| 1 |*`CUDNN_BIDIRECTIONAL`* | 7.5 |*`HIPDNN_BIDIRECTIONAL`* | -| enum |***`cudnnRNNAlgo_t`*** | 7.5 |***`hipdnnRNNAlgo_t`*** | -| 0 |*`CUDNN_RNN_ALGO_STANDARD`* | 7.5 |*`HIPDNN_RNN_ALGO_STANDARD`* | -| 1 |*`CUDNN_RNN_ALGO_PERSIST_STATIC`* | 7.5 |*`HIPDNN_RNN_ALGO_PERSIST_STATIC`* | -| 2 |*`CUDNN_RNN_ALGO_PERSIST_DYNAMIC`* | 7.5 |*`HIPDNN_RNN_ALGO_PERSIST_DYNAMIC`* | -| 3 |*`CUDNN_RNN_ALGO_COUNT`* | 8.0 | | -| struct |`cudnnAlgorithmStruct` | 8.0 | | -| struct* |`cudnnAlgorithmDescriptor_t` | 8.0 | | -| struct |`cudnnAlgorithmPerformanceStruct` | 8.0 | | -| struct* |`cudnnAlgorithmPerformance_t` | 8.0 | | -| struct |`cudnnRNNStruct` | 7.5 | | -| struct* |`cudnnRNNDescriptor_t` | 7.5 |`hipdnnRNNDescriptor_t` | -| struct |`cudnnPersistentRNNPlan` | 7.5 | | -| struct* |`cudnnPersistentRNNPlan_t` | 7.5 |`hipdnnPersistentRNNPlan_t` | -| enum |***`cudnnCTCLossAlgo_t`*** | 8.0 | | -| 0 |*`CUDNN_CTC_LOSS_ALGO_DETERMINISTIC`* | 8.0 | | -| 1 |*`CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC`* | 8.0 | | -| struct |`cudnnAlgorithm_t` | 8.0 | | -| enum |***`cudnnSeverity_t`*** | 8.0 | | -| 0 |*`CUDNN_SEV_FATAL`* | 8.0 | | -| 1 |*`CUDNN_SEV_ERROR`* | 8.0 | | -| 2 |*`CUDNN_SEV_WARNING`* | 8.0 | | -| 3 |*`CUDNN_SEV_INFO`* | 8.0 | | -| define |`CUDNN_SEV_ERROR_EN` | 8.0 | | -| define |`CUDNN_SEV_WARNING_EN` | 8.0 | | -| define |`CUDNN_SEV_INFO_EN` | 8.0 | | -| struct |`cudnnDebug_t` | 8.0 | | -| struct |`cudnnCallback_t` | 8.0 | | -| enum |***`cudnnBatchNormOps_t`*** | 9.0 | | -| 0 |*`CUDNN_BATCHNORM_OPS_BN`* | 9.0 | | -| 1 |*`CUDNN_BATCHNORM_OPS_BN_ACTIVATION`* | 9.0 | | -| 2 |*`CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION`* | 9.0 | | -| enum |***`cudnnRNNClipMode_t`*** | 9.0 | | -| 0 |*`CUDNN_RNN_CLIP_NONE`* | 9.0 | | -| 1 |*`CUDNN_RNN_CLIP_MINMAX`* | 9.0 | | -| struct |`cudnnRNNDataStruct` | 9.0 | | -| struct* |`cudnnRNNDataDescriptor_t` | 9.0 | | -| enum |***`cudnnRNNDataLayout_t`*** | 9.0 | | -| 0 |*`CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED`* | 9.0 | | -| 1 |*`CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED`* | 9.0 | | -| 2 |*`CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED`* | 9.0 | | -| enum |***`cudnnRNNPaddingMode_t`*** | 9.0 | | -| 0 |*`CUDNN_RNN_PADDED_IO_DISABLED`* | 9.0 | | -| 1 |*`CUDNN_RNN_PADDED_IO_ENABLED`* | 9.0 | | -| enum |***`cudnnSeqDataAxis_t`*** | 9.0 | | -| 0 |*`CUDNN_SEQDATA_TIME_DIM`* | 9.0 | | -| 1 |*`CUDNN_SEQDATA_BATCH_DIM`* | 9.0 | | -| 2 |*`CUDNN_SEQDATA_BEAM_DIM`* | 9.0 | | -| 3 |*`CUDNN_SEQDATA_VECT_DIM`* | 9.0 | | -| define |`CUDNN_SEQDATA_DIM_COUNT` | 9.0 | | -| struct |`cudnnSeqDataStruct` | 9.0 | | -| struct* |`cudnnSeqDataDescriptor_t` | 9.0 | | -| unsigned |***`cudnnAttnQueryMap_t`*** | 9.0 | | -| 0 |*`CUDNN_ATTN_QUERYMAP_ALL_TO_ONE`* | 9.0 | | -| 1U << 0 |*`CUDNN_ATTN_QUERYMAP_ONE_TO_ONE`* | 9.0 | | -| 1 |*`CUDNN_ATTN_DISABLE_PROJ_BIASES`* | 10.1 Update 2 | | -| 1U << 1 |*`CUDNN_ATTN_ENABLE_PROJ_BIASES`* | 10.1 Update 2 | | -| struct |`cudnnAttnStruct` | 9.0 | | -| struct* |`cudnnAttnDescriptor_t` | 9.0 | | -| enum |***`cudnnMultiHeadAttnWeightKind_t`*** | 9.0 | | -| 0 |*`CUDNN_MH_ATTN_Q_WEIGHTS`* | 9.0 | | -| 1 |*`CUDNN_MH_ATTN_K_WEIGHTS`* | 9.0 | | -| 2 |*`CUDNN_MH_ATTN_V_WEIGHTS`* | 9.0 | | -| 3 |*`CUDNN_MH_ATTN_O_WEIGHTS`* | 9.0 | | -| 4 |*`CUDNN_MH_ATTN_Q_BIASES`* | 10.1 Update 2 | | -| 5 |*`CUDNN_MH_ATTN_K_BIASES`* | 10.1 Update 2 | | -| 6 |*`CUDNN_MH_ATTN_V_BIASES`* | 10.1 Update 2 | | -| 7 |*`CUDNN_MH_ATTN_O_BIASES`* | 10.1 Update 2 | | -| define 8 |`CUDNN_ATTN_WKIND_COUNT` | 10.1 Update 2 | | -| enum |***`cudnnWgradMode_t`*** | 9.0 | | -| 0 |*`CUDNN_WGRAD_MODE_ADD`* | 9.0 | | -| 1 |*`CUDNN_WGRAD_MODE_SET`* | 9.0 | | -| enum |***`cudnnReorderType_t`*** | 10.1 | | -| 0 |*`CUDNN_DEFAULT_REORDER`* | 10.1 | | -| 1 |*`CUDNN_NO_REORDER`* | 10.1 | | -| enum |***`cudnnLossNormalizationMode_t`*** | 10.1 | | -| 0 |*`CUDNN_LOSS_NORMALIZATION_NONE`* | 10.1 | | -| 1 |*`CUDNN_LOSS_NORMALIZATION_SOFTMAX`* | 10.1 | | -| struct |`cudnnFusedOpsConstParamStruct` | 10.1 | | -| struct* |`cudnnFusedOpsConstParamPack_t` | 10.1 | | -| struct |`cudnnFusedOpsVariantParamStruct` | 10.1 | | -| struct* |`cudnnFusedOpsVariantParamPack_t` | 10.1 | | -| struct |`cudnnFusedOpsPlanStruct` | 10.1 | | -| struct* |`cudnnFusedOpsPlan_t` | 10.1 | | -| enum |***`cudnnFusedOps_t`*** | 10.1 | | -| 0 |*`CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS`* | 10.1 | | -| 1 |*`CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD`* | 10.1 | | -| 2 |*`CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING`* | 10.1 | | -| 3 |*`CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE`* | 10.1 | | -| 4 |*`CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION`* | 10.1 | | -| 5 |*`CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK`* | 10.1 | | -| 6 |*`CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM`* | 10.1 | | -| enum |***`cudnnFusedOpsConstParamLabel_t`*** | 10.1 | | -| 0 |*`CUDNN_PARAM_XDESC`* | 10.1 | | -| 1 |*`CUDNN_PARAM_XDATA_PLACEHOLDER`* | 10.1 | | -| 2 |*`CUDNN_PARAM_BN_MODE`* | 10.1 | | -| 3 |*`CUDNN_PARAM_BN_EQSCALEBIAS_DESC`* | 10.1 | | -| 4 |*`CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER`* | 10.1 | | -| 5 |*`CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER`* | 10.1 | | -| 6 |*`CUDNN_PARAM_ACTIVATION_DESC`* | 10.1 | | -| 7 |*`CUDNN_PARAM_CONV_DESC`* | 10.1 | | -| 8 |*`CUDNN_PARAM_WDESC`* | 10.1 | | -| 9 |*`CUDNN_PARAM_WDATA_PLACEHOLDER`* | 10.1 | | -| 10 |*`CUDNN_PARAM_DWDESC`* | 10.1 | | -| 11 |*`CUDNN_PARAM_DWDATA_PLACEHOLDER`* | 10.1 | | -| 12 |*`CUDNN_PARAM_YDESC`* | 10.1 | | -| 13 |*`CUDNN_PARAM_YDATA_PLACEHOLDER`* | 10.1 | | -| 14 |*`CUDNN_PARAM_DYDESC`* | 10.1 | | -| 15 |*`CUDNN_PARAM_DYDATA_PLACEHOLDER`* | 10.1 | | -| 16 |*`CUDNN_PARAM_YSTATS_DESC`* | 10.1 | | -| 17 |*`CUDNN_PARAM_YSUM_PLACEHOLDER`* | 10.1 | | -| 18 |*`CUDNN_PARAM_YSQSUM_PLACEHOLDER`* | 10.1 | | -| 19 |*`CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC`* | 10.1 | | -| 20 |*`CUDNN_PARAM_BN_SCALE_PLACEHOLDER`* | 10.1 | | -| 21 |*`CUDNN_PARAM_BN_BIAS_PLACEHOLDER`* | 10.1 | | -| 22 |*`CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER`* | 10.1 | | -| 23 |*`CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER`* | 10.1 | | -| 24 |*`CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER`* | 10.1 | | -| 25 |*`CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER`* | 10.1 | | -| 26 |*`CUDNN_PARAM_ZDESC`* | 10.1 | | -| 27 |*`CUDNN_PARAM_ZDATA_PLACEHOLDER`* | 10.1 | | -| 28 |*`CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC`* | 10.1 | | -| 29 |*`CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER`* | 10.1 | | -| 30 |*`CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER`* | 10.1 | | -| 31 |*`CUDNN_PARAM_ACTIVATION_BITMASK_DESC`* | 10.1 | | -| 32 |*`CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER`* | 10.1 | | -| 33 |*`CUDNN_PARAM_DXDESC`* | 10.1 | | -| 34 |*`CUDNN_PARAM_DXDATA_PLACEHOLDER`* | 10.1 | | -| 35 |*`CUDNN_PARAM_DZDESC`* | 10.1 | | -| 36 |*`CUDNN_PARAM_DZDATA_PLACEHOLDER`* | 10.1 | | -| 37 |*`CUDNN_PARAM_BN_DSCALE_PLACEHOLDER`* | 10.1 | | -| 38 |*`CUDNN_PARAM_BN_DBIAS_PLACEHOLDER`* | 10.1 | | -| enum |***`cudnnFusedOpsPointerPlaceHolder_t`*** | 10.1 | | -| 0 |*`CUDNN_PTR_NULL`* | 10.1 | | -| 1 |*`CUDNN_PTR_ELEM_ALIGNED`* | 10.1 | | -| 2 |*`CUDNN_PTR_16B_ALIGNED`* | 10.1 | | -| enum |***`cudnnFusedOpsVariantParamLabel_t`*** | 10.1 | | -| 0 |*`CUDNN_PTR_XDATA`* | 10.1 | | -| 1 |*`CUDNN_PTR_BN_EQSCALE`* | 10.1 | | -| 2 |*`CUDNN_PTR_BN_EQBIAS`* | 10.1 | | -| 3 |*`CUDNN_PTR_WDATA`* | 10.1 | | -| 4 |*`CUDNN_PTR_DWDATA`* | 10.1 | | -| 5 |*`CUDNN_PTR_YDATA`* | 10.1 | | -| 6 |*`CUDNN_PTR_DYDATA`* | 10.1 | | -| 7 |*`CUDNN_PTR_YSUM`* | 10.1 | | -| 8 |*`CUDNN_PTR_YSQSUM`* | 10.1 | | -| 9 |*`CUDNN_PTR_WORKSPACE`* | 10.1 | | -| 10 |*`CUDNN_PTR_BN_SCALE`* | 10.1 | | -| 11 |*`CUDNN_PTR_BN_BIAS`* | 10.1 | | -| 12 |*`CUDNN_PTR_BN_SAVED_MEAN`* | 10.1 | | -| 13 |*`CUDNN_PTR_BN_SAVED_INVSTD`* | 10.1 | | -| 14 |*`CUDNN_PTR_BN_RUNNING_MEAN`* | 10.1 | | -| 15 |*`CUDNN_PTR_BN_RUNNING_VAR`* | 10.1 | | -| 16 |*`CUDNN_PTR_ZDATA`* | 10.1 | | -| 17 |*`CUDNN_PTR_BN_Z_EQSCALE`* | 10.1 | | -| 18 |*`CUDNN_PTR_BN_Z_EQBIAS`* | 10.1 | | -| 19 |*`CUDNN_PTR_ACTIVATION_BITMASK`* | 10.1 | | -| 20 |*`CUDNN_PTR_DXDATA`* | 10.1 | | -| 21 |*`CUDNN_PTR_DZDATA`* | 10.1 | | -| 22 |*`CUDNN_PTR_BN_DSCALE`* | 10.1 | | -| 23 |*`CUDNN_PTR_BN_DBIAS`* | 10.1 | | -| 100 |*`CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES`* | 10.1 | | -| 101 |*`CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT`* | 10.1 | | -| 102 |*`CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR`* | 10.1 | | -| 103 |*`CUDNN_SCALAR_DOUBLE_BN_EPSILON`* | 10.1 | | - -## **2. CUDNN API functions** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:-----------------| -|`cudnnGetVersion` |`hipdnnGetVersion` | -|`cudnnGetCudartVersion` | | 7.5 | -|`cudnnGetErrorString` |`hipdnnGetErrorString` | -|`cudnnQueryRuntimeError` | | 8.0 | -|`cudnnGetProperty` | | 7.5 | -|`cudnnCreate` |`hipdnnCreate` | -|`cudnnDestroy` |`hipdnnDestroy` | -|`cudnnSetStream` |`hipdnnSetStream` | -|`cudnnGetStream` |`hipdnnGetStream` | -|`cudnnCreateTensorDescriptor` |`hipdnnCreateTensorDescriptor` | -|`cudnnSetTensor4dDescriptor` |`hipdnnSetTensor4dDescriptor` | -|`cudnnSetTensor4dDescriptorEx` |`hipdnnSetTensor4dDescriptorEx` | -|`cudnnGetTensor4dDescriptor` |`hipdnnGetTensor4dDescriptor` | -|`cudnnSetTensorNdDescriptor` |`hipdnnSetTensorNdDescriptor` | -|`cudnnSetTensorNdDescriptorEx` | | 7.5 | -|`cudnnGetTensorNdDescriptor` |`hipdnnGetTensorNdDescriptor` | -|`cudnnGetTensorSizeInBytes` | | 7.5 | -|`cudnnDestroyTensorDescriptor` |`hipdnnDestroyTensorDescriptor` | -|`cudnnTransformTensor` | | -|`cudnnTransformTensorEx` | | 9.0 | -|`cudnnInitTransformDest` | | 9.0 | -|`cudnnCreateTensorTransformDescriptor` | | 9.0 | -|`cudnnSetTensorTransformDescriptor` | | 9.0 | -|`cudnnGetTensorTransformDescriptor` | | 9.0 | -|`cudnnDestroyTensorTransformDescriptor` | | 9.0 | -|`cudnnAddTensor` |`hipdnnAddTensor` | -|`cudnnCreateOpTensorDescriptor` |`hipdnnCreateOpTensorDescriptor` | 7.5 | -|`cudnnSetOpTensorDescriptor` |`hipdnnSetOpTensorDescriptor` | 7.5 | -|`cudnnGetOpTensorDescriptor` |`hipdnnGetOpTensorDescriptor` | 7.5 | -|`cudnnDestroyOpTensorDescriptor` |`hipdnnDestroyOpTensorDescriptor` | 7.5 | -|`cudnnOpTensor` |`hipdnnOpTensor` | 7.5 | -|`cudnnGetFoldedConvBackwardDataDescriptors` | | 10.1 | -|`cudnnCreateReduceTensorDescriptor` |`hipdnnCreateReduceTensorDescriptor` | 7.5 | -|`cudnnSetReduceTensorDescriptor` |`hipdnnSetReduceTensorDescriptor` | 7.5 | -|`cudnnGetReduceTensorDescriptor` |`hipdnnGetReduceTensorDescriptor` | 7.5 | -|`cudnnDestroyReduceTensorDescriptor` |`hipdnnDestroyReduceTensorDescriptor` | 7.5 | -|`cudnnGetReductionIndicesSize` | | 7.5 | -|`cudnnGetReductionWorkspaceSize` |`hipdnnGetReductionWorkspaceSize` | 7.5 | -|`cudnnReduceTensor` |`hipdnnReduceTensor` | 7.5 | -|`cudnnSetTensor` |`hipdnnSetTensor` | -|`cudnnScaleTensor` |`hipdnnScaleTensor` | -|`cudnnCreateFilterDescriptor` |`hipdnnCreateFilterDescriptor` | -|`cudnnSetFilter4dDescriptor` |`hipdnnSetFilter4dDescriptor` | -|`cudnnGetFilter4dDescriptor` |`hipdnnGetFilter4dDescriptor` | -|`cudnnSetFilterNdDescriptor` |`hipdnnSetFilterNdDescriptor` | -|`cudnnGetFilterNdDescriptor` |`hipdnnGetFilterNdDescriptor` | -|`cudnnGetFilterSizeInBytes` | | 10.1 | -|`cudnnTransformFilter` | | 10.1 | -|`cudnnDestroyFilterDescriptor` |`hipdnnDestroyFilterDescriptor` | -|`cudnnReorderFilterAndBias` | | 10.1 | -|`cudnnCreateConvolutionDescriptor` |`hipdnnCreateConvolutionDescriptor` | -|`cudnnSetConvolutionMathType` |`hipdnnSetConvolutionMathType` | 8.0 | -|`cudnnGetConvolutionMathType` | | 8.0 | -|`cudnnSetConvolutionGroupCount` |`hipdnnSetConvolutionGroupCount` | 8.0 | -|`cudnnGetConvolutionGroupCount` | | 8.0 | -|`cudnnSetConvolutionReorderType` | | 10.1 | -|`cudnnGetConvolutionReorderType` | | 10.1 | -|`cudnnSetConvolution2dDescriptor` |`hipdnnSetConvolution2dDescriptor` | -|`cudnnGetConvolution2dDescriptor` |`hipdnnGetConvolution2dDescriptor` | -|`cudnnGetConvolution2dForwardOutputDim` |`hipdnnGetConvolution2dForwardOutputDim` | -|`cudnnSetConvolutionNdDescriptor` |`hipdnnSetConvolutionNdDescriptor` | -|`cudnnGetConvolutionNdDescriptor` | | -|`cudnnGetConvolutionNdForwardOutputDim` | | -|`cudnnDestroyConvolutionDescriptor` | | -|`cudnnGetConvolutionForwardAlgorithmMaxCount` | | 8.0 | -|`cudnnFindConvolutionForwardAlgorithm` |`hipdnnFindConvolutionForwardAlgorithm` | -|`cudnnFindConvolutionForwardAlgorithmEx` |`hipdnnFindConvolutionForwardAlgorithmEx` | 7.5 | -|`cudnnGetConvolutionForwardAlgorithm` |`hipdnnGetConvolutionForwardAlgorithm` | -|`cudnnGetConvolutionForwardAlgorithm_v7` | | 8.0 | -|`cudnnGetConvolutionForwardWorkspaceSize` |`hipdnnGetConvolutionForwardWorkspaceSize` | -|`cudnnConvolutionForward` |`hipdnnConvolutionForward` | -|`cudnnConvolutionBiasActivationForward` | | 7.5 | -|`cudnnConvolutionBackwardBias` |`hipdnnConvolutionBackwardBias` | -|`cudnnGetConvolutionBackwardFilterAlgorithmMaxCount` | | 8.0 | -|`cudnnFindConvolutionBackwardFilterAlgorithm` |`hipdnnFindConvolutionBackwardFilterAlgorithm` | -|`cudnnFindConvolutionBackwardFilterAlgorithmEx` |`hipdnnFindConvolutionBackwardFilterAlgorithmEx` | 7.5 | -|`cudnnGetConvolutionBackwardFilterAlgorithm` |`hipdnnGetConvolutionBackwardFilterAlgorithm` | -|`cudnnGetConvolutionBackwardFilterAlgorithm_v7` | | 8.0 | -|`cudnnGetConvolutionBackwardFilterWorkspaceSize` |`hipdnnGetConvolutionBackwardFilterWorkspaceSize`| -|`cudnnConvolutionBackwardFilter` |`hipdnnConvolutionBackwardFilter` | -|`cudnnGetConvolutionBackwardDataAlgorithmMaxCount` | | 8.0 | -|`cudnnFindConvolutionBackwardDataAlgorithm` |`hipdnnFindConvolutionBackwardDataAlgorithm` | -|`cudnnFindConvolutionBackwardDataAlgorithmEx` |`hipdnnFindConvolutionBackwardDataAlgorithmEx` | 7.5 | -|`cudnnGetConvolutionBackwardDataAlgorithm` |`hipdnnGetConvolutionBackwardDataAlgorithm` | -|`cudnnGetConvolutionBackwardDataAlgorithm_v7` | | 8.0 | -|`cudnnGetConvolutionBackwardDataWorkspaceSize` |`hipdnnGetConvolutionBackwardDataWorkspaceSize` | -|`cudnnConvolutionBackwardData` |`hipdnnConvolutionBackwardData` | -|`cudnnIm2Col` | | -|`cudnnSoftmaxForward` |`hipdnnSoftmaxForward` | -|`cudnnSoftmaxBackward` |`hipdnnSoftmaxBackward` | -|`cudnnCreatePoolingDescriptor` |`hipdnnCreatePoolingDescriptor` | -|`cudnnSetPooling2dDescriptor` |`hipdnnSetPooling2dDescriptor` | -|`cudnnGetPooling2dDescriptor` |`hipdnnGetPooling2dDescriptor` | -|`cudnnSetPoolingNdDescriptor` |`hipdnnSetPoolingNdDescriptor` | -|`cudnnGetPoolingNdDescriptor` | | -|`cudnnGetPoolingNdForwardOutputDim` | | -|`cudnnGetPooling2dForwardOutputDim` |`hipdnnGetPooling2dForwardOutputDim` | -|`cudnnDestroyPoolingDescriptor` |`hipdnnDestroyPoolingDescriptor` | -|`cudnnPoolingForward` |`hipdnnPoolingForward` | -|`cudnnPoolingBackward` |`hipdnnPoolingBackward` | -|`cudnnCreateActivationDescriptor` |`hipdnnCreateActivationDescriptor` | -|`cudnnSetActivationDescriptor` |`hipdnnSetActivationDescriptor` | -|`cudnnGetActivationDescriptor` |`hipdnnGetActivationDescriptor` | -|`cudnnDestroyActivationDescriptor` |`hipdnnDestroyActivationDescriptor` | -|`cudnnActivationForward` |`hipdnnActivationForward` | -|`cudnnActivationBackward` |`hipdnnActivationBackward` | -|`cudnnCreateLRNDescriptor` |`hipdnnCreateLRNDescriptor` | -|`cudnnSetLRNDescriptor` |`hipdnnSetLRNDescriptor` | -|`cudnnGetLRNDescriptor` |`hipdnnGetLRNDescriptor` | -|`cudnnDestroyLRNDescriptor` |`hipdnnDestroyLRNDescriptor` | -|`cudnnLRNCrossChannelForward` |`hipdnnLRNCrossChannelForward` | -|`cudnnLRNCrossChannelBackward` |`hipdnnLRNCrossChannelBackward` | -|`cudnnDivisiveNormalizationForward` | | -|`cudnnDivisiveNormalizationBackward` | | -|`cudnnDeriveBNTensorDescriptor` |`hipdnnDeriveBNTensorDescriptor` | -|`cudnnBatchNormalizationForwardTraining` |`hipdnnBatchNormalizationForwardTraining` | -|`cudnnBatchNormalizationForwardTrainingEx` | | 9.0 | -|`cudnnBatchNormalizationForwardInference` |`hipdnnBatchNormalizationForwardInference` | -|`cudnnBatchNormalizationBackward` |`hipdnnBatchNormalizationBackward` | -|`cudnnBatchNormalizationBackwardEx` | | 9.0 | -|`cudnnCreateSpatialTransformerDescriptor` | | 7.5 | -|`cudnnSetSpatialTransformerNdDescriptor` | | 7.5 | -|`cudnnDestroySpatialTransformerDescriptor` | | 7.5 | -|`cudnnSpatialTfGridGeneratorForward` | | 7.5 | -|`cudnnSpatialTfGridGeneratorBackward` | | 7.5 | -|`cudnnSpatialTfSamplerForward` | | 7.5 | -|`cudnnSpatialTfSamplerBackward` | | 7.5 | -|`cudnnCreateDropoutDescriptor` |`hipdnnCreateDropoutDescriptor` | 7.5 | -|`cudnnDestroyDropoutDescriptor` |`hipdnnDestroyDropoutDescriptor` | 7.5 | -|`cudnnDropoutGetStatesSize` |`hipdnnDropoutGetStatesSize` | 7.5 | -|`cudnnDropoutGetReserveSpaceSize` | | 7.5 | -|`cudnnSetDropoutDescriptor` |`hipdnnSetDropoutDescriptor` | 7.5 | -|`cudnnGetDropoutDescriptor` | | 8.0 | -|`cudnnRestoreDropoutDescriptor` | | 8.0 | -|`cudnnDropoutForward` | | 7.5 | -|`cudnnDropoutBackward` | | 7.5 | -|`cudnnCreateRNNDescriptor` |`hipdnnCreateRNNDescriptor` | 7.5 | -|`cudnnDestroyRNNDescriptor` |`hipdnnDestroyRNNDescriptor` | 7.5 | -|`cudnnGetRNNForwardInferenceAlgorithmMaxCount` | | 8.0 | -|`cudnnFindRNNForwardInferenceAlgorithmEx` | | 8.0 | -|`cudnnGetRNNForwardTrainingAlgorithmMaxCount` | | 8.0 | -|`cudnnFindRNNForwardTrainingAlgorithmEx` | | 8.0 | -|`cudnnGetRNNBackwardDataAlgorithmMaxCount` | | 8.0 | -|`cudnnFindRNNBackwardDataAlgorithmEx` | | 8.0 | -|`cudnnGetRNNBackwardWeightsAlgorithmMaxCount` | | 8.0 | -|`cudnnFindRNNBackwardWeightsAlgorithmEx` | | 8.0 | -|`cudnnCreatePersistentRNNPlan` |`hipdnnCreatePersistentRNNPlan` | 7.5 | -|`cudnnSetPersistentRNNPlan` |`hipdnnSetPersistentRNNPlan` | 7.5 | -|`cudnnDestroyPersistentRNNPlan` |`hipdnnDestroyPersistentRNNPlan` | 7.5 | -|`cudnnSetRNNDescriptor` |`hipdnnSetRNNDescriptor` | 7.5 | -|`cudnnGetRNNDescriptor` |`hipdnnGetRNNDescriptor` | 8.0 | -|`cudnnSetRNNProjectionLayers` | | 8.0 | -|`cudnnGetRNNProjectionLayers` | | 8.0 | -|`cudnnSetRNNAlgorithmDescriptor` | | 8.0 | -|`cudnnSetRNNMatrixMathType` | | 8.0 | -|`cudnnGetRNNMatrixMathType` | | 8.0 | -|`cudnnGetRNNWorkspaceSize` |`hipdnnGetRNNWorkspaceSize` | 7.5 | -|`cudnnGetRNNTrainingReserveSize` |`hipdnnGetRNNTrainingReserveSize` | 7.5 | -|`cudnnGetRNNParamsSize` |`hipdnnGetRNNParamsSize` | 7.5 | -|`cudnnGetRNNLinLayerMatrixParams` |`hipdnnGetRNNLinLayerMatrixParams` | 7.5 | -|`cudnnGetRNNLinLayerBiasParams` |`hipdnnGetRNNLinLayerBiasParams` | 7.5 | -|`cudnnRNNForwardInference` |`hipdnnRNNForwardInference` | 7.5 | -|`cudnnRNNForwardInferenceEx` | | 9.0 | -|`cudnnRNNForwardTraining` |`hipdnnRNNForwardTraining` | 7.5 | -|`cudnnRNNForwardTrainingEx` | | 9.0 | -|`cudnnRNNBackwardData` |`hipdnnRNNBackwardData` | 7.5 | -|`cudnnRNNBackwardDataEx` | | 9.0 | -|`cudnnRNNBackwardWeights` |`hipdnnRNNBackwardWeights` | 7.5 | -|`cudnnRNNBackwardWeightsEx` | | 9.0 | -|`cudnnSetRNNPaddingMode` | | 9.0 | -|`cudnnGetRNNPaddingMode` | | 9.0 | -|`cudnnCreateRNNDataDescriptor` | | 9.0 | -|`cudnnDestroyRNNDataDescriptor` | | 9.0 | -|`cudnnSetRNNDataDescriptor` | | 9.0 | -|`cudnnGetRNNDataDescriptor` | | 9.0 | -|`cudnnSetRNNBiasMode` | | 9.0 | -|`cudnnGetRNNBiasMode` | | 9.0 | -|`cudnnCreateCTCLossDescriptor` | | 8.0 | -|`cudnnSetCTCLossDescriptor` | | 8.0 | -|`cudnnSetCTCLossDescriptorEx` | | 10.1 | -|`cudnnGetCTCLossDescriptor` | | 8.0 | -|`cudnnGetCTCLossDescriptorEx` | | 10.1 | -|`cudnnDestroyCTCLossDescriptor` | | 8.0 | -|`cudnnCTCLoss` | | 8.0 | -|`cudnnGetCTCLossWorkspaceSize` | | 8.0 | -|`cudnnCreateAlgorithmDescriptor` | | 8.0 | -|`cudnnSetAlgorithmDescriptor` | | 8.0 | -|`cudnnGetAlgorithmDescriptor` | | 8.0 | -|`cudnnCopyAlgorithmDescriptor` | | 8.0 | -|`cudnnDestroyAlgorithmDescriptor` | | 8.0 | -|`cudnnCreateAlgorithmPerformance` | | 8.0 | -|`cudnnSetAlgorithmPerformance` | | 8.0 | -|`cudnnGetAlgorithmPerformance` | | 8.0 | -|`cudnnDestroyAlgorithmPerformance` | | 8.0 | -|`cudnnGetAlgorithmSpaceSize` | | 8.0 | -|`cudnnSaveAlgorithm` | | 8.0 | -|`cudnnRestoreAlgorithm` | | 8.0 | -|`cudnnSetRNNDescriptor_v5` |`hipdnnSetRNNDescriptor_v5` | 8.0 | -|`cudnnSetRNNDescriptor_v6` |`hipdnnSetRNNDescriptor_v6` | 7.5 | -|`cudnnSetCallback` | | 8.0 | -|`cudnnGetCallback` | | 8.0 | -|`cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize` | | 9.0 | -|`cudnnGetBatchNormalizationBackwardExWorkspaceSize` | | 9.0 | -|`cudnnGetBatchNormalizationTrainingExReserveSpaceSize` | | 9.0 | -|`cudnnRNNSetClip` | | 9.0 | -|`cudnnRNNGetClip` | | 9.0 | -|`cudnnCreateSeqDataDescriptor` | | 9.0 | -|`cudnnDestroySeqDataDescriptor` | | 9.0 | -|`cudnnSetSeqDataDescriptor` | | 9.0 | -|`cudnnGetSeqDataDescriptor` | | 9.0 | -|`cudnnCreateAttnDescriptor` | | 9.0 | -|`cudnnDestroyAttnDescriptor` | | 9.0 | -|`cudnnSetAttnDescriptor` | | 9.0 | -|`cudnnGetAttnDescriptor` | | 9.0 | -|`cudnnGetMultiHeadAttnBuffers` | | 9.0 | -|`cudnnGetMultiHeadAttnWeights` | | 9.0 | -|`cudnnMultiHeadAttnForward` | | 9.0 | -|`cudnnMultiHeadAttnBackwardData` | | 9.0 | -|`cudnnMultiHeadAttnBackwardWeights` | | 9.0 | -|`cudnnCreateFusedOpsConstParamPack` | | 10.1 | -|`cudnnDestroyFusedOpsConstParamPack` | | 10.1 | -|`cudnnSetFusedOpsConstParamPackAttribute` | | 10.1 | -|`cudnnGetFusedOpsConstParamPackAttribute` | | 10.1 | -|`cudnnCreateFusedOpsVariantParamPack` | | 10.1 | -|`cudnnDestroyFusedOpsVariantParamPack` | | 10.1 | -|`cudnnSetFusedOpsVariantParamPackAttribute` | | 10.1 | -|`cudnnGetFusedOpsVariantParamPackAttribute` | | 10.1 | -|`cudnnCreateFusedOpsPlan` | | 10.1 | -|`cudnnDestroyFusedOpsPlan` | | 10.1 | -|`cudnnMakeFusedOpsPlan` | | 10.1 | -|`cudnnFusedOpsExecute` | | 10.1 | - -\* CUDA version, in which API has appeared and (optional) last version before abandoning it; no value in case of earlier versions < 7.5. diff --git a/docs/markdown/CUFFT_API_supported_by_HIP.md b/docs/markdown/CUFFT_API_supported_by_HIP.md deleted file mode 100644 index 4dac167525..0000000000 --- a/docs/markdown/CUFFT_API_supported_by_HIP.md +++ /dev/null @@ -1,81 +0,0 @@ -# CUFFT API supported by HIP - -## **1. CUFFT Data types** - -| **type** | **CUDA** |**CUDA version\***| **HIP** |**HIP value** (if differs) | -|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|---------------------------| -| enum |***`cufftResult_t`*** | |***`hipfftResult_t`*** | -| enum |***`cufftResult`*** | |***`hipfftResult`*** | -| 0x0 |*`CUFFT_SUCCESS`* | |*`HIPFFT_SUCCESS`* | 0 | -| 0x1 |*`CUFFT_INVALID_PLAN`* | |*`HIPFFT_INVALID_PLAN`* | 1 | -| 0x2 |*`CUFFT_ALLOC_FAILED`* | |*`HIPFFT_ALLOC_FAILED`* | 2 | -| 0x3 |*`CUFFT_INVALID_TYPE`* | |*`HIPFFT_INVALID_TYPE`* | 3 | -| 0x4 |*`CUFFT_INVALID_VALUE`* | |*`HIPFFT_INVALID_VALUE`* | 4 | -| 0x5 |*`CUFFT_INTERNAL_ERROR`* | |*`HIPFFT_INTERNAL_ERROR`* | 5 | -| 0x6 |*`CUFFT_EXEC_FAILED`* | |*`HIPFFT_EXEC_FAILED`* | 6 | -| 0x7 |*`CUFFT_SETUP_FAILED`* | |*`HIPFFT_SETUP_FAILED`* | 7 | -| 0x8 |*`CUFFT_INVALID_SIZE`* | |*`HIPFFT_INVALID_SIZE`* | 8 | -| 0x9 |*`CUFFT_UNALIGNED_DATA`* | |*`HIPFFT_UNALIGNED_DATA`* | 9 | -| 0xA |*`CUFFT_INCOMPLETE_PARAMETER_LIST`* | |*`HIPFFT_INCOMPLETE_PARAMETER_LIST`* | 10 | -| 0xB |*`CUFFT_INVALID_DEVICE`* | |*`HIPFFT_INVALID_DEVICE`* | 11 | -| 0xC |*`CUFFT_PARSE_ERROR`* | |*`HIPFFT_PARSE_ERROR`* | 12 | -| 0xD |*`CUFFT_NO_WORKSPACE`* | |*`HIPFFT_NO_WORKSPACE`* | 13 | -| 0xE |*`CUFFT_NOT_IMPLEMENTED`* | |*`HIPFFT_NOT_IMPLEMENTED`* | 14 | -| 0xF |*`CUFFT_LICENSE_ERROR`* | | | -| 0x10 |*`CUFFT_NOT_SUPPORTED`* | 8.0 |*`HIPFFT_NOT_SUPPORTED`* | 16 | -| float |***`cufftReal`*** | |***`hipfftReal`*** | -| double |***`cufftDoubleReal`*** | |***`hipfftDoubleReal`*** | -| float2 |***`cufftComplex`*** | |***`hipfftComplex`*** | -| double2 |***`cufftDoubleComplex`*** | |***`hipfftDoubleComplex`*** | -| define |`CUFFT_FORWARD` | |`HIPFFT_FORWARD` | -| define |`CUFFT_INVERSE` | |`HIPFFT_BACKWARD` | -| enum |***`cufftType_t`*** | |***`hipfftType_t`*** | -| enum |***`cufftType`*** | |***`hipfftType`*** | -| 0x2a |*`CUFFT_R2C`* | |*`HIPFFT_R2C`* | -| 0x2c |*`CUFFT_C2R`* | |*`HIPFFT_C2R`* | -| 0x29 |*`CUFFT_C2C`* | |*`HIPFFT_C2C`* | -| 0x6a |*`CUFFT_D2Z`* | |*`HIPFFT_D2Z`* | -| 0x6c |*`CUFFT_Z2D`* | |*`HIPFFT_Z2D`* | -| 0x69 |*`CUFFT_Z2Z`* | |*`HIPFFT_Z2Z`* | -| enum |***`cufftCompatibility_t`*** | | | -| enum |***`cufftCompatibility`*** | | | -| 0x01 |*`CUFFT_COMPATIBILITY_FFTW_PADDING`* | | | -| define |`CUFFT_COMPATIBILITY_DEFAULT` | | | -| int |***`cufftHandle`*** | |***`hipfftHandle`*** | - -## **2. CUFFT API functions** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cufftPlan1d` |`hipfftPlan1d` | -|`cufftPlan2d` |`hipfftPlan2d` | -|`cufftPlan3d` |`hipfftPlan3d` | -|`cufftPlanMany` |`hipfftPlanMany` | -|`cufftMakePlan1d` |`hipfftMakePlan1d` | -|`cufftMakePlan2d` |`hipfftMakePlan2d` | -|`cufftMakePlan3d` |`hipfftMakePlan3d` | -|`cufftMakePlanMany` |`hipfftMakePlanMany` | -|`cufftMakePlanMany64` |`hipfftMakePlanMany64` | 7.5 | -|`cufftGetSizeMany64` |`hipfftGetSizeMany64` | 7.5 | -|`cufftEstimate1d` |`hipfftEstimate1d` | -|`cufftEstimate2d` |`hipfftEstimate2d` | -|`cufftEstimate3d` |`hipfftEstimate3d` | -|`cufftEstimateMany` |`hipfftEstimateMany` | -|`cufftCreate` |`hipfftCreate` | -|`cufftGetSize1d` |`hipfftGetSize1d` | -|`cufftGetSize2d` |`hipfftGetSize2d` | -|`cufftGetSize3d` |`hipfftGetSize3d` | -|`cufftGetSizeMany` |`hipfftGetSizeMany` | -|`cufftGetSize` |`hipfftGetSize` | -|`cufftSetWorkArea` |`hipfftSetWorkArea` | -|`cufftSetAutoAllocation` |`hipfftSetAutoAllocation` | -|`cufftExecC2C` |`hipfftExecC2C` | -|`cufftExecR2C` |`hipfftExecR2C` | -|`cufftExecC2R` |`hipfftExecC2R` | -|`cufftExecZ2Z` |`hipfftExecZ2Z` | -|`cufftExecD2Z` |`hipfftExecD2Z` | -|`cufftExecZ2D` |`hipfftExecZ2D` | -|`cufftSetStream` |`hipfftSetStream` | -|`cufftDestroy` |`hipfftDestroy` | -|`cufftGetVersion` |`hipfftGetVersion` | -|`cufftGetProperty` | | 8.0 | diff --git a/docs/markdown/CURAND_API_supported_by_HIP.md b/docs/markdown/CURAND_API_supported_by_HIP.md deleted file mode 100644 index d4a3111c9c..0000000000 --- a/docs/markdown/CURAND_API_supported_by_HIP.md +++ /dev/null @@ -1,172 +0,0 @@ -# CURAND API supported by HIP - -## **1. CURAND Data types** - -| **type** | **CUDA** |**CUDA version\***| **HIP** | **HIP value** (if differs) | -|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|----------------------------| -| define |`CURAND_VER_MAJOR` | 10.1 Update 2 | | -| define |`CURAND_VER_MINOR` | 10.1 Update 2 | | -| define |`CURAND_VER_PATCH` | 10.1 Update 2 | | -| define |`CURAND_VER_BUILD` | 10.1 Update 2 | | -| define |`CURAND_VERSION` | 10.1 Update 2 | | -| enum |***`curandStatus`*** | |***`hiprandStatus`*** | -| enum |***`curandStatus_t`*** | |***`hiprandStatus_t`*** | -| 0 |*`CURAND_STATUS_SUCCESS`* | |*`HIPRAND_STATUS_SUCCESS`* | -| 100 |*`CURAND_STATUS_VERSION_MISMATCH`* | |*`HIPRAND_STATUS_VERSION_MISMATCH`* | -| 101 |*`CURAND_STATUS_NOT_INITIALIZED`* | |*`HIPRAND_STATUS_NOT_INITIALIZED`* | -| 102 |*`CURAND_STATUS_ALLOCATION_FAILED`* | |*`HIPRAND_STATUS_ALLOCATION_FAILED`* | -| 103 |*`CURAND_STATUS_TYPE_ERROR`* | |*`HIPRAND_STATUS_TYPE_ERROR`* | -| 104 |*`CURAND_STATUS_OUT_OF_RANGE`* | |*`HIPRAND_STATUS_OUT_OF_RANGE`* | -| 105 |*`CURAND_STATUS_LENGTH_NOT_MULTIPLE`* | |*`HIPRAND_STATUS_LENGTH_NOT_MULTIPLE`* | -| 106 |*`CURAND_STATUS_DOUBLE_PRECISION_REQUIRED`* | |*`HIPRAND_STATUS_DOUBLE_PRECISION_REQUIRED`* | -| 201 |*`CURAND_STATUS_LAUNCH_FAILURE`* | |*`HIPRAND_STATUS_LAUNCH_FAILURE`* | -| 202 |*`CURAND_STATUS_PREEXISTING_FAILURE`* | |*`HIPRAND_STATUS_PREEXISTING_FAILURE`* | -| 203 |*`CURAND_STATUS_INITIALIZATION_FAILED`* | |*`HIPRAND_STATUS_INITIALIZATION_FAILED`* | -| 204 |*`CURAND_STATUS_ARCH_MISMATCH`* | |*`HIPRAND_STATUS_ARCH_MISMATCH`* | -| 999 |*`CURAND_STATUS_INTERNAL_ERROR`* | |*`HIPRAND_STATUS_INTERNAL_ERROR`* | -| enum |***`curandRngType`*** | |***`hiprandRngType`*** | -| enum |***`curandRngType_t`*** | |***`hiprandRngType_t`*** | -| 0 |*`CURAND_RNG_TEST`* | |*`HIPRAND_RNG_TEST`* | -| 100 |*`CURAND_RNG_PSEUDO_DEFAULT`* | |*`HIPRAND_RNG_PSEUDO_DEFAULT`* | 400 | -| 101 |*`CURAND_RNG_PSEUDO_XORWOW`* | |*`HIPRAND_RNG_PSEUDO_XORWOW`* | 401 | -| 121 |*`CURAND_RNG_PSEUDO_MRG32K3A`* | |*`HIPRAND_RNG_PSEUDO_MRG32K3A`* | 402 | -| 141 |*`CURAND_RNG_PSEUDO_MTGP32`* | |*`HIPRAND_RNG_PSEUDO_MTGP32`* | 403 | -| 142 |*`CURAND_RNG_PSEUDO_MT19937`* | |*`HIPRAND_RNG_PSEUDO_MT19937`* | 404 | -| 161 |*`CURAND_RNG_PSEUDO_PHILOX4_32_10`* | |*`HIPRAND_RNG_PSEUDO_PHILOX4_32_10`* | 405 | -| 200 |*`CURAND_RNG_QUASI_DEFAULT`* | |*`HIPRAND_RNG_QUASI_DEFAULT`* | 500 | -| 201 |*`CURAND_RNG_QUASI_SOBOL32`* | |*`HIPRAND_RNG_QUASI_SOBOL32`* | 501 | -| 202 |*`CURAND_RNG_QUASI_SCRAMBLED_SOBOL32`* | |*`HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32`* | 502 | -| 203 |*`CURAND_RNG_QUASI_SOBOL64`* | |*`HIPRAND_RNG_QUASI_SOBOL64`* | 503 | -| 204 |*`CURAND_RNG_QUASI_SCRAMBLED_SOBOL64`* | |*`HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64`* | 504 | -| enum |***`curandOrdering`*** | | | -| enum |***`curandOrdering_t`*** | | | -| 100 |*`CURAND_ORDERING_PSEUDO_BEST`* | | | -| 101 |*`CURAND_ORDERING_PSEUDO_DEFAULT`* | | | -| 102 |*`CURAND_ORDERING_PSEUDO_SEEDED`* | | | -| 201 |*`CURAND_ORDERING_QUASI_DEFAULT`* | | | -| enum |***`curandDirectionVectorSet`*** | | | -| enum |***`curandDirectionVectorSet_t`*** | | | -| 101 |*`CURAND_DIRECTION_VECTORS_32_JOEKUO6`* | | | -| 102 |*`CURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6`* | | | -| 103 |*`CURAND_DIRECTION_VECTORS_64_JOEKUO6`* | | | -| 104 |*`CURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6`* | | | -| uint | `curandDirectionVectors32_t` | | `hiprandDirectionVectors32_t` | -| uint | `curandDirectionVectors64_t` | | | -| struct | `curandGenerator_st` | | `hiprandGenerator_st` | -| struct* | `curandGenerator_t` | | `hiprandGenerator_t` | -| double | `curandDistribution_st` | | | -| double | `curandHistogramM2V_st` | | | -| double* | `curandDistribution_t` | | | -| double* | `curandHistogramM2V_t` | | | -| struct | `curandDistributionShift_st` | | | -| struct* | `curandDistributionShift_t` | | | -| struct | `curandDistributionM2Shift_st` | | | -| struct* | `curandDistributionM2Shift_t` | | | -| struct | `curandHistogramM2_st` | | | -| struct* | `curandHistogramM2_t` | | | -| uint | `curandHistogramM2K_st` | | | -| uint* | `curandHistogramM2K_t` | | | -| struct | `curandDiscreteDistribution_st` | | `hiprandDiscreteDistribution_st` | -| struct* | `curandDiscreteDistribution_t` | | `hiprandDiscreteDistribution_t` | -| enum |***`curandMethod`*** | | | -| enum |***`curandMethod_t`*** | | | -| 0 |*`CURAND_CHOOSE_BEST`* | | | -| 1 |*`CURAND_ITR`* | | | -| 2 |*`CURAND_KNUTH`* | | | -| 3 |*`CURAND_HITR`* | | | -| 4 |*`CURAND_M1`* | | | -| 5 |*`CURAND_M2`* | | | -| 6 |*`CURAND_BINARY_SEARCH`* | | | -| 7 |*`CURAND_DISCRETE_GAUSS`* | | | -| 8 |*`CURAND_REJECTION`* | | | -| 9 |*`CURAND_DEVICE_API`* | | | -| 10 |*`CURAND_FAST_REJECTION`* | | | -| 11 |*`CURAND_3RD`* | | | -| 12 |*`CURAND_DEFINITION`* | | | -| 13 |*`CURAND_POISSON`* | | | -| struct | `curandStateMtgp32` | | `hiprandStateMtgp32` | -| typedef | `curandStateMtgp32_t` | | `hiprandStateMtgp32_t` | -| struct | `curandStateScrambledSobol64` | | | -| typedef | `curandStateScrambledSobol64_t` | | | -| struct | `curandStateSobol64` | | | -| typedef | `curandStateSobol64_t` | | | -| struct | `curandStateScrambledSobol32` | | | -| typedef | `curandStateScrambledSobol32_t` | | | -| struct | `curandStateSobol32` | | `hiprandStateSobol32` | -| typedef | `curandStateSobol32_t` | | `hiprandStateSobol32_t` | -| struct | `curandStateMRG32k3a` | | `hiprandStateMRG32k3a` | -| typedef | `curandStateMRG32k3a_t` | | `hiprandStateMRG32k3a_t` | -| struct | `curandStatePhilox4_32_10` | | `hiprandStatePhilox4_32_10` | -| typedef | `curandStatePhilox4_32_10_t` | | `hiprandStatePhilox4_32_10_t` | -| struct | `curandStateXORWOW` | | `hiprandStateXORWOW` | -| typedef | `curandStateXORWOW_t` | | `hiprandStateXORWOW_t` | -| struct | `curandState` | | `hiprandState` | -| typedef | `curandState_t` | | `hiprandState_t` | - -## **2. Host API Functions** - -| **CUDA** | **HIP** | -|-----------------------------------------------------------|--------------------------------------------| -| `curandCreateGenerator` | `hiprandCreateGenerator` | -| `curandCreateGeneratorHost` | `hiprandCreateGeneratorHost` | -| `curandCreatePoissonDistribution` | `hiprandCreatePoissonDistribution` | -| `curandDestroyDistribution` | `hiprandDestroyDistribution` | -| `curandDestroyGenerator` | `hiprandDestroyGenerator` | -| `curandGenerate` | `hiprandGenerate` | -| `curandGenerateLogNormal` | `hiprandGenerateLogNormal` | -| `curandGenerateLogNormalDouble` | `hiprandGenerateLogNormalDouble` | -| `curandGenerateLongLong` | | -| `curandGenerateNormal` | `hiprandGenerateNormal` | -| `curandGenerateNormalDouble` | `hiprandGenerateNormalDouble` | -| `curandGeneratePoisson` | `hiprandGeneratePoisson` | -| `curandGenerateSeeds` | `hiprandGenerateSeeds` | -| `curandGenerateUniform` | `hiprandGenerateUniform` | -| `curandGenerateUniformDouble` | `hiprandGenerateUniformDouble` | -| `curandGetDirectionVectors32` | | -| `curandGetDirectionVectors64` | | -| `curandGetProperty` | | -| `curandGetScrambleConstants32` | | -| `curandGetScrambleConstants64` | | -| `curandGetVersion` | `hiprandGetVersion` | -| `curandSetGeneratorOffset` | `hiprandSetGeneratorOffset` | -| `curandSetGeneratorOrdering` | | -| `curandSetPseudoRandomGeneratorSeed` | `hiprandSetPseudoRandomGeneratorSeed` | -| `curandSetQuasiRandomGeneratorDimensions` | `hiprandSetQuasiRandomGeneratorDimensions` | -| `curandSetStream` | `hiprandSetStream` | -| `curandMakeMTGP32Constants` | `hiprandMakeMTGP32Constants` | -| `curandMakeMTGP32KernelState` | `hiprandMakeMTGP32KernelState` | - -## **3. Device API Functions** - -| **CUDA** | **HIP** | -|-----------------------------------------------------------|--------------------------------------------| -| `curand` | `hiprand` | -| `curand_init` | `hiprand_init` | -| `curand_log_normal` | `hiprand_log_normal` | -| `curand_log_normal_double` | `hiprand_log_normal_double` | -| `curand_log_normal2` | `hiprand_log_normal2` | -| `curand_log_normal2_double` | `hiprand_log_normal2_double` | -| `curand_log_normal4` | `hiprand_log_normal4` | -| `curand_log_normal4_double` | `hiprand_log_normal4_double` | -| `curand_mtgp32_single` | | -| `curand_mtgp32_single_specific` | | -| `curand_mtgp32_specific` | | -| `curand_normal` | `hiprand_normal` | -| `curand_normal_double` | `hiprand_normal_double` | -| `curand_normal2` | `hiprand_normal2` | -| `curand_normal2_double` | `hiprand_normal2_double` | -| `curand_normal4` | `hiprand_normal4` | -| `curand_normal4_double` | `hiprand_normal4_double` | -| `curand_uniform` | `hiprand_uniform` | -| `curand_uniform_double` | `hiprand_uniform_double` | -| `curand_uniform2_double` | `hiprand_uniform2_double` | -| `curand_uniform4` | `hiprand_uniform4` | -| `curand_uniform4_double` | `hiprand_uniform4_double` | -| `curand_discrete` | `hiprand_discrete` | -| `curand_discrete4` | `hiprand_discrete4` | -| `curand_poisson` | `hiprand_poisson` | -| `curand_poisson4` | `hiprand_poisson4` | -| `curand_Philox4x32_10` | | -| `skipahead` | `skipahead` | -| `skipahead_sequence` | `skipahead_sequence` | -| `skipahead_subsequence` | `skipahead_subsequence` | diff --git a/docs/markdown/CUSPARSE_API_supported_by_HIP.md b/docs/markdown/CUSPARSE_API_supported_by_HIP.md deleted file mode 100644 index 2c0a1bea9d..0000000000 --- a/docs/markdown/CUSPARSE_API_supported_by_HIP.md +++ /dev/null @@ -1,797 +0,0 @@ -# CUSPARSE API supported by HIP - -## **1. cuSPARSE Data types** - -| **type** | **CUDA** |**CUDA version\***| **HIP** | -|-------------:|---------------------------------------------------------------|:-----------------|------------------------------------------------------------| -| define |`CUSPARSE_VER_MAJOR` | 10.1 Update 2 | | -| define |`CUSPARSE_VER_MINOR` | 10.1 Update 2 | | -| define |`CUSPARSE_VER_PATCH` | 10.1 Update 2 | | -| define |`CUSPARSE_VER_BUILD` | 10.1 Update 2 | | -| define |`CUSPARSE_VERSION` | 10.1 Update 2 | | -| enum |***`cusparseAction_t`*** | |***`hipsparseAction_t`*** | -| 0 |*`CUSPARSE_ACTION_SYMBOLIC`* | |*`HIPSPARSE_ACTION_SYMBOLIC`* | -| 1 |*`CUSPARSE_ACTION_NUMERIC`* | |*`HIPSPARSE_ACTION_NUMERIC`* | -| enum |***`cusparseDirection_t`*** | |***`hipsparseDirection_t`*** | -| 0 |*`CUSPARSE_DIRECTION_ROW`* | |*`HIPSPARSE_DIRECTION_ROW`* | -| 1 |*`CUSPARSE_DIRECTION_COLUMN`* | |*`HIPSPARSE_DIRECTION_COLUMN`* | -| enum |***`cusparseHybPartition_t`*** | |***`hipsparseHybPartition_t`*** | -| 0 |*`CUSPARSE_HYB_PARTITION_AUTO`* | |*`HIPSPARSE_HYB_PARTITION_AUTO`* | -| 1 |*`CUSPARSE_HYB_PARTITION_USER`* | |*`HIPSPARSE_HYB_PARTITION_USER`* | -| 2 |*`CUSPARSE_HYB_PARTITION_MAX`* | |*`HIPSPARSE_HYB_PARTITION_MAX`* | -| enum |***`cusparseDiagType_t`*** | |***`hipsparseDiagType_t`*** | -| 0 |*`CUSPARSE_DIAG_TYPE_NON_UNIT`* | |*`HIPSPARSE_DIAG_TYPE_NON_UNIT`* | -| 1 |*`CUSPARSE_DIAG_TYPE_UNIT`* | |*`HIPSPARSE_DIAG_TYPE_UNIT`* | -| enum |***`cusparseFillMode_t`*** | |***`hipsparseFillMode_t`*** | -| 0 |*`CUSPARSE_FILL_MODE_LOWER`* | |*`HIPSPARSE_FILL_MODE_LOWER`* | -| 1 |*`CUSPARSE_FILL_MODE_UPPER`* | |*`HIPSPARSE_FILL_MODE_UPPER`* | -| enum |***`cusparseIndexBase_t`*** | |***`hipsparseIndexBase_t`*** | -| 0 |*`CUSPARSE_INDEX_BASE_ZERO`* | |*`HIPSPARSE_INDEX_BASE_ZERO`* | -| 1 |*`CUSPARSE_INDEX_BASE_ONE`* | |*`HIPSPARSE_INDEX_BASE_ONE`* | -| enum |***`cusparseMatrixType_t`*** | |***`hipsparseMatrixType_t`*** | -| 0 |*`CUSPARSE_MATRIX_TYPE_GENERAL`* | |*`HIPSPARSE_MATRIX_TYPE_GENERAL`* | -| 1 |*`CUSPARSE_MATRIX_TYPE_SYMMETRIC`* | |*`HIPSPARSE_MATRIX_TYPE_SYMMETRIC`* | -| 2 |*`CUSPARSE_MATRIX_TYPE_HERMITIAN`* | |*`HIPSPARSE_MATRIX_TYPE_HERMITIAN`* | -| 3 |*`CUSPARSE_MATRIX_TYPE_TRIANGULAR`* | |*`HIPSPARSE_MATRIX_TYPE_TRIANGULAR`* | -| enum |***`cusparseOperation_t`*** | |***`hipsparseOperation_t`*** | -| 0 |*`CUSPARSE_OPERATION_NON_TRANSPOSE`* | |*`HIPSPARSE_OPERATION_NON_TRANSPOSE`* | -| 1 |*`CUSPARSE_OPERATION_TRANSPOSE`* | |*`HIPSPARSE_OPERATION_TRANSPOSE`* | -| 2 |*`CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE`* | |*`HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE`* | -| enum |***`cusparsePointerMode_t`*** | |***`hipsparsePointerMode_t`*** | -| 0 |*`CUSPARSE_POINTER_MODE_HOST`* | |*`HIPSPARSE_POINTER_MODE_HOST`* | -| 1 |*`CUSPARSE_POINTER_MODE_DEVICE`* | |*`HIPSPARSE_POINTER_MODE_DEVICE`* | -| enum |***`cusparseAlgMode_t`*** | 8.0 | | -| 0 |*`CUSPARSE_ALG0`* | 8.0 | | -| 1 |*`CUSPARSE_ALG1`* | 8.0 | | -| 0 |*`CUSPARSE_ALG_NAIVE`* | 9.2 | | -| 1 |*`CUSPARSE_ALG_MERGE_PATH`* | 9.2 | | -| enum |***`cusparseSolvePolicy_t`*** | |***`hipsparseSolvePolicy_t`*** | -| 0 |*`CUSPARSE_SOLVE_POLICY_NO_LEVEL`* | |*`HIPSPARSE_SOLVE_POLICY_NO_LEVEL`* | -| 1 |*`CUSPARSE_SOLVE_POLICY_USE_LEVEL`* | |*`HIPSPARSE_SOLVE_POLICY_USE_LEVEL`* | -| enum |***`cusparseStatus_t`*** | |***`hipsparseMatrixType_t`*** | -| 0 |*`CUSPARSE_STATUS_SUCCESS`* | |*`HIPSPARSE_STATUS_SUCCESS`* | -| 1 |*`CUSPARSE_STATUS_NOT_INITIALIZED`* | |*`HIPSPARSE_STATUS_NOT_INITIALIZED`* | -| 2 |*`CUSPARSE_STATUS_ALLOC_FAILED`* | |*`HIPSPARSE_STATUS_ALLOC_FAILED`* | -| 3 |*`CUSPARSE_STATUS_INVALID_VALUE`* | |*`HIPSPARSE_STATUS_INVALID_VALUE`* | -| 4 |*`CUSPARSE_STATUS_ARCH_MISMATCH`* | |*`HIPSPARSE_STATUS_ARCH_MISMATCH`* | -| 5 |*`CUSPARSE_STATUS_MAPPING_ERROR`* | |*`HIPSPARSE_STATUS_MAPPING_ERROR`* | -| 6 |*`CUSPARSE_STATUS_EXECUTION_FAILED`* | |*`HIPSPARSE_STATUS_EXECUTION_FAILED`* | -| 7 |*`CUSPARSE_STATUS_INTERNAL_ERROR`* | |*`HIPSPARSE_STATUS_INTERNAL_ERROR`* | -| 8 |*`CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED`* | |*`HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED`* | -| 9 |*`CUSPARSE_STATUS_ZERO_PIVOT`* | |*`HIPSPARSE_STATUS_ZERO_PIVOT`* | -| struct |`cusparseContext` | | | -| typedef |`cusparseHandle_t` | |`hipsparseHandle_t` | -| struct |`cusparseHybMat` | | | -| typedef |`cusparseHybMat_t` | |`hipsparseHybMat_t` | -| struct |`cusparseMatDescr` | | | -| typedef |`cusparseMatDescr_t` | |`hipsparseMatDescr_t` | -| struct |`cusparseSolveAnalysisInfo` | | | -| typedef |`cusparseSolveAnalysisInfo_t` | | | -| struct |`csrsv2Info` | | | -| typedef |`csrsv2Info_t` | |`csrsv2Info_t` | -| struct |`csrsm2Info` | 9.2 |`csrsm2Info` | -| typedef |`csrsm2Info_t` | |`csrsm2Info_t` | -| struct |`bsrsv2Info` | | | -| typedef |`bsrsv2Info_t` | | | -| struct |`bsrsm2Info` | | | -| typedef |`bsrsm2Info_t` | | | -| struct |`bsric02Info` | | | -| typedef |`bsric02Info_t` | | | -| struct |`csrilu02Info` | | | -| typedef |`csrilu02Info_t` | |`csrilu02Info_t` | -| struct |`bsrilu02Info` | | | -| typedef |`bsrilu02Info_t` | | | -| struct |`csru2csrInfo` | | | -| typedef |`csru2csrInfo_t` | | | -| struct |`csrgemm2Info` | |`csrgemm2Info` | -| typedef |`csrgemm2Info_t` | |`csrgemm2Info_t` | -| struct |`cusparseColorInfo` | | | -| typedef |`cusparseColorInfo_t` | | | -| struct |`pruneInfo` | 9.0 | | -| typedef |`pruneInfo_t` | 9.0 | | -| enum |***`cusparseCsr2CscAlg_t`*** | 10.1 | | -| 1 |*`CUSPARSE_CSR2CSC_ALG1`* | 10.1 | | -| 2 |*`CUSPARSE_CSR2CSC_ALG2`* | 10.1 | | -| enum |***`cusparseFormat_t`*** | 10.1 | | -| 1 |*`CUSPARSE_FORMAT_CSR`* | 10.1 | | -| 2 |*`CUSPARSE_FORMAT_CSC`* | 10.1 | | -| 3 |*`CUSPARSE_FORMAT_COO`* | 10.1 | | -| 4 |*`CUSPARSE_FORMAT_COO_AOS`* | 10.1 | | -| enum |***`cusparseOrder_t`*** | 10.1 | | -| 1 |*`CUSPARSE_ORDER_COL`* | 10.1 | | -| 2 |*`CUSPARSE_ORDER_ROW`* | 10.1 | | -| enum |***`cusparseSpMVAlg_t`*** | 10.1 | | -| 0 |*`CUSPARSE_MV_ALG_DEFAULT`* | 10.1 | | -| 1 |*`CUSPARSE_COOMV_ALG`* | 10.1 | | -| 2 |*`CUSPARSE_CSRMV_ALG1`* | 10.1 | | -| 3 |*`CUSPARSE_CSRMV_ALG2`* | 10.1 | | -| enum |***`cusparseSpMMAlg_t`*** | 10.1 | | -| 0 |*`CUSPARSE_MM_ALG_DEFAULT`* | 10.1 | | -| 1 |*`CUSPARSE_COOMM_ALG1`* | 10.1 | | -| 2 |*`CUSPARSE_COOMM_ALG2`* | 10.1 | | -| 3 |*`CUSPARSE_COOMM_ALG3`* | 10.1 | | -| 4 |*`CUSPARSE_CSRMM_ALG1`* | 10.1 | | -| enum |***`cusparseIndexType_t`*** | 10.1 | | -| 1 |*`CUSPARSE_INDEX_16U`* | 10.1 | | -| 2 |*`CUSPARSE_INDEX_32I`* | 10.1 | | -| 3 |*`CUSPARSE_INDEX_64I`* | 10.1 | | -| struct |`cusparseSpMatDescr` | 10.1 | | -| typedef |`cusparseSpMatDescr_t` | 10.1 | | -| struct |`cusparseDnMatDescr` | 10.1 | | -| typedef |`cusparseDnMatDescr_t` | 10.1 | | -| struct |`cusparseSpVecDescr` | 10.1 | | -| typedef |`cusparseSpVecDescr_t` | 10.1 | | -| struct |`cusparseDnVecDescr` | 10.1 | | -| typedef |`cusparseDnVecDescr_t` | 10.1 | | - -## **2. cuSPARSE Helper Function Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseCreate` |`hipsparseCreate` | -|`cusparseCreateSolveAnalysisInfo` | | -|`cusparseCreateHybMat` |`hipsparseCreateHybMat` | -|`cusparseCreateMatDescr` |`hipsparseCreateMatDescr` | -|`cusparseDestroy` |`hipsparseDestroy` | -|`cusparseDestroySolveAnalysisInfo` | | -|`cusparseDestroyHybMat` |`hipsparseDestroyHybMat` | -|`cusparseDestroyMatDescr` |`hipsparseDestroyMatDescr` | -|`cusparseGetLevelInfo` | | -|`cusparseGetMatDiagType` |`hipsparseGetMatDiagType` | -|`cusparseGetMatFillMode` |`hipsparseGetMatFillMode` | -|`cusparseGetMatIndexBase` |`hipsparseGetMatIndexBase` | -|`cusparseGetMatType` |`hipsparseGetMatType` | -|`cusparseGetPointerMode` |`hipsparseGetPointerMode` | -|`cusparseGetVersion` |`hipsparseGetVersion` | -|`cusparseSetMatDiagType` |`hipsparseSetMatDiagType` | -|`cusparseSetMatFillMode` |`hipsparseSetMatFillMode` | -|`cusparseSetMatType` |`hipsparseSetMatType` | -|`cusparseSetPointerMode` |`hipsparseSetPointerMode` | -|`cusparseSetStream` |`hipsparseSetStream` | -|`cusparseGetStream` |`hipsparseGetStream` | 8.0 | -|`cusparseCreateCsrsv2Info` |`hipsparseCreateCsrsv2Info` | -|`cusparseDestroyCsrsv2Info` |`hipsparseDestroyCsrsv2Info` | -|`cusparseCreateCsrsm2Info` |`hipsparseCreateCsrsm2Info` | 9.2 | -|`cusparseDestroyCsrsm2Info` |`hipsparseDestroyCsrsm2Info` | 9.2 | -|`cusparseCreateCsric02Info` | | -|`cusparseDestroyCsric02Info` | | -|`cusparseCreateCsrilu02Info` |`hipsparseCreateCsrilu02Info` | -|`cusparseDestroyCsrilu02Info` |`hipsparseDestroyCsrilu02Info` | -|`cusparseCreateBsrsv2Info` | | -|`cusparseDestroyBsrsv2Info` | | -|`cusparseCreateBsrsm2Info` | | -|`cusparseDestroyBsrsm2Info` | | -|`cusparseCreateBsric02Info` | | -|`cusparseDestroyBsric02Info` | | -|`cusparseCreateBsrilu02Info` | | -|`cusparseDestroyBsrilu02Info` | | -|`cusparseCreateCsrgemm2Info` |`hipsparseCreateCsrgemm2Info` | -|`cusparseDestroyCsrgemm2Info` |`hipsparseDestroyCsrgemm2Info` | -|`cusparseCreatePruneInfo` | | 9.0 | -|`cusparseDestroyPruneInfo` | | 9.0 | - -## **3. cuSPARSE Level 1 Function Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSaxpyi` |`hipsparseSaxpyi` | -|`cusparseDaxpyi` |`hipsparseDaxpyi` | -|`cusparseCaxpyi` |`hipsparseCaxpyi` | -|`cusparseZaxpyi` |`hipsparseZaxpyi` | -|`cusparseSdoti` |`hipsparseSdoti` | -|`cusparseDdoti` |`hipsparseDdoti` | -|`cusparseCdoti` |`hipsparseCdoti` | -|`cusparseZdoti` |`hipsparseZdoti` | -|`cusparseCdotci` |`hipsparseCdotci` | -|`cusparseZdotci` |`hipsparseZdotci` | -|`cusparseSgthr` |`hipsparseSgthr` | -|`cusparseDgthr` |`hipsparseDgthr` | -|`cusparseCgthr` |`hipsparseCgthr` | -|`cusparseZgthr` |`hipsparseZgthr` | -|`cusparseSgthrz` |`hipsparseSgthrz` | -|`cusparseDgthrz` |`hipsparseDgthrz` | -|`cusparseCgthrz` |`hipsparseCgthrz` | -|`cusparseZgthrz` |`hipsparseZgthrz` | -|`cusparseSroti` |`hipsparseSroti` | -|`cusparseDroti` |`hipsparseDroti` | -|`cusparseSsctr` |`hipsparseSsctr` | -|`cusparseDsctr` |`hipsparseDsctr` | -|`cusparseCsctr` |`hipsparseCsctr` | -|`cusparseZsctr` |`hipsparseZsctr` | - -## **4. cuSPARSE Level 2 Function Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSbsrmv` |`hipsparseSbsrmv` | -|`cusparseDbsrmv` |`hipsparseDbsrmv` | -|`cusparseCbsrmv` |`hipsparseCbsrmv` | -|`cusparseZbsrmv` |`hipsparseZbsrmv` | -|`cusparseSbsrxmv` | | -|`cusparseDbsrxmv` | | -|`cusparseCbsrxmv` | | -|`cusparseZbsrxmv` | | -|`cusparseScsrmv` |`hipsparseScsrmv` | -|`cusparseDcsrmv` |`hipsparseDcsrmv` | -|`cusparseCcsrmv` |`hipsparseCcsrmv` | -|`cusparseZcsrmv` |`hipsparseZcsrmv` | -|`cusparseCsrmvEx` | | 8.0 | -|`cusparseCsrmvEx_bufferSize` | | 8.0 | -|`cusparseScsrmv_mp` | | 8.0 | -|`cusparseDcsrmv_mp` | | 8.0 | -|`cusparseCcsrmv_mp` | | 8.0 | -|`cusparseZcsrmv_mp` | | 8.0 | -|`cusparseSgemvi` | | 7.5 | -|`cusparseDgemvi` | | 7.5 | -|`cusparseCgemvi` | | 7.5 | -|`cusparseZgemvi` | | 7.5 | -|`cusparseSgemvi_bufferSize` | | 7.5 | -|`cusparseDgemvi_bufferSize` | | 7.5 | -|`cusparseCgemvi_bufferSize` | | 7.5 | -|`cusparseZgemvi_bufferSize` | | 7.5 | -|`cusparseSbsrsv2_bufferSize` | | -|`cusparseSbsrsv2_bufferSizeExt` | | -|`cusparseDbsrsv2_bufferSize` | | -|`cusparseDbsrsv2_bufferSizeExt` | | -|`cusparseCbsrsv2_bufferSize` | | -|`cusparseCbsrsv2_bufferSizeExt` | | -|`cusparseZbsrsv2_bufferSize` | | -|`cusparseZbsrsv2_bufferSizeExt` | | -|`cusparseSbsrsv2_analysis` | | -|`cusparseDbsrsv2_analysis` | | -|`cusparseCbsrsv2_analysis` | | -|`cusparseZbsrsv2_analysis` | | -|`cusparseXbsrsv2_zeroPivot` | | -|`cusparseSbsrsv2_solve | | -|`cusparseDbsrsv2_solve | | -|`cusparseCbsrsv2_solve | | -|`cusparseZbsrsv2_solve | | -|`cusparseScsrsv_analysis` | | -|`cusparseDcsrsv_analysis` | | -|`cusparseCcsrsv_analysis` | | -|`cusparseZcsrsv_analysis` | | -|`cusparseCsrsv_analysisEx` | | 8.0 | -|`cusparseScsrsv_solve` | | -|`cusparseDcsrsv_solve` | | -|`cusparseCcsrsv_solve` | | -|`cusparseZcsrsv_solve` | | -|`cusparseCsrsv_solveEx` | | 8.0 | -|`cusparseScsrsv2_bufferSize` |`hipsparseScsrsv2_bufferSize` | -|`cusparseScsrsv2_bufferSizeExt` |`hipsparseScsrsv2_bufferSizeExt` | -|`cusparseDcsrsv2_bufferSize` |`hipsparseDcsrsv2_bufferSize` | -|`cusparseDcsrsv2_bufferSizeExt` |`hipsparseDcsrsv2_bufferSizeExt` | -|`cusparseCcsrsv2_bufferSize` |`hipsparseCcsrsv2_bufferSize` | -|`cusparseCcsrsv2_bufferSizeExt` |`hipsparseCcsrsv2_bufferSizeExt` | -|`cusparseZcsrsv2_bufferSize` |`hipsparseZcsrsv2_bufferSize` | -|`cusparseZcsrsv2_bufferSizeExt` |`hipsparseZcsrsv2_bufferSizeExt` | -|`cusparseScsrsv2_analysis` |`hipsparseScsrsv2_analysis` | -|`cusparseDcsrsv2_analysis` |`hipsparseDcsrsv2_analysis` | -|`cusparseCcsrsv2_analysis` |`hipsparseCcsrsv2_analysis` | -|`cusparseZcsrsv2_analysis` |`hipsparseZcsrsv2_analysis` | -|`cusparseScsrsv2_solve` |`hipsparseScsrsv2_solve` | -|`cusparseDcsrsv2_solve` |`hipsparseDcsrsv2_solve` | -|`cusparseCcsrsv2_solve` |`hipsparseCcsrsv2_solve` | -|`cusparseZcsrsv2_solve` |`hipsparseZcsrsv2_solve` | -|`cusparseXcsrsv2_zeroPivot` |`hipsparseXcsrsv2_zeroPivot` | -|`cusparseShybmv` |`hipsparseShybmv` | -|`cusparseDhybmv` |`hipsparseDhybmv` | -|`cusparseChybmv` |`hipsparseChybmv` | -|`cusparseZhybmv` |`hipsparseZhybmv` | -|`cusparseShybsv_analysis` | | -|`cusparseDhybsv_analysis` | | -|`cusparseChybsv_analysis` | | -|`cusparseZhybsv_analysis` | | -|`cusparseShybsv_solve` | | -|`cusparseDhybsv_solve` | | -|`cusparseChybsv_solve` | | -|`cusparseZhybsv_solve` | | - -## **5. cuSPARSE Level 3 Function Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseScsrmm` |`hipsparseScsrmm` | -|`cusparseDcsrmm` |`hipsparseDcsrmm` | -|`cusparseCcsrmm` |`hipsparseCcsrmm` | -|`cusparseZcsrmm` |`hipsparseZcsrmm` | -|`cusparseScsrmm2` |`hipsparseScsrmm2` | -|`cusparseDcsrmm2` |`hipsparseDcsrmm2` | -|`cusparseCcsrmm2` |`hipsparseCcsrmm2` | -|`cusparseZcsrmm2` |`hipsparseZcsrmm2` | -|`cusparseScsrsm_analysis` | | -|`cusparseDcsrsm_analysis` | | -|`cusparseCcsrsm_analysis` | | -|`cusparseZcsrsm_analysis` | | -|`cusparseScsrsm_solve` | | -|`cusparseDcsrsm_solve` | | -|`cusparseCcsrsm_solve` | | -|`cusparseZcsrsm_solve` | | -|`cusparseScsrsm2_bufferSizeExt` |`hipsparseScsrsm2_bufferSizeExt` | 9.2 | -|`cusparseDcsrsm2_bufferSizeExt` |`hipsparseDcsrsm2_bufferSizeExt` | 9.2 | -|`cusparseCcsrsm2_bufferSizeExt` |`hipsparseCcsrsm2_bufferSizeExt` | 9.2 | -|`cusparseZcsrsm2_bufferSizeExt` |`hipsparseZcsrsm2_bufferSizeExt` | 9.2 | -|`cusparseScsrsm2_analysis` |`hipsparseScsrsm2_analysis` | 9.2 | -|`cusparseDcsrsm2_analysis` |`hipsparseDcsrsm2_analysis` | 9.2 | -|`cusparseCcsrsm2_analysis` |`hipsparseCcsrsm2_analysis` | 9.2 | -|`cusparseZcsrsm2_analysis` |`hipsparseZcsrsm2_analysis` | 9.2 | -|`cusparseScsrsm2_solve` |`hipsparseScsrsm2_solve` | 9.2 | -|`cusparseDcsrsm2_solve` |`hipsparseDcsrsm2_solve` | 9.2 | -|`cusparseCcsrsm2_solve` |`hipsparseCcsrsm2_solve` | 9.2 | -|`cusparseZcsrsm2_solve` |`hipsparseZcsrsm2_solve` | 9.2 | -|`cusparseXcsrsm2_zeroPivot` |`hipsparseXcsrsm2_zeroPivot` | 9.2 | -|`cusparseSbsrmm` | | -|`cusparseDbsrmm` | | -|`cusparseCbsrmm` | | -|`cusparseZbsrmm` | | -|`cusparseSbsrsm2_bufferSize` | | -|`cusparseSbsrsm2_bufferSizeExt` | | -|`cusparseDbsrsm2_bufferSize` | | -|`cusparseDbsrsm2_bufferSizeExt` | | -|`cusparseCbsrsm2_bufferSize` | | -|`cusparseCbsrsm2_bufferSizeExt` | | -|`cusparseZbsrsm2_bufferSize` | | -|`cusparseZbsrsm2_bufferSizeExt` | | -|`cusparseSbsrsm2_analysis` | | -|`cusparseDbsrsm2_analysis` | | -|`cusparseCbsrsm2_analysis` | | -|`cusparseZbsrsm2_analysis` | | -|`cusparseSbsrsm2_solve` | | -|`cusparseDbsrsm2_solve` | | -|`cusparseCbsrsm2_solve` | | -|`cusparseZbsrsm2_solve` | | -|`cusparseXbsrsm2_zeroPivot` | | -|`cusparseSgemmi` | | 8.0 | -|`cusparseDgemmi` | | 8.0 | -|`cusparseCgemmi` | | 8.0 | -|`cusparseZgemmi` | | 8.0 | - -## **6. cuSPARSE Extra Function Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseXcsrgeamNnz` |`hipsparseXcsrgeamNnz` | -|`cusparseScsrgeam` |`hipsparseScsrgeam` | -|`cusparseDcsrgeam` |`hipsparseDcsrgeam` | -|`cusparseCcsrgeam` |`hipsparseCcsrgeam` | -|`cusparseZcsrgeam` |`hipsparseZcsrgeam` | -|`cusparseXcsrgeam2Nnz` |`hipsparseXcsrgeam2Nnz` | 9.2 | -|`cusparseScsrgeam2` |`hipsparseScsrgeam2` | 9.2 | -|`cusparseDcsrgeam2` |`hipsparseDcsrgeam2` | 9.2 | -|`cusparseCcsrgeam2` |`hipsparseCcsrgeam2` | 9.2 | -|`cusparseZcsrgeam2` |`hipsparseZcsrgeam2` | 9.2 | -|`cusparseScsrgeam2_bufferSizeExt` |`hipsparseScsrgeam2_bufferSizeExt` | 9.2 | -|`cusparseDcsrgeam2_bufferSizeExt` |`hipsparseDcsrgeam2_bufferSizeExt` | 9.2 | -|`cusparseCcsrgeam2_bufferSizeExt` |`hipsparseCcsrgeam2_bufferSizeExt` | 9.2 | -|`cusparseZcsrgeam2_bufferSizeExt` |`hipsparseZcsrgeam2_bufferSizeExt` | 9.2 | -|`cusparseXcsrgemmNnz` |`hipsparseXcsrgemmNnz` | -|`cusparseScsrgemm` |`hipsparseScsrgemm` | -|`cusparseDcsrgemm` |`hipsparseDcsrgemm` | -|`cusparseCcsrgemm` |`hipsparseCcsrgemm` | -|`cusparseZcsrgemm` |`hipsparseZcsrgemm` | -|`cusparseXcsrgemm2Nnz` |`hipsparseXcsrgemm2Nnz` | -|`cusparseScsrgemm2` |`hipsparseScsrgemm2` | -|`cusparseDcsrgemm2` |`hipsparseDcsrgemm2` | -|`cusparseCcsrgemm2` |`hipsparseCcsrgemm2` | -|`cusparseZcsrgemm2` |`hipsparseZcsrgemm2` | -|`cusparseScsrgemm2_bufferSizeExt` |`hipsparseScsrgemm2_bufferSizeExt` | -|`cusparseDcsrgemm2_bufferSizeExt` |`hipsparseDcsrgemm2_bufferSizeExt` | -|`cusparseCcsrgemm2_bufferSizeExt` |`hipsparseCcsrgemm2_bufferSizeExt` | -|`cusparseZcsrgemm2_bufferSizeExt` |`hipsparseZcsrgemm2_bufferSizeExt` | - -## **7. cuSPARSE Preconditioners Reference** - -## ***7.1. Incomplete Cholesky Factorization: level 0*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseScsric0` | | -|`cusparseDcsric0` | | -|`cusparseCcsric0` | | -|`cusparseZcsric0` | | -|`cusparseScsric02_bufferSize` | | -|`cusparseScsric02_bufferSizeExt` | | -|`cusparseDcsric02_bufferSize` | | -|`cusparseDcsric02_bufferSizeExt` | | -|`cusparseCcsric02_bufferSize` | | -|`cusparseCcsric02_bufferSizeExt` | | -|`cusparseZcsric02_bufferSize` | | -|`cusparseZcsric02_bufferSizeExt` | | -|`cusparseScsric02_analysis` | | -|`cusparseDcsric02_analysis` | | -|`cusparseCcsric02_analysis` | | -|`cusparseZcsric02_analysis` | | -|`cusparseScsric02` | | -|`cusparseDcsric02` | | -|`cusparseCcsric02` | | -|`cusparseZcsric02` | | -|`cusparseXcsric02_zeroPivot` | | -|`cusparseSbsric02_bufferSize` | | -|`cusparseSbsric02_bufferSizeExt` | | -|`cusparseDbsric02_bufferSize` | | -|`cusparseDbsric02_bufferSizeExt` | | -|`cusparseCbsric02_bufferSize` | | -|`cusparseCbsric02_bufferSizeExt` | | -|`cusparseZbsric02_bufferSize` | | -|`cusparseZbsric02_bufferSizeExt` | | -|`cusparseSbsric02_analysis` | | -|`cusparseDbsric02_analysis` | | -|`cusparseCbsric02_analysis` | | -|`cusparseZbsric02_analysis` | | -|`cusparseSbsric02` | | -|`cusparseDbsric02` | | -|`cusparseCbsric02` | | -|`cusparseZbsric02` | | -|`cusparseXbsric02_zeroPivot` | | - -## ***7.2. Incomplete LU Factorization: level 0*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseScsrilu0` | | -|`cusparseDcsrilu0` | | -|`cusparseCcsrilu0` | | -|`cusparseZcsrilu0` | | -|`cusparseCsrilu0Ex` | | 8.0 | -|`cusparseScsrilu02_numericBoost` | | -|`cusparseDcsrilu02_numericBoost` | | -|`cusparseCcsrilu02_numericBoost` | | -|`cusparseZcsrilu02_numericBoost` | | -|`cusparseXcsrilu02_zeroPivot` |`hipsparseXcsrilu02_zeroPivot` | -|`cusparseScsrilu02_bufferSize` |`hipsparseScsrilu02_bufferSize` | -|`cusparseScsrilu02_bufferSizeExt` |`hipsparseScsrilu02_bufferSizeExt` | -|`cusparseDcsrilu02_bufferSize` |`hipsparseDcsrilu02_bufferSize` | -|`cusparseDcsrilu02_bufferSizeExt` |`hipsparseDcsrilu02_bufferSizeExt` | -|`cusparseCcsrilu02_bufferSize` |`hipsparseCcsrilu02_bufferSize` | -|`cusparseCcsrilu02_bufferSizeExt` |`hipsparseCcsrilu02_bufferSizeExt` | -|`cusparseZcsrilu02_bufferSize` |`hipsparseZcsrilu02_bufferSize` | -|`cusparseZcsrilu02_bufferSizeExt` |`hipsparseZcsrilu02_bufferSizeExt` | -|`cusparseScsrilu02_analysis` |`hipsparseScsrilu02_analysis` | -|`cusparseDcsrilu02_analysis` |`hipsparseDcsrilu02_analysis` | -|`cusparseCcsrilu02_analysis` |`hipsparseCcsrilu02_analysis` | -|`cusparseZcsrilu02_analysis` |`hipsparseZcsrilu02_analysis` | -|`cusparseScsrilu02` |`hipsparseScsrilu02` | -|`cusparseDcsrilu02` |`hipsparseDcsrilu02` | -|`cusparseCcsrilu02` |`hipsparseCcsrilu02` | -|`cusparseZcsrilu02` |`hipsparseZcsrilu02` | -|`cusparseXbsric02_zeroPivot` |`hipsparseXcsrilu02_zeroPivot` | -|`cusparseSbsrilu02_numericBoost` | | -|`cusparseDbsrilu02_numericBoost` | | -|`cusparseCbsrilu02_numericBoost` | | -|`cusparseZbsrilu02_numericBoost` | | -|`cusparseSbsrilu02_bufferSize` | | -|`cusparseSbsrilu02_bufferSizeExt` | | -|`cusparseDbsrilu02_bufferSize` | | -|`cusparseDbsrilu02_bufferSizeExt` | | -|`cusparseCbsrilu02_bufferSize` | | -|`cusparseCbsrilu02_bufferSizeExt` | | -|`cusparseZbsrilu02_bufferSize` | | -|`cusparseZbsrilu02_bufferSizeExt` | | -|`cusparseSbsrilu02_analysis` | | -|`cusparseDbsrilu02_analysis` | | -|`cusparseCbsrilu02_analysis` | | -|`cusparseZbsrilu02_analysis` | | -|`cusparseSbsrilu02` | | -|`cusparseDbsrilu02` | | -|`cusparseCbsrilu02` | | -|`cusparseZbsrilu02` | | -|`cusparseXbsrilu02_zeroPivot` | | - -## ***7.3. Tridiagonal Solve*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSgtsv` | | -|`cusparseDgtsv` | | -|`cusparseCgtsv` | | -|`cusparseZgtsv` | | -|`cusparseSgtsv_nopivot` | | -|`cusparseDgtsv_nopivot` | | -|`cusparseCgtsv_nopivot` | | -|`cusparseZgtsv_nopivot` | | -|`cusparseSgtsv2_bufferSizeExt` | | 9.0 | -|`cusparseDgtsv2_bufferSizeExt` | | 9.0 | -|`cusparseCgtsv2_bufferSizeExt` | | 9.0 | -|`cusparseZgtsv2_bufferSizeExt` | | 9.0 | -|`cusparseSgtsv2` | | 9.0 | -|`cusparseDgtsv2` | | 9.0 | -|`cusparseCgtsv2` | | 9.0 | -|`cusparseZgtsv2` | | 9.0 | -|`cusparseSgtsv2_nopivot_bufferSizeExt` | | 9.0 | -|`cusparseDgtsv2_nopivot_bufferSizeExt` | | 9.0 | -|`cusparseCgtsv2_nopivot_bufferSizeExt` | | 9.0 | -|`cusparseZgtsv2_nopivot_bufferSizeExt` | | 9.0 | -|`cusparseSgtsv2_nopivot` | | 9.0 | -|`cusparseDgtsv2_nopivot` | | 9.0 | -|`cusparseCgtsv2_nopivot` | | 9.0 | -|`cusparseZgtsv2_nopivot` | | 9.0 | - -## ***7.4. Batched Tridiagonal Solve*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSgtsvStridedBatch` | | -|`cusparseDgtsvStridedBatch` | | -|`cusparseCgtsvStridedBatch` | | -|`cusparseZgtsvStridedBatch` | | -|`cusparseSgtsv2StridedBatch_bufferSizeExt` | | 9.0 | -|`cusparseDgtsv2StridedBatch_bufferSizeExt` | | 9.0 | -|`cusparseCgtsv2StridedBatch_bufferSizeExt` | | 9.0 | -|`cusparseZgtsv2StridedBatch_bufferSizeExt` | | 9.0 | -|`cusparseSgtsv2StridedBatch` | | 9.0 | -|`cusparseDgtsv2StridedBatch` | | 9.0 | -|`cusparseCgtsv2StridedBatch` | | 9.0 | -|`cusparseZgtsv2StridedBatch` | | 9.0 | -|`cusparseSgtsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseDgtsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseCgtsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseZgtsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseSgtsvInterleavedBatch` | | 9.2 | -|`cusparseDgtsvInterleavedBatch` | | 9.2 | -|`cusparseCgtsvInterleavedBatch` | | 9.2 | -|`cusparseZgtsvInterleavedBatch` | | 9.2 | - -## ***7.5. Batched Pentadiagonal Solve*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSgpsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseDgpsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseCgpsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseZgpsvInterleavedBatch_bufferSizeExt` | | 9.2 | -|`cusparseSgpsvInterleavedBatch` | | 9.2 | -|`cusparseDgpsvInterleavedBatch` | | 9.2 | -|`cusparseCgpsvInterleavedBatch` | | 9.2 | -|`cusparseZgpsvInterleavedBatch` | | 9.2 | - -## **8. cuSPARSE Matrix Reorderings Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseScsrcolor` | | -|`cusparseDcsrcolor` | | -|`cusparseCcsrcolor` | | -|`cusparseZcsrcolor` | | - -## **9. cuSPARSE Format Conversion Reference** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSbsr2csr` | | -|`cusparseDbsr2csr` | | -|`cusparseCbsr2csr` | | -|`cusparseZbsr2csr` | | -|`cusparseSgebsr2gebsc_bufferSize` | | -|`cusparseSgebsr2gebsc_bufferSizeExt` | | -|`cusparseDgebsr2gebsc_bufferSize` | | -|`cusparseDgebsr2gebsc_bufferSizeExt` | | -|`cusparseCgebsr2gebsc_bufferSize` | | -|`cusparseCgebsr2gebsc_bufferSizeExt` | | -|`cusparseZgebsr2gebsc_bufferSize` | | -|`cusparseZgebsr2gebsc_bufferSizeExt` | | -|`cusparseSgebsr2gebsc` | | -|`cusparseDgebsr2gebsc` | | -|`cusparseCgebsr2gebsc` | | -|`cusparseZgebsr2gebsc` | | -|`cusparseSgebsr2gebsr_bufferSize` | | -|`cusparseSgebsr2gebsr_bufferSizeExt` | | -|`cusparseDgebsr2gebsr_bufferSize` | | -|`cusparseDgebsr2gebsr_bufferSizeExt` | | -|`cusparseCgebsr2gebsr_bufferSize` | | -|`cusparseCgebsr2gebsr_bufferSizeExt` | | -|`cusparseZgebsr2gebsr_bufferSize` | | -|`cusparseZgebsr2gebsr_bufferSizeExt` | | -|`cusparseXgebsr2gebsrNnz` | | -|`cusparseSgebsr2gebsr` | | -|`cusparseDgebsr2gebsr` | | -|`cusparseCgebsr2gebsr` | | -|`cusparseZgebsr2gebsr` | | -|`cusparseXgebsr2csr` | | -|`cusparseSgebsr2csr` | | -|`cusparseDgebsr2csr` | | -|`cusparseCgebsr2csr` | | -|`cusparseZgebsr2csr` | | -|`cusparseScsr2gebsr_bufferSize` | | -|`cusparseScsr2gebsr_bufferSizeExt` | | -|`cusparseDcsr2gebsr_bufferSize` | | -|`cusparseDcsr2gebsr_bufferSizeExt` | | -|`cusparseCcsr2gebsr_bufferSize` | | -|`cusparseCcsr2gebsr_bufferSizeExt` | | -|`cusparseZcsr2gebsr_bufferSize` | | -|`cusparseZcsr2gebsr_bufferSizeExt` | | -|`cusparseXcsr2gebsrNnz` | | -|`cusparseScsr2gebsr` | | -|`cusparseDcsr2gebsr` | | -|`cusparseCcsr2gebsr` | | -|`cusparseZcsr2gebsr` | | -|`cusparseXcoo2csr` |`hipsparseXcoo2csr` | -|`cusparseScsc2dense` | | -|`cusparseDcsc2dense` | | -|`cusparseCcsc2dense` | | -|`cusparseZcsc2dense` | | -|`cusparseScsc2hyb` | | -|`cusparseDcsc2hyb` | | -|`cusparseCcsc2hyb` | | -|`cusparseZcsc2hyb` | | -|`cusparseXcsr2bsrNnz` | | -|`cusparseScsr2bsr` | | -|`cusparseDcsr2bsr` | | -|`cusparseCcsr2bsr` | | -|`cusparseZcsr2bsr` | | -|`cusparseXcsr2coo` |`hipsparseXcsr2coo` | -|`cusparseScsr2csc` |`hipsparseScsr2csc` | -|`cusparseDcsr2csc` |`hipsparseDcsr2csc` | -|`cusparseCcsr2csc` |`hipsparseCcsr2csc` | -|`cusparseZcsr2csc` |`hipsparseZcsr2csc` | -|`cusparseCsr2cscEx` | | 8.0 | -|`cusparseCsr2cscEx2` | | 10.1 | -|`cusparseCsr2cscEx2_bufferSize` | | 10.1 | -|`cusparseScsr2dense` | | -|`cusparseDcsr2dense` | | -|`cusparseCcsr2dense` | | -|`cusparseZcsr2dense` | | -|`cusparseScsr2csr_compress` | | 8.0 | -|`cusparseDcsr2csr_compress` | | 8.0 | -|`cusparseCcsr2csr_compress` | | 8.0 | -|`cusparseZcsr2csr_compress` | | 8.0 | -|`cusparseScsr2hyb` |`hipsparseScsr2hyb` | -|`cusparseDcsr2hyb` |`hipsparseDcsr2hyb` | -|`cusparseCcsr2hyb` |`hipsparseCcsr2hyb` | -|`cusparseZcsr2hyb` |`hipsparseZcsr2hyb` | -|`cusparseSdense2csc` | | -|`cusparseDdense2csc` | | -|`cusparseCdense2csc` | | -|`cusparseZdense2csc` | | -|`cusparseSdense2csr` | | -|`cusparseDdense2csr` | | -|`cusparseCdense2csr` | | -|`cusparseZdense2csr` | | -|`cusparseSdense2hyb` | | -|`cusparseDdense2hyb` | | -|`cusparseCdense2hyb` | | -|`cusparseZdense2hyb` | | -|`cusparseShyb2csc` | | -|`cusparseDhyb2csc` | | -|`cusparseChyb2csc` | | -|`cusparseZhyb2csc` | | -|`cusparseShyb2csr` | | -|`cusparseDhyb2csr` | | -|`cusparseChyb2csr` | | -|`cusparseZhyb2csr` | | -|`cusparseShyb2dense` | | -|`cusparseDhyb2dense` | | -|`cusparseChyb2dense` | | -|`cusparseZhyb2dense` | | -|`cusparseSnnz` |`cusparseSnnz` | -|`cusparseDnnz` |`cusparseDnnz` | -|`cusparseCnnz` |`cusparseCnnz` | -|`cusparseZnnz` |`cusparseZnnz` | -|`cusparseCreateIdentityPermutation` |`hipsparseCreateIdentityPermutation` | -|`cusparseXcoosort_bufferSizeExt` |`hipsparseXcoosort_bufferSizeExt` | -|`cusparseXcoosortByRow` |`hipsparseXcoosortByRow` | -|`cusparseXcoosortByColumn` |`hipsparseXcoosortByColumn` | -|`cusparseXcsrsort_bufferSizeExt` |`hipsparseXcsrsort_bufferSizeExt` | -|`cusparseXcsrsort` |`hipsparseXcsrsort` | -|`cusparseXcscsort_bufferSizeExt` |`hipsparseXcscsort_bufferSizeExt` | -|`cusparseXcscsort` |`hipsparseXcscsort` | -|`cusparseCreateCsru2csrInfo` | | -|`cusparseDestroyCsru2csrInfo` | | -|`cusparseScsru2csr_bufferSizeExt` | | -|`cusparseDcsru2csr_bufferSizeExt` | | -|`cusparseCcsru2csr_bufferSizeExt` | | -|`cusparseZcsru2csr_bufferSizeExt` | | -|`cusparseScsru2csr` | | -|`cusparseDcsru2csr` | | -|`cusparseCcsru2csr` | | -|`cusparseZcsru2csr` | | -|`cusparseScsr2csru` | | -|`cusparseDcsr2csru` | | -|`cusparseCcsr2csru` | | -|`cusparseZcsr2csru` | | -|`cusparseHpruneDense2csr` | | 9.0 | -|`cusparseSpruneDense2csr` | | 9.0 | -|`cusparseDpruneDense2csr` | | 9.0 | -|`cusparseHpruneDense2csr_bufferSizeExt` | | 9.0 | -|`cusparseSpruneDense2csr_bufferSizeExt` | | 9.0 | -|`cusparseDpruneDense2csr_bufferSizeExt` | | 9.0 | -|`cusparseHpruneDense2csrNnz` | | 9.0 | -|`cusparseSpruneDense2csrNnz` | | 9.0 | -|`cusparseDpruneDense2csrNnz` | | 9.0 | -|`cusparseHpruneCsr2csr` | | 9.0 | -|`cusparseSpruneCsr2csr` | | 9.0 | -|`cusparseDpruneCsr2csr` | | 9.0 | -|`cusparseHpruneCsr2csr_bufferSizeExt` | | 9.0 | -|`cusparseSpruneCsr2csr_bufferSizeExt` | | 9.0 | -|`cusparseDpruneCsr2csr_bufferSizeExt` | | 9.0 | -|`cusparseHpruneCsr2csrNnz` | | 9.0 | -|`cusparseSpruneCsr2csrNnz` | | 9.0 | -|`cusparseDpruneCsr2csrNnz` | | 9.0 | -|`cusparseHpruneDense2csrByPercentage` | | 9.0 | -|`cusparseSpruneDense2csrByPercentage` | | 9.0 | -|`cusparseDpruneDense2csrByPercentage` | | 9.0 | -|`cusparseHpruneDense2csrByPercentage_bufferSizeExt` | | 9.0 | -|`cusparseSpruneDense2csrByPercentage_bufferSizeExt` | | 9.0 | -|`cusparseDpruneDense2csrByPercentage_bufferSizeExt` | | 9.0 | -|`cusparseHpruneDense2csrNnzByPercentage` | | 9.0 | -|`cusparseSpruneDense2csrNnzByPercentage` | | 9.0 | -|`cusparseDpruneDense2csrNnzByPercentage` | | 9.0 | -|`cusparseHpruneCsr2csrByPercentage` | | 9.0 | -|`cusparseSpruneCsr2csrByPercentage` | | 9.0 | -|`cusparseDpruneCsr2csrByPercentage` | | 9.0 | -|`cusparseHpruneCsr2csrByPercentage_bufferSizeExt` | | 9.0 | -|`cusparseSpruneCsr2csrByPercentage_bufferSizeExt` | | 9.0 | -|`cusparseDpruneCsr2csrByPercentage_bufferSizeExt` | | 9.0 | -|`cusparseHpruneCsr2csrNnzByPercentage` | | 9.0 | -|`cusparseSpruneCsr2csrNnzByPercentage` | | 9.0 | -|`cusparseDpruneCsr2csrNnzByPercentage` | | 9.0 | -|`cusparseSnnz_compress` |`hipsparseSnnz_compress` | 8.0 | -|`cusparseDnnz_compress` |`hipsparseDnnz_compress` | 8.0 | -|`cusparseCnnz_compress` |`hipsparseCnnz_compress` | 8.0 | -|`cusparseZnnz_compress` |`hipsparseZnnz_compress` | 8.0 | - -## **10. cuSPARSE Generic API Reference** - -## ***10.1. Generic Sparse API helper functions*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseCreateCoo` | | 10.1 | -|`cusparseCreateCooAoS` | | 10.1 | -|`cusparseCreateCsr` | | 10.1 | -|`cusparseDestroySpMat` | | 10.1 | -|`cusparseCooGet` | | 10.1 | -|`cusparseCooAoSGet` | | 10.1 | -|`cusparseCsrGet` | | 10.1 | -|`cusparseSpMatGetFormat` | | 10.1 | -|`cusparseSpMatGetIndexBase` | | 10.1 | -|`cusparseSpMatGetValues` | | 10.1 | -|`cusparseSpMatSetValues` | | 10.1 | -|`cusparseSpMatGetStridedBatch` | | 10.1 | -|`cusparseSpMatSetStridedBatch` | | 10.1 | -|`cusparseSpMatGetNumBatches` | | 10.1 | -|`cusparseSpMatSetNumBatches` | | 10.1 | -|`cusparseCreateSpVec` | | 10.1 | -|`cusparseDestroySpVec` | | 10.1 | -|`cusparseSpVecGet` | | 10.1 | -|`cusparseSpVecGetIndexBase` | | 10.1 | -|`cusparseSpVecGetValues` | | 10.1 | -|`cusparseSpVecSetValues` | | 10.1 | - -## ***10.2. Generic Dense API helper functions*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseCreateDnMat` | | 10.1 | -|`cusparseDestroyDnMat` | | 10.1 | -|`cusparseDnMatGet` | | 10.1 | -|`cusparseDnMatGetValues` | | 10.1 | -|`cusparseDnMatSetValues` | | 10.1 | -|`cusparseDnMatSetStridedBatch` | | 10.1 | -|`cusparseDnMatGetStridedBatch` | | 10.1 | -|`cusparseCreateDnVec` | | 10.1 | -|`cusparseDestroyDnVec` | | 10.1 | -|`cusparseDnVecGet` | | 10.1 | -|`cusparseDnVecGetValues` | | 10.1 | -|`cusparseDnVecSetValues` | | 10.1 | - -## ***10.3. Generic SpMM API functions*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSpMM` | | 10.1 | -|`cusparseSpMM_bufferSize` | | 10.1 | - -## ***10.4. Generic SpVV API functions [Undocumented]*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSpVV` | | 10.1 | -|`cusparseSpVV_bufferSize` | | 10.1 | - -## ***10.5. Generic SpMV API functions [Undocumented]*** - -| **CUDA** | **HIP** |**CUDA version\***| -|-----------------------------------------------------------|-------------------------------------------------|:----------------:| -|`cusparseSpMV` | | 10.1 | -|`cusparseSpMV_bufferSize` | | 10.1 | - -\* CUDA version, in which API has appeared and (optional) last version before abandoning it; no value in case of earlier versions < 7.5. From 813915508ea7af24748984ed048bcd387b60a226 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 07:55:34 +0530 Subject: [PATCH 31/39] SWDEV-1 - Update hiprtc markdown document (#2967) Change-Id: I515d174b8085ac905e19b2e6aa2834685cd70fbc --- docs/markdown/hip_rtc.md | 216 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 212 insertions(+), 4 deletions(-) diff --git a/docs/markdown/hip_rtc.md b/docs/markdown/hip_rtc.md index 8edb17ee55..2b2eb9f045 100644 --- a/docs/markdown/hip_rtc.md +++ b/docs/markdown/hip_rtc.md @@ -10,7 +10,9 @@ NOTE: - But it does depend on COMGr. We may try to statically link COMGr into hipRTC to avoid any ambiguity. - Developers can decide to bundle this library with their application. -## Example +## Compile APIs + +#### Example To use hiprtc functionality, hiprtc header needs to be included first. ```#include ``` @@ -68,7 +70,7 @@ size_t codeSize; hiprtcGetCodeSize(prog, &codeSize); vector kernel_binary(codeSize); -hiprtcGetCode(kernel_binary, code.data()); +hiprtcGetCode(prog, kernel_binary.data()); ``` After loading the binary, hiprtcProgram can be destroyed. @@ -87,12 +89,218 @@ And now this kernel can be launched via hipModule APIs. Please have a look at saxpy.cpp and hiprtcGetLoweredName.cpp files for a detailed example. -## HIPRTC specific options +#### HIPRTC specific options HIPRTC provides a few hiprtc specific flags - ```--gpu-architecture``` : This flag can guide the code object generation for a specific gpu arch. Example: ```--gpu-architecture=gfx906:sramecc+:xnack-```, its equivalent to ```--offload-arch```. - This option is compulsory if compilation is done on a system without AMD GPUs supported by HIP runtime. - Otherwise, hipRTC will load the hip runtime and gather the current device and its architecture info and use it as option. + - ```-fgpu-rdc``` : This flag when provided during the hiprtcCompileProgram generates the bitcode (HIPRTC doesn't convert this bitcode into ISA and binary). This bitcode can later be fetched using hiprtcGetBitcode and hiprtcGetBitcodeSize APIs. + +#### Bitcode +In the usual scenario, the kernel associated with hiprtcProgram is compiled into the binary which can be loaded and run. However, if -fpu-rdc option is provided in the compile options, HIPRTC calls comgr and generates only the LLVM bitcode. It doesn't convert this bitcode to ISA and generate the final binary. +```cpp +std::string sarg = std::string("-fgpu-rdc"); +const char* options[] = { + sarg.c_str() }; +hiprtcCompileProgram(prog, // hiprtcProgram + 1, // Number of options + options); +``` + +If the compilation is successful, one can load the bitcode in a local variable using the bitcode APIs provided by HIPRTC. +```cpp +size_t bitCodeSize; +hiprtcGetBitcodeSize(prog, &bitCodeSize); + +vector kernel_bitcode(bitCodeSize); +hiprtcGetBitcode(prog, kernel_bitcode.data()); +``` + +## Linker APIs + +#### Introduction +The bitcode generated using the HIPRTC Bitcode APIs can be loaded using hipModule APIs and also can be linked with other generated bitcodes with appropriate linker flags using the HIPRTC linker APIs. This also provides more flexibility and optimizations to the applications who want to generate the binary dynamically according to their needs. The input bitcodes can be generated only for a specific architecture or it can be a bundled bitcode which is generated for multiple architectures. + +#### Example +Firstly, hiprtc link instance or a pending linker invocation must be created using hiprtcLinkCreate, with the appropriate linker options provided. +```cpp +hiprtcLinkCreate( num_options, // number of options + options, // Array of options + option_vals, // Array of option values cast to void* + &rtc_link_state ); // hiprtc link state created upon success +``` + +Following which, the bitcode data can be added to this link instance via hiprtcLinkAddData (if the data is present as a string) or hiprtcLinkAddFile (if the data is present as a file) with the appropriate input type according to the data or the bitcode used. +```cpp +hiprtcLinkAddData(rtc_link_state, // hiprtc link state + input_type, // type of the input data or bitcode + bit_code_ptr, // input data which is null terminated + bit_code_size, // size of the input data + "a", // optional name for this input + 0, // size of the options + 0, // Array of options applied to this input + 0); // Array of option values cast to void* +``` +```cpp +hiprtcLinkAddFile(rtc_link_state, // hiprtc link state + input_type, // type of the input data or bitcode + bc_file_path.c_str(), // path to the input file where bitcode is present + 0, // size of the options + 0, // Array of options applied to this input + 0); // Array of option values cast to void* +``` + +Once the bitcodes for multiple archs are added to the link instance, the linking of the device code must be completed using hiprtcLinkComplete which generates the final binary. +```cpp +hiprtcLinkComplete(rtc_link_state, // hiprtc link state + &binary, // upon success, points to the output binary + &binarySize); // size of the binary is stored (optional) +``` + +If the hiprtcLinkComplete returns successfully, the generated binary can be loaded and run using the hipModule* APIs. +```cpp +hipModuleLoadData( &module, binary ); +``` + +#### Note + - The compiled binary must be loaded before hiprtc link instance is destroyed using the hiprtcLinkDestroy API. +```cpp +hiprtcLinkDestroy( rtc_link_state); +``` + - The correct sequence of calls is : hiprtcLinkCreate, hiprtcLinkAddData or hiprtcLinkAddFile, hiprtcLinkComplete, hiprtcModuleLoadData, hiprtcLinkDestroy. + +#### Input Types +HIPRTC provides hiprtcJITInputType enumeration type which defines the input types accepted by the Linker APIs. Here are the enum values of hiprtcJITInputType. However only the input types HIPRTC_JIT_INPUT_LLVM_BITCODE, HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE and HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE are supported currently. + +```cpp +HIPRTC_JIT_INPUT_CUBIN = 0, +HIPRTC_JIT_INPUT_PTX, +HIPRTC_JIT_INPUT_FATBINARY, +HIPRTC_JIT_INPUT_OBJECT, +HIPRTC_JIT_INPUT_LIBRARY, +HIPRTC_JIT_INPUT_NVVM, +HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES, +HIPRTC_JIT_INPUT_LLVM_BITCODE = 100, +HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE = 101, +HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE = 102, +HIPRTC_JIT_NUM_INPUT_TYPES = (HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES + 3) +``` + +## Error Handling +HIPRTC defines the hiprtcResult enumeration type and a function hiprtcGetErrorString for API call error handling. hiprtcResult enum defines the API result codes. HIPRTC APIs return hiprtcResult to indicate the call result. hiprtcGetErrorString function returns a string describing the given hiprtcResult code, e.g., HIPRTC_SUCCESS to "HIPRTC_SUCCESS". For unrecognized enumeration values, it returns "Invalid HIPRTC error code". + +hiprtcResult enum supported values and the hiprtcGetErrorString usage are mentioned below. +```cpp +HIPRTC_SUCCESS = 0, +HIPRTC_ERROR_OUT_OF_MEMORY = 1, +HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2, +HIPRTC_ERROR_INVALID_INPUT = 3, +HIPRTC_ERROR_INVALID_PROGRAM = 4, +HIPRTC_ERROR_INVALID_OPTION = 5, +HIPRTC_ERROR_COMPILATION = 6, +HIPRTC_ERROR_LINKING = 7, +HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 8, +HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 9, +HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 10, +HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 11, +HIPRTC_ERROR_INTERNAL_ERROR = 12 +``` +```cpp +hiprtcResult result; +result = hiprtcCompileProgram(prog, 1, opts); +if (result != HIPRTC_SUCCESS) { +std::cout << "hiprtcCompileProgram fails with error " << hiprtcGetErrorString(result); +} +``` + +## HIPRTC General APIs +HIPRTC provides the following API for querying the version. + +hiprtcVersion(int* major, int* minor) - This sets the output parameters major and minor with the HIP Runtime compilation major version and minor version number respectively. + +Currently, it returns hardcoded value. This should be implemented to return HIP runtime major and minor version in the future releases. + +## Lowered Names (Mangled Names) +HIPRTC mangles the ```__global__``` function names and names of ```__device__``` and ```__constant__``` variables. If the generated binary is being loaded using the HIP Runtime API, the kernel function or ```__device__/__constant__``` variable must be looked up by name, but this is very hard when the name has been mangled. To overcome this, HIPRTC provides API functions that map ```__global__``` function or ```__device__/__constant__``` variable names in the source to the mangled names present in the generated binary. + +The two APIs hiprtcAddNameExpression and hiprtcGetLoweredName provide this functionality. First, a 'name expression' string denoting the address for the ```__global__``` function or ```__device__/__constant__``` variable is provided to hiprtcAddNameExpression. Then, the program is compiled with hiprtcCompileProgram. During compilation, HIPRTC will parse the name expression string as a C++ constant expression at the end of the user program. Finally, the function hiprtcGetLoweredName is called with the original name expression and it returns a pointer to the lowered name. The lowered name can be used to refer to the kernel or variable in the HIP Runtime API. + +#### Note + - The identical name expression string must be provided on a subsequent call to hiprtcGetLoweredName to extract the lowered name. + - The correct sequence of calls is : hiprtcAddNameExpression, hiprtcCompileProgram, hiprtcGetLoweredName, hiprtcDestroyProgram. + - The lowered names must be fetched using hiprtcGetLoweredName only after the HIPRTC program has been compiled, and before it has been destroyed. + +#### Example +kernel containing various definitions ```__global__``` functions/function templates and ```__device__/__constant__``` variables can be stored in a string. + +```cpp +static constexpr const char gpu_program[]{ +R"( +__device__ int V1; // set from host code +static __global__ void f1(int *result) { *result = V1 + 10; } +namespace N1 { +namespace N2 { +__constant__ int V2; // set from host code +__global__ void f2(int *result) { *result = V2 + 20; } +} +} +template +__global__ void f3(int *result) { *result = sizeof(T); } +)"}; +``` +hiprtcAddNameExpression is called with various name expressions referring to the address of ```__global__``` functions and ```__device__/__constant__``` variables. + +```cpp +kernel_name_vec.push_back("&f1"); +kernel_name_vec.push_back("N1::N2::f2"); +kernel_name_vec.push_back("f3"); +for (auto&& x : kernel_name_vec) hiprtcAddNameExpression(prog, x.c_str()); +variable_name_vec.push_back("&V1"); +variable_name_vec.push_back("&N1::N2::V2"); +for (auto&& x : variable_name_vec) hiprtcAddNameExpression(prog, x.c_str()); +``` + +After which, the program is compiled using hiprtcCompileProgram and the generated binary is loaded using hipModuleLoadData. And the mangled names can be fetched using hirtcGetLoweredName. +```cpp +for (decltype(variable_name_vec.size()) i = 0; i != variable_name_vec.size(); ++i) { + const char* name; + hiprtcGetLoweredName(prog, variable_name_vec[i].c_str(), &name); +} +``` +```cpp +for (decltype(kernel_name_vec.size()) i = 0; i != kernel_name_vec.size(); ++i) { + const char* name; + hiprtcGetLoweredName(prog, kernel_name_vec[i].c_str(), &name); +} +``` + +The mangled name of the variables are used to look up the variable in the module and update its value. +``` +hipDeviceptr_t variable_addr; +size_t bytes{}; +hipModuleGetGlobal(&variable_addr, &bytes, module, name); +hipMemcpyHtoD(variable_addr, &initial_value, sizeof(initial_value)); +``` + +Finally, the mangled name of the kernel is used to launch it using the hipModule APIs. + +```cpp +hipFunction_t kernel; +hipModuleGetFunction(&kernel, module, name); +hipModuleLaunchKernel(kernel, 1, 1, 1, 1, 1, 1, 0, nullptr, nullptr, config); +``` + +Please have a look at hiprtcGetLoweredName.cpp for the detailed example. + +## Versioning +HIPRTC follows the below versioning. + - Linux + - HIPRTC follows the same versioning as HIP runtime library. + - The soname field for the shared library is set to MAJOR version. eg: For HIP 5.3 the soname is set to 5 (hiprtc.so.5). + - Windows + - Currently, the HIPRTC dll doesn't have any version attached. It is just named as hiprtc.dll. + - In the upcoming releases, HIPRTC dll will be named as hiprtc_XXYY.dll where XX is MAJOR version and YY is MINOR version. eg: For HIP 5.3 the name is hiprtc_0503.dll. ## Deprecation notice -Currently HIPRTC APIs are separated from HIP APIs and HIPRTC is available as a separate library libhiprtc.so/libhiprtc.dll. But hiprtc symbols are present in libhipamd64.so/libhipamd64.dll in order to support the existing applications. Gradually, these symbols will be removed from HIP library and applications using HIPRTC will be required to explictly link to HIPRTC library. +Currently HIPRTC APIs are separated from HIP APIs and HIPRTC is available as a separate library libhiprtc.so/libhiprtc.dll. But on Linux, HIPRTC symbols are also present in libhipamd64.so in order to support the existing applications. Gradually, these symbols will be removed from HIP library and applications using HIPRTC will be required to explictly link to HIPRTC library. However, on Windows hiprtc.dll must be used as the hipamd64.dll doesn't contain the HIPRTC symbols. From ee5e2a692e29d78626d42bf34dcc14b4c41763ae Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 10:33:45 +0530 Subject: [PATCH 32/39] SWDEV-329802 - Move PCH script hip_embed_pch.sh to hipamd (#2829) Change-Id: If8e52a95a8766bd4b4a696e0b32bb874bebe28d7 --- bin/hip_embed_pch.sh | 191 ------------------------------------------- 1 file changed, 191 deletions(-) delete mode 100755 bin/hip_embed_pch.sh diff --git a/bin/hip_embed_pch.sh b/bin/hip_embed_pch.sh deleted file mode 100755 index 8bc15a89b5..0000000000 --- a/bin/hip_embed_pch.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash -# Copyright (c) 2020 - 2021 Advanced Micro Devices, Inc. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -printUsage() { - echo - echo "Usage: $(basename "$0") HIP_BUILD_INC_DIR HIP_INC_DIR HIP_AMD_INC_DIR LLVM_DIR [option] [RTC_LIB_OUTPUT]" - echo - echo "Options:" - echo " -p, --generate_pch Generate pre-compiled header (default)" - echo " -r, --generate_rtc Generate preprocessor expansion (hiprtc_header.o)" - echo " -h, --help Prints this help" - echo - echo - return 0 -} - -if [ "$1" == "" ]; then - printUsage - exit 0 -fi - -HIP_BUILD_INC_DIR="$1" -HIP_INC_DIR="$2" -HIP_AMD_INC_DIR="$3" -LLVM_DIR="$4" -# By default, generate pch -TARGET="generatepch" - -while [ "$5" != "" ]; -do - case "$5" in - -h | --help ) - printUsage ; exit 0 ;; - -p | --generate_pch ) - TARGET="generatepch" ; break ;; - -r | --generate_rtc ) - TARGET="generatertc" ; break ;; - *) - echo " UNEXPECTED ERROR Parm : [$4] ">&2 ; exit 20 ;; - esac - shift 1 -done - -# Allow hiprtc lib name to be set by argument 7 -if [[ "$6" != "" ]]; then - rtc_shared_lib_out="$6" -else - if [[ "$OSTYPE" == cygwin ]]; then - rtc_shared_lib_out=hiprtc-builtins64.dll - else - rtc_shared_lib_out=libhiprtc-builtins.so - fi -fi - -if [[ "$OSTYPE" == cygwin || "$OSTYPE" == msys ]]; then - isWindows=1 - tmpdir=. -else - isWindows=0 - tmpdir=/tmp -fi - -# Expected first argument $1 to be output file name. -create_hip_macro_file() { -cat >$1 <$tmp/hip_pch.h <$tmp/hip_pch.mcin <$tmp/pch.cui && - - cat $tmp/hip_macros.h >> $tmp/pch.cui && - - $LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip.pch -x hip-cpp-output - <$tmp/pch.cui && - - $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj && - - rm -rf $tmp -} - -generate_rtc_header() { - tmp=$tmpdir/hip_rtc.$$ - mkdir -p $tmp - local macroFile="$tmp/hip_macros.h" - local headerFile="$tmp/hipRTC_header.h" - local mcinFile="$tmp/hipRTC_header.mcin" - - create_hip_macro_file $macroFile - -cat >$headerFile < $mcinFile - if [[ $isWindows -eq 0 ]]; then - echo " .type __hipRTC_header,@object" >> $mcinFile - echo " .type __hipRTC_header_size,@object" >> $mcinFile - fi -cat >>$mcinFile <> $tmp/hiprtc && - $LLVM_DIR/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj && - $LLVM_DIR/bin/clang $tmp/hiprtc_header.o -o $rtc_shared_lib_out -shared && - $LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib -nogpuinc -emit-llvm -c -o $tmp/tmp.bc --cuda-device-only -D__HIPCC_RTC__ --offload-arch=gfx906 -x hip-cpp-output $tmp/hiprtc && - rm -rf $tmp -} - -case $TARGET in - (generatertc) generate_rtc_header ;; - (generatepch) generate_pch ;; - (*) die "Invalid target $TARGET" ;; -esac - From f494acdfd0f36aff6126295619a7873eac042329 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 10:34:36 +0530 Subject: [PATCH 33/39] SWDEV-351054 - Fix error code. (#2966) - Remove memory track checks. - Need to skip checking if mem allocation is 0 and remove unused variable. - hipMemAllocPitch is driver API hence explicit init is required on NVidia platform. Change-Id: Ie0d35d4901271a3466a50aaee26e67e7f91c8a2f --- tests/catch/unit/memory/hipMallocPitch.cc | 59 ++++++++--------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/tests/catch/unit/memory/hipMallocPitch.cc b/tests/catch/unit/memory/hipMallocPitch.cc index 33133f4a52..47afb66fff 100644 --- a/tests/catch/unit/memory/hipMallocPitch.cc +++ b/tests/catch/unit/memory/hipMallocPitch.cc @@ -29,36 +29,21 @@ THE SOFTWARE. #include #include #include +#ifdef __HIP_PLATFORM_NVIDIA__ + #include "DriverContext.hh" +#endif /** * @brief Test hipMalloc3D, hipMallocPitch and hipMemAllocPitch with multiple input values. * Checks that the memory has been allocated with the specified pitch and extent sizes. */ -struct MemoryInfo { - size_t freeMem; - size_t totalMem; -}; - -inline static MemoryInfo createMemoryInfo() { - MemoryInfo memoryInfo{}; - HIP_CHECK(hipMemGetInfo(&memoryInfo.freeMem, &memoryInfo.totalMem)); - return memoryInfo; -} - -static void validateMemory(void* devPtr, hipExtent extent, size_t pitch, - MemoryInfo memBeforeAllocation) { +static void validateMemory(void* devPtr, hipExtent extent, size_t pitch) { INFO("Width: " << extent.width << " Height: " << extent.height << " Depth: " << extent.depth); - MemoryInfo memAfterAllocation{createMemoryInfo()}; const size_t theoreticalAllocatedMemory{pitch * extent.height * extent.depth}; - const size_t allocatedMemory = memBeforeAllocation.freeMem - memAfterAllocation.freeMem; - if (theoreticalAllocatedMemory == 0) { - REQUIRE(theoreticalAllocatedMemory == allocatedMemory); return; /* If there was no memory allocated then we don't need to do further checks. */ - } else { - REQUIRE(theoreticalAllocatedMemory <= allocatedMemory); } std::unique_ptr hostPtr{new char[theoreticalAllocatedMemory]}; @@ -149,40 +134,36 @@ TEST_CASE("Unit_hipMalloc3D_ValidatePitch") { hipPitchedPtr hipPitchedPtr; hipExtent validExtent{generateExtent(AllocationApi::hipMalloc3D)}; - MemoryInfo memBeforeAllocation{createMemoryInfo()}; HIP_CHECK(hipMalloc3D(&hipPitchedPtr, validExtent)); - validateMemory(hipPitchedPtr.ptr, validExtent, hipPitchedPtr.pitch, memBeforeAllocation); + validateMemory(hipPitchedPtr.ptr, validExtent, hipPitchedPtr.pitch); HIP_CHECK(hipFree(hipPitchedPtr.ptr)); } TEST_CASE("Unit_hipMemAllocPitch_ValidatePitch") { - size_t pitch; + size_t pitch = 0; hipDeviceptr_t ptr; hipExtent validExtent{generateExtent(AllocationApi::hipMemAllocPitch)}; - MemoryInfo memBeforeAllocation{createMemoryInfo()}; unsigned int elementSizeBytes = GENERATE(4, 8, 16); if (validExtent.width == 0 || validExtent.height == 0) { return; } - + //hipMemAllocPitch is driver API hence explicit init is required on NVidia plaform. + #ifdef __HIP_PLATFORM_NVIDIA__ + DriverContext ctx; + #endif HIP_CHECK( hipMemAllocPitch(&ptr, &pitch, validExtent.width, validExtent.height, elementSizeBytes)); - validateMemory(reinterpret_cast(ptr), validExtent, pitch, memBeforeAllocation); + validateMemory(reinterpret_cast(ptr), validExtent, pitch); HIP_CHECK(hipFree(reinterpret_cast(ptr))); } TEST_CASE("Unit_hipMallocPitch_ValidatePitch") { -#if HT_AMD - HipTest::HIP_SKIP_TEST("TODO-FIX-EXTENT-GENERATOR"); - return; -#endif - size_t pitch; + size_t pitch = 0; void* ptr; hipExtent validExtent{generateExtent(AllocationApi::hipMemAllocPitch)}; - MemoryInfo memBeforeAllocation{createMemoryInfo()}; HIP_CHECK(hipMallocPitch(&ptr, &pitch, validExtent.width, validExtent.height)); - validateMemory(ptr, validExtent, pitch, memBeforeAllocation); + validateMemory(ptr, validExtent, pitch); HIP_CHECK(hipFree(ptr)); } @@ -223,7 +204,7 @@ TEST_CASE("Unit_hipMalloc3D_Negative") { } TEST_CASE("Unit_hipMallocPitch_Negative") { - size_t pitch; + size_t pitch = 0; void* ptr; constexpr size_t maxSizeT = std::numeric_limits::max(); @@ -248,7 +229,7 @@ TEST_CASE("Unit_hipMallocPitch_Negative") { } TEST_CASE("Unit_hipMemAllocPitch_Negative") { - size_t pitch; + size_t pitch = 0; hipDeviceptr_t ptr{}; unsigned int validElementSizeBytes{4}; constexpr size_t maxSizeT = std::numeric_limits::max(); @@ -358,7 +339,7 @@ static void MemoryAllocDiffSizes(int gpu) { array_size.push_back(LARGECHUNK_NUMH); for (auto &sizes : array_size) { T* A_d[CHUNK_LOOP]; - size_t pitch_A; + size_t pitch_A = 0; size_t width; if (sizes == SMALLCHUNK_NUMH) { width = SMALLCHUNK_NUMW * sizeof(T); @@ -391,7 +372,7 @@ static void threadFunc(int gpu) { #if 0 //TODO: Review, fix and re-enable test TEST_CASE("Unit_hipMallocPitch_Negative") { float* A_d; - size_t pitch_A; + size_t pitch_A = 0; size_t width{NUM_W * sizeof(float)}; #if HT_NVIDIA SECTION("NullPtr to Pitched Ptr") { @@ -429,7 +410,7 @@ TEST_CASE("Unit_hipMallocPitch_Negative") { TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Basic", "[hipMallocPitch]", int, unsigned int, float) { TestType* A_d; - size_t pitch_A; + size_t pitch_A = 0; size_t width{NUM_W * sizeof(TestType)}; REQUIRE(hipMallocPitch(reinterpret_cast(&A_d), &pitch_A, width, NUM_H) == hipSuccess); @@ -454,7 +435,7 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Memcpy2D", "" HIP_CHECK(hipSetDevice(0)); TestType *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, *A_d{nullptr}, *B_d{nullptr}; - size_t pitch_A, pitch_B; + size_t pitch_A = 0, pitch_B = 0; size_t width{NUM_W * sizeof(TestType)}; // Allocating memory @@ -536,7 +517,7 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_KernelLaunch", "" HIP_CHECK(hipSetDevice(0)); TestType *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, *A_d{nullptr}, *B_d{nullptr}; - size_t pitch_A, pitch_B; + size_t pitch_A = 0, pitch_B = 0; size_t width{NUM_W * sizeof(TestType)}; // Allocating memory From 05281fda8c8c7b507f1ef208e1a053ecc41f6f53 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 10:34:57 +0530 Subject: [PATCH 34/39] SWDEV-354273 - Add unit test of sRGB in 1D (#2968) Add unit test of sRGB for 1DArray(hipResourceTypeArray) and 1DBuffer(hipResourceTypeLinear). Note that for 1Dbuffer, AMD devices doesn't support sRGB, thus the test is a negative test. Change-Id: Ib604cf6f3abd3b90813def1d563c53d42328bace --- tests/catch/unit/texture/CMakeLists.txt | 1 + .../texture/hipTextureObj1DCheckSRGBModes.cc | 296 ++++++++++++++++++ 2 files changed, 297 insertions(+) create mode 100644 tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc diff --git a/tests/catch/unit/texture/CMakeLists.txt b/tests/catch/unit/texture/CMakeLists.txt index 0d33c27a29..c05db818e6 100644 --- a/tests/catch/unit/texture/CMakeLists.txt +++ b/tests/catch/unit/texture/CMakeLists.txt @@ -43,6 +43,7 @@ set(TEST_SRC hipTextureObj1DCheckModes.cc hipTextureObj2DCheckModes.cc hipTextureObj3DCheckModes.cc + hipTextureObj1DCheckSRGBModes.cc hipTextureObj2DCheckSRGBModes.cc ) diff --git a/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc b/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc new file mode 100644 index 0000000000..c54bdfc2db --- /dev/null +++ b/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc @@ -0,0 +1,296 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include +#include + +template +__global__ void tex1DRGBAKernel(float4 *outputData, hipTextureObject_t textureObject, + int width, float offsetX) { +#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT + int x = blockIdx.x * blockDim.x + threadIdx.x; + outputData[x] = tex1D(textureObject, + normalizedCoords ? (x + offsetX) / width : x + offsetX); +#endif +} + +__global__ void tex1DRGBAKernelFetch(float4 *outputData, hipTextureObject_t textureObject, float offsetX) { +#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT + int x = blockIdx.x * blockDim.x + threadIdx.x; + outputData[x] = tex1Dfetch(textureObject, int(x + offsetX)); +#endif +} + +template +static void runTest(const int width, const float offsetX = 0) { + constexpr float uCharMax = UCHAR_MAX; + unsigned int size = width * sizeof(uchar4); + uchar4 *hData = (uchar4*) malloc(size); + memset(hData, 0, size); + for (int j = 0; j < width; j++) { + hData[j].x = static_cast(j); + hData[j].y = static_cast(j + 10); + hData[j].z = static_cast(j + 20); + hData[j].w = static_cast(j + 30); + } + + hipChannelFormatDesc channelDesc = hipCreateChannelDesc(); + uchar4 *hipBuff = nullptr; + hipArray *hipArray = nullptr; + hipResourceDesc resDesc; + memset(&resDesc, 0, sizeof(resDesc)); + + if (resType == hipResourceTypeArray) { + HIP_CHECK(hipMallocArray(&hipArray, &channelDesc, width)); + HIP_CHECK( + hipMemcpy2DToArray(hipArray, 0, 0, hData, size, size, 1, + hipMemcpyHostToDevice)); + resDesc.resType = hipResourceTypeArray; // Will call tex1D in kernel + resDesc.res.array.array = hipArray; + } else if (resType == hipResourceTypeLinear) { + if (normalizedCoords || filterMode == hipFilterModeLinear + || addressMode == hipAddressModeWrap + || addressMode == hipAddressModeMirror) { + free(hData); + FAIL("One or more unexpected parameters for hipResourceTypeLinear"); + } + HIP_CHECK(hipMalloc((void** ) &hipBuff, size)); + HIP_CHECK(hipMemcpy(hipBuff, hData, size, hipMemcpyHostToDevice)); + resDesc.resType = hipResourceTypeLinear; // Will call tex1Dfetch in kernel + resDesc.res.linear.devPtr = hipBuff; + resDesc.res.linear.sizeInBytes = size; + resDesc.res.linear.desc = channelDesc; + } else FAIL("Unexpected resource type " << resType); + + // Specify texture object parameters + hipTextureDesc texDesc; + memset(&texDesc, 0, sizeof(texDesc)); + texDesc.addressMode[0] = addressMode; + texDesc.addressMode[1] = addressMode; + texDesc.filterMode = filterMode; + texDesc.readMode = hipReadModeNormalizedFloat; + texDesc.normalizedCoords = normalizedCoords; + texDesc.sRGB = sRGB ? 1 : 0; + + // Create texture object + hipTextureObject_t textureObject = 0; + auto ret = hipCreateTextureObject(&textureObject, &resDesc, &texDesc, NULL); +#if HT_AMD + if(ret == hipErrorInvalidValue && resType == hipResourceTypeLinear) { + free(hData); + HIP_CHECK(hipFree(hipBuff)); + HipTest::HIP_SKIP_TEST("sRGB is not supported for hipResourceTypeLinear type on AMD devices"); + return; + } +#endif + HIP_CHECK(ret); + + float4 *dData = nullptr; + size = width * sizeof(float4); + HIP_CHECK(hipMalloc((void**) &dData, size)); + + dim3 dimBlock(16, 1, 1); + dim3 dimGrid((width + dimBlock.x - 1) / dimBlock.x, 1, 1); + + if (resType == hipResourceTypeArray) { + hipLaunchKernelGGL(tex1DRGBAKernel, dimGrid, dimBlock, + 0, 0, dData, textureObject, width, offsetX); + } else { + hipLaunchKernelGGL(tex1DRGBAKernelFetch, dimGrid, dimBlock, + 0, 0, dData, textureObject, offsetX); + } + + HIP_CHECK(hipDeviceSynchronize()); + size = width * sizeof(float4); + float4 *hInputData = (float4*) malloc(size); // CPU expected values + float4 *hOutputData = (float4*) malloc(size); // GPU output values + memset(hInputData, 0, size); + memset(hOutputData, 0, size); + + for (int j = 0; j < width; j++) { + hInputData[j].x = hData[j].x / uCharMax; + hInputData[j].y = hData[j].y / uCharMax; + hInputData[j].z = hData[j].z / uCharMax; + hInputData[j].w = hData[j].w / uCharMax; + } + + HIP_CHECK(hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost)); + + bool result = true; + + for (int j = 0; j < width; j++) { + float4 cpuExpected = + getExpectedValue(width, offsetX + j, hInputData); + float4 gpuOutput = hOutputData[j]; + if (sRGB) { + // CTS will map to sRGP before comparison, so we do so + cpuExpected = hipSRGBMap(cpuExpected); + gpuOutput = hipSRGBMap(gpuOutput); + } + // Convert from [0, 1] back to [0, 255] + gpuOutput *= uCharMax; + cpuExpected *= uCharMax; + if (!hipTextureSamplingVerify(gpuOutput, + cpuExpected)) { + WARN( + "Mismatch at (" << offsetX + j << ") GPU output : " + << gpuOutput.x << ", " << gpuOutput.y << ", " << gpuOutput.z << ", " << gpuOutput.w << ", " << + " CPU expected: " + << cpuExpected.x << ", " << cpuExpected.y << ", " << cpuExpected.z << ", " << cpuExpected.w << "\n"); + result = false; + goto line1; + } + } + +line1: + HIP_CHECK(hipDestroyTextureObject(textureObject)); + HIP_CHECK(hipFree(dData)); + if (hipArray) HIP_CHECK(hipFreeArray(hipArray)); + if (hipBuff) HIP_CHECK(hipFree(hipBuff)); + free(hData); + free(hOutputData); + free(hInputData); + REQUIRE(result); +} + +TEST_CASE("Unit_hipTextureObj1DCheckRGBAModes - array") { + CHECK_IMAGE_SUPPORT + + SECTION("RGBA 1D hipAddressModeClamp, hipFilterModePoint, hipResourceTypeArray, regularCoords") { + runTest(255, -3.9); + runTest(255, 4.4); + } + + SECTION("RGBA 1D hipAddressModeBorder, hipFilterModePoint, hipResourceTypeArray, regularCoords") { + runTest(255, -8.5); + runTest(255, 12.5); + } + + SECTION("RGBA 1D hipAddressModeClamp, hipFilterModeLinear, hipResourceTypeArray, regularCoords") { + runTest(255, -0.41); + runTest(255, 4); + } + +#if HT_AMD + // nvidia RTX2070 has problem in this mode + SECTION("RGBA 1D hipAddressModeBorder, hipFilterModeLinear, hipResourceTypeArray, regularCoords") { + runTest(255, 0); + runTest(255, 12.1); + } +#endif + + SECTION("RGBA 1D hipAddressModeClamp, hipFilterModePoint, hipResourceTypeArray, normalizedCoords") { + runTest(255, -3.1); + runTest(255, 4.2); + } + + SECTION("RGBA 1D hipAddressModeBorder, hipFilterModePoint, hipResourceTypeArray, normalizedCoords") { + runTest(255, -8.15); + runTest(255, 12.35); + } + + SECTION("RGBA 1D hipAddressModeClamp, hipFilterModeLinear, hipResourceTypeArray, normalizedCoords") { + runTest(255, -3.1); + runTest(255, 4.2); + } + +#if HT_AMD + // nvidia RTX2070 has problem in this mode + SECTION("RGBA 1D hipAddressModeBorder, hipFilterModeLinear, hipResourceTypeArray, normalizedCoords") { + runTest(255, 0); + runTest(255, -6.7); + } +#endif +} + + +TEST_CASE("Unit_hipTextureObj1DCheckSRGBAModes - array") { + CHECK_IMAGE_SUPPORT + + SECTION("SRGBA 1D hipAddressModeClamp, hipFilterModePoint, hipResourceTypeArray, regularCoords") { + runTest(255, -3.9); + runTest(255, 4.4); + } + + SECTION("SRGBA 1D hipAddressModeBorder, hipFilterModePoint, hipResourceTypeArray, regularCoords") { + runTest(255, -8.5); + runTest(255, 12.5); + } + + SECTION("SRGBA 1D hipAddressModeClamp, hipFilterModeLinear, hipResourceTypeArray, regularCoords") { + runTest(255, -0.4); + runTest(255, 4); + } + +#if HT_AMD + // nvidia RTX2070 has problem in this mode + SECTION("SRGBA 1D hipAddressModeBorder, hipFilterModeLinear, hipResourceTypeArray, regularCoords") { + runTest(255, 0); + runTest(255, 12.5); + } +#endif + + SECTION("SRGBA 1D hipAddressModeClamp, hipFilterModePoint, hipResourceTypeArray, normalizedCoords") { + runTest(255, -1.3); + runTest(255, 4.1); + } + + SECTION("SRGBA 1D hipAddressModeBorder, hipFilterModePoint, hipResourceTypeArray, normalizedCoords") { + runTest(255, -8.5); + runTest(255, 12.5); + } + + SECTION("SRGBA 1D hipAddressModeClamp, hipFilterModeLinear, hipResourceTypeArray, normalizedCoords") { + runTest(255, -3); + runTest(255, 4); + } +#if HT_AMD + // nvidia RTX2070 has problem in this mode + SECTION("SRGBA 1D hipAddressModeBorder, hipFilterModeLinear, hipResourceTypeArray, normalizedCoords") { + runTest(255, 0); + runTest(255, 12.35); + } +#endif +} + +TEST_CASE("Unit_hipTextureObj1DCheckRGBAModes - buffer") { + CHECK_IMAGE_SUPPORT + + SECTION("RGBA 1D hipAddressModeClamp, hipFilterModePoint, hipResourceTypeLinear, regularCoords") { + runTest(255); + } + + SECTION("RGBA 1D hipAddressModeBorder, hipFilterModePoint, hipResourceTypeLinear, regularCoords") { + runTest(255); + } +} + +TEST_CASE("Unit_hipTextureObj1DCheckSRGBAModes - buffer") { + CHECK_IMAGE_SUPPORT + + SECTION("SRGBA 1D hipAddressModeClamp, hipFilterModePoint, hipResourceTypeLinear, regularCoords") { + runTest(255); + } + + SECTION("SRGBA 1D hipAddressModeBorder, hipFilterModePoint, hipResourceTypeLinear, regularCoords") { + runTest(255); + } +} From 02ee43c5b4d0dbc186e72ca906d2fa684e6d250a Mon Sep 17 00:00:00 2001 From: Finlay Date: Tue, 27 Sep 2022 06:16:35 +0100 Subject: [PATCH 35/39] added document of modern cpp features supported by the compiler (#2848) --- docs/markdown/modern_cpp_features.md | 468 +++++++++++++++++++++++++++ 1 file changed, 468 insertions(+) create mode 100644 docs/markdown/modern_cpp_features.md diff --git a/docs/markdown/modern_cpp_features.md b/docs/markdown/modern_cpp_features.md new file mode 100644 index 0000000000..1bd0fcf79c --- /dev/null +++ b/docs/markdown/modern_cpp_features.md @@ -0,0 +1,468 @@ +# HIP C++ Feature + +## C++ 11 + +### Rvalue References + +```cpp +struct Y { + int x; +}; + +__device__ void do_something(Y &&val) { val.x += 1; } + +__global__ void kernel() { + Y y{10}; + // do_something(y); // does not compile since the argument is an lvalue + do_something(std::move(y)); +} + +int main() { kernel<<<1, 1>>>(); } +``` + +### Rvalue References for `*this` + +```cpp +struct Sample { + __host__ __device__ void callMe() & { printf("Lval Func\n"); } + __host__ __device__ void callMe() && { printf("Rval Func\n"); } +}; + +__global__ void kernel() { + Sample s; + s.callMe(); // prints Lval Func + Sample().callMe(); // prints Rval Func +} + +int main() { kernel<<<1, 1>>>(); } +``` + +### Variadic templates, Static Assertions, `auto` Variables + +```cpp +template __host__ __device__ T add(T val) { return val; } + +template +__host__ __device__ T add(T val, Targs... pVal) { + static_assert(std::is_arithmetic::value, "Not a valid type"); + return val + add(pVal...); +} + +template +__global__ void kernel(T *ptr, Targs... args) { + auto &&sum = add(args...); + *ptr = sum; +} + +// Or something like + +__device__ int &getX(int &x) { return ++x; } +__device__ int getY(int &x) { return x + 10; } + +__global__ void kernel() { + int X = 0; + auto &&x = getX(X); + auto &&y = getY(X); + + // Init with value or initializer list + auto val{10}; + auto list = {10}; +} + +int main() { kernel<<<1, 1>>>(); } +``` + +### Non-static Data Member Initialization + +```cpp +struct S { + int a = 1; + int b = 2; +}; + +__global__ void kernel() { + S s; // s.a == 1 and s.b == 2 +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Lambda Device Functions + +```cpp +template __global__ void kernel(T f) { f(); } + +int main() { + auto func = [=] __device__() { printf("In Kernel\n"); }; + kernel<<<1, 1>>>(func); + hipDeviceSynchronize(); +} +``` + +### `decltype` Usage + +```cpp +template __device__ T ret() { + T x{0}; + return x; +} + +template __global__ void kernel() { + decltype(ret()) a; + int i = 0; + decltype(i) j = i + 1; +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Default Template Arguments + +```cpp +template __global__ void kernel(int x) { x += N; } +int main() { + kernel<<<1, 1>>>(1); + kernel<-2><<<1, 1>>>(1); +} +``` + +### Template Alias + +```cpp +template struct Alloc {}; + +template struct Vector {}; + +template using V = Vector>; + +template __global__ void kernel(T x) { V v; } + +int main() { kernel<<<1, 1>>>(5); } +``` + +### Extern Template + +```cpp +template __global__ void kernel(T x) {} + +extern template __global__ void kernel(long x); + +int main() { + kernel<<<1, 1, 0, 0>>>(10); // will create a template specialization + // kernel<<<1,1,0,0>>>(10l); // looks for existing kernel, causing + // linking to fail +} +``` + +### `nullptr` as a Keyword in Device Compiler + +```cpp +__global__ void kernel() { + int *ptr = nullptr; + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Strongly Typed Enums + +```cpp +enum class EnumVals { Red, Blue, Green }; +__global__ void kernel() { + auto val = EnumVals::Red; + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Standardized Attribute Syntax + +```cpp +[[deprecated]] __global__ void kernel() { + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### `constexpr` + +```cpp +struct S { + constexpr __device__ S(double v) : val(v) {} + constexpr __device__ double value() const { return val; } + +private: + double val; +}; + +constexpr __device__ int factorial(int n) { + return n <= 1 ? 1 : (n * factorial(n - 1)); +} + +__global__ void kernel() { + constexpr S s(factorial(5)); + constexpr double d = s.value(); + // ... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### `alignas` with Struct + +```cpp +struct alignas(alignof(int)) S { + //... +}; + +__global__ void kernel() { + S s; + static_assert(alignof(S) == alignof(int), "they have the same alignment"); + // check the alignment +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Delegating Constructors + +```cpp +struct S { +private: + int val; + +public: + __device__ S(int v) : val(v) {} + __device__ S() : S(42) {} +}; +__global__ void kernel() { S s{}; } +int main() { kernel<<<1, 1>>>(); } +``` + +### Explicit Conversion Functions + +```cpp +struct S { +private: + int val; + +public: + __device__ S(int val) : val(val) {} + __device__ explicit operator int *() { return &val; } +}; + +__global__ void kernel() { + S s{0}; + // if (s) { // compile error + // without the explicit function specifier then s would be converted to the + // pointer to s.val, which would be non-zero so always true. + //} + if ((int *)(s)) { + // this compiles but is likely not what the user intended + } +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Unicode Character Types, Unicode String, Universal Character Literal + +```cpp +__global__ void kernel() { + // cant print it since printf(gpu) doesnot support unicode char arguments + char16_t a = u'y'; + char32_t l = U'猫'; + auto *string = U"इस अनुवाद को करने से आपको क्या मिला?"; +} +int main() { kernel<<<1, 1>>>(); } +``` + +### User Defined Literals + +```cpp +__device__ long double operator"" _w(long double a) { return a; } +__device__ unsigned operator"" _w(char const *c) { return *c - '0'; } + +__global__ void kernel() { + auto ld = 1.2_w; // calls operator "" _w(1.2L) + auto val = 2_w; // calls operator "" _w("2") +} +int main() { kernel<<<1, 1>>>(); } +``` + +### `default`/`delete` Functions + +```cpp +struct S { + __device__ S() = default; + __device__ S &operator=(const S &) = delete; +}; +__global__ void kernel() { + S s, other; // fine + // other = s; // compile error, function deleted +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Friend Declaration + +```cpp +struct Y {}; + +struct A { + __device__ A() = default; + friend Y; + // friend Z; // compile error since class or struct Z doesn't exist + friend class Z; // this is fine + friend void asdf(int); // functions can be declared without a definition +}; +__global__ void kernel() { A a; } +int main() { kernel<<<1, 1>>>(); } +``` + +### Extended `sizeof` + +```cpp +template __global__ void kernel(Ts... ts) { + auto size = sizeof...(ts); + // ... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Unrestricted Unions + +```cpp +struct Point { + __device__ Point() {} + __device__ Point(int x, int y) : x_(x), y_(y) {} + int x_, y_; +}; + +union U { + int z; + double w; + Point p; + __device__ U() {} + __device__ U(const Point &pt) : p(pt) {} + __device__ U &operator=(const Point &pt) { + new (&p) Point(pt); + return *this; + } +}; + +__global__ void kernel() { + U u; + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Inline Namespaces + +```cpp +namespace XX { +inline namespace YY { +struct Y { + int x; +}; +} // namespace YY +struct X { + int a; +}; +} // namespace XX + +__global__ void kernel() { + XX::X x{}; + XX::Y y{}; +} + +int main() { kernel<<<1, 1>>>(); } +``` + +### Range Based For-loop + +```cpp +__global__ void kernel() { + for (auto &x : {1, 2, 3, 4, 5}) { + // ... + } +} +int main() { kernel<<<1, 1>>>(); } +``` + +### `override` Specifier + +```cpp +struct Base { + int n; + __device__ Base(int v) : n(v + 1) {} + __device__ Base() : Base(10) {} + __device__ virtual ~Base() {} + __device__ virtual int get() { return n; } +}; + +struct Derived : public Base { + int n; + __device__ Derived(int v) : n(v) {} + __device__ int get() override { return n; } + __device__ ~Derived() {} +}; + +__global__ void kernel() { + Derived d(10); + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### `noexcept` Keyword + +```cpp +__global__ void kernel() noexcept { + int n; + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Consecutive Right Angle Brackets in Templates + +```cpp +template struct A { T a; }; + +template struct B { T b; }; + +__global__ void kernel() { + A> ab; + //... +} +int main() { kernel<<<1, 1>>>(); } +``` + +### Not Yet Documented + +* Right Angled Brackets : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html +* Initializer List : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm +* Solving SFINAE problem for expression : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html +* Forward Declaration of Enum : http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1206 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf +* Conditionally supported behavior : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1627.pdf +* Inheriting Constructors : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm +* Standard layout types : https://en.cppreference.com/w/cpp/named_req/StandardLayoutType +* Local and unnamed types as template arguments : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm +* Minimal support for Garbage Collection : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm +* Move special functions : https://en.cppreference.com/w/cpp/language/rule_of_three +* long long int + + +## C++14 + +### Not Yet Documented + +* Tweak C++ contextual conversions : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf +* Binary literals : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf +* Functions to deduce return type : https://isocpp.org/files/papers/N3638.html +* Lambda capture changes : https://isocpp.org/files/papers/N3648.html +* Polymorphic lambda : https://isocpp.org/files/papers/N3649.html +* Variable template : https://en.cppreference.com/w/cpp/language/variable_template +* constexpr changes : https://isocpp.org/files/papers/N3652.html +* struct member initializer : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3653.html +* clarifying mem allocation : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3664.html +* sized dealloc : https://isocpp.org/files/papers/n3778.html +* deprecated attribute : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html +* digit separator : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf \ No newline at end of file From b4b35b49543200747e304c854eb333e920066173 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 11:44:55 +0530 Subject: [PATCH 36/39] SWDEV-345020 - Enable test cases after fix. (#2868) Change-Id: I7ac1352e2442638e7156b05429fc4feef3af8e3f From a1481d542baf8d231eef4516c2fc97f159696123 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 27 Sep 2022 13:34:31 +0530 Subject: [PATCH 37/39] SWDEV-306122 - [catch2][dtest] Added test for hipGraphMemcpyNodeSetParamsToSymbol API (#2813) Change-Id: I486030661324f3fa4d6f6241882f4cd839211511 --- .../config/config_amd_windows_common.json | 4 +- .../hipGraphMemcpyNodeSetParamsToSymbol.cc | 163 +++++++++++++++++- 2 files changed, 163 insertions(+), 4 deletions(-) diff --git a/tests/catch/hipTestMain/config/config_amd_windows_common.json b/tests/catch/hipTestMain/config/config_amd_windows_common.json index f65e58c65a..3461db9bbe 100644 --- a/tests/catch/hipTestMain/config/config_amd_windows_common.json +++ b/tests/catch/hipTestMain/config/config_amd_windows_common.json @@ -69,6 +69,8 @@ "Unit_hipGraphHostNodeGetParams_BasicFunc", "Unit_hipGraphHostNodeGetParams_SetParams", "Unit_hipGraphExecChildGraphNodeSetParams_BasicFunc", - "Unit_hipGraphExecChildGraphNodeSetParams_ChildTopology" + "Unit_hipGraphExecChildGraphNodeSetParams_ChildTopology", + "Unit_hipGraphMemcpyNodeSetParams1D_Functional", + "Unit_hipGraphMemcpyNodeSetParamsToSymbol_Functional" ] } diff --git a/tests/catch/unit/graph/hipGraphMemcpyNodeSetParamsToSymbol.cc b/tests/catch/unit/graph/hipGraphMemcpyNodeSetParamsToSymbol.cc index 804c502a0c..2e30ce00f7 100644 --- a/tests/catch/unit/graph/hipGraphMemcpyNodeSetParamsToSymbol.cc +++ b/tests/catch/unit/graph/hipGraphMemcpyNodeSetParamsToSymbol.cc @@ -1,3 +1,41 @@ +/* +Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/** +Testcase Scenarios of hipGraphMemcpyNodeSetParamsToSymbol API: +Functional : +1) Allocate global symbol memory, add the node to the graph. + Set/Update the new values to the node. Make sure they are taking effect. +2) Allocate const symbol memory, add the node to the graph. + Set/Update the new values to the node. Make sure they are taking effect. +Negative : +1) Pass GraphNode as nullptr and check if api returns error. +2) Pass symbol ptr as nullptr, api expected to return error code. +3) Pass src ptr as nullptr, api expected to return error code. +4) Pass count as zero, api expected to return error code. +5) Pass count more than allocated size for source and destination ptr, api should return error code. +6) Pass offset+count greater than allocated size, api expected to return error code. +7) Pass same pointer as source ptr and symbol ptr, api expected to return error code. +8) Pass both destination ptr and source ptr as 2 different symbol ptr, api expected to return error code. +9) Copy from host ptr to device ptr but pass kind as different, api expected to return error code. +*/ + #include #include #include @@ -6,6 +44,17 @@ __device__ int globalIn[SIZE], globalOut[SIZE]; __device__ __constant__ int globalConst[SIZE]; +__global__ void CpyToSymbolKernel(int* B_d) { + for (int i = 0 ; i < SIZE; i++) { + B_d[i] = globalIn[i]; + } +} + +__global__ void CpyToConstSymbolKernel(int* B_d) { + for (int i = 0 ; i < SIZE; i++) { + B_d[i] = globalConst[i]; + } +} /* This testcase verifies negative scenarios of hipGraphMemcpyNodeSetParamsToSymbol API */ @@ -33,7 +82,6 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Negative") { HIP_SYMBOL(globalIn), A_d, Nbytes, 0, hipMemcpyDeviceToDevice)); - SECTION("Pass GraphNode as nullptr") { ret = hipGraphMemcpyNodeSetParamsToSymbol(nullptr, HIP_SYMBOL(globalIn), @@ -62,7 +110,6 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Negative") { hipMemcpyDeviceToDevice); REQUIRE(hipErrorInvalidValue == ret); } - SECTION("Pass count more than allocated size for source and dstn ptr") { ret = hipGraphMemcpyNodeSetParamsToSymbol(memcpyToSymbolNode, HIP_SYMBOL(globalIn), @@ -104,4 +151,114 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Negative") { HipTest::freeArrays(A_d, B_d, nullptr, A_h, B_h, nullptr, false); HIP_CHECK(hipGraphDestroy(graph)); -} \ No newline at end of file +} + +static +void hipGraphMemcpyNodeSetParamsToSymbol_GlobalMem(bool useConstDeviceVar) { + constexpr size_t Nbytes = SIZE * sizeof(int); + constexpr auto blocksPerCU = 6; // to hide latency + constexpr auto threadsPerBlock = 256; + unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, SIZE); + hipGraphNode_t memcpytosymbolkernel, memcpyD2H_B; + hipKernelNodeParams kernelNodeParams{}; + int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr}; + int *A_h{nullptr}, *B_h{nullptr}; + HipTest::initArrays(&A_d, &B_d, &C_d, + &A_h, &B_h, nullptr, SIZE, false); + + hipGraph_t graph; + hipGraphExec_t graphExec; + hipGraphNode_t memcpyToSymbolNode, memcpyH2D_A; + std::vector dependencies; + HIP_CHECK(hipGraphCreate(&graph, 0)); + + // Adding MemcpyNode + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, 0, A_d, A_h, + Nbytes, hipMemcpyHostToDevice)); + dependencies.push_back(memcpyH2D_A); + + if (useConstDeviceVar) { + HIP_CHECK(hipGraphAddMemcpyNodeToSymbol(&memcpyToSymbolNode, graph, + dependencies.data(), + dependencies.size(), + HIP_SYMBOL(globalConst), + C_d, Nbytes, 0, + hipMemcpyDeviceToDevice)); + } else { + HIP_CHECK(hipGraphAddMemcpyNodeToSymbol(&memcpyToSymbolNode, graph, + dependencies.data(), + dependencies.size(), + HIP_SYMBOL(globalIn), + C_d, Nbytes, 0, + hipMemcpyDeviceToDevice)); + } + dependencies.clear(); + dependencies.push_back(memcpyToSymbolNode); + + // Update the node with source pointer from C_d to A_d + if (useConstDeviceVar) { + HIP_CHECK(hipGraphMemcpyNodeSetParamsToSymbol(memcpyToSymbolNode, + HIP_SYMBOL(globalConst), A_d, + Nbytes, 0, + hipMemcpyDeviceToDevice)); + } else { + HIP_CHECK(hipGraphMemcpyNodeSetParamsToSymbol(memcpyToSymbolNode, + HIP_SYMBOL(globalIn), A_d, + Nbytes, 0, + hipMemcpyDeviceToDevice)); + } + + // Adding Kernel node + void* kernelArgs1[] = {&B_d}; + if (useConstDeviceVar) + kernelNodeParams.func = reinterpret_cast(CpyToConstSymbolKernel); + else + kernelNodeParams.func = reinterpret_cast(CpyToSymbolKernel); + kernelNodeParams.gridDim = dim3(blocks); + kernelNodeParams.blockDim = dim3(threadsPerBlock); + kernelNodeParams.sharedMemBytes = 0; + kernelNodeParams.kernelParams = reinterpret_cast(kernelArgs1); + kernelNodeParams.extra = nullptr; + HIP_CHECK(hipGraphAddKernelNode(&memcpytosymbolkernel, graph, + dependencies.data(), dependencies.size(), + &kernelNodeParams)); + dependencies.clear(); + dependencies.push_back(memcpytosymbolkernel); + + // Adding MemcpyNode + HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_B, graph, dependencies.data(), + dependencies.size(), B_h, B_d, + Nbytes, hipMemcpyDeviceToHost)); + + // Instantiate and launch the graph + HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0)); + HIP_CHECK(hipGraphLaunch(graphExec, 0)); + + // Validating the result + for (int i = 0; i < SIZE; i++) { + if (B_h[i] != A_h[i]) { + WARN("Validation failed B_h[i] " << B_h[i] << "A_h[i] " << A_h[i]); + REQUIRE(false); + } + } + + HipTest::freeArrays(A_d, B_d, C_d, + A_h, B_h, nullptr, false); + HIP_CHECK(hipGraphExecDestroy(graphExec)); + HIP_CHECK(hipGraphDestroy(graph)); +} + +/* Test verifies hipGraphMemcpyNodeSetParamsToSymbol API Functional scenario. + 1) Allocate global symbol memory, add node to the graph. + Set/Update the new values to the node. Make sure they are taking effect. + 2) Allocate const symbol memory, add node to the graph. + Set/Update the new values to the node. Make sure they are taking effect. + */ +TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Functional") { + SECTION("Check and update with Global Device Symbol Memory") { + hipGraphMemcpyNodeSetParamsToSymbol_GlobalMem(false); + } + SECTION("Check and update with Constant Global Device Symbol Memory") { + hipGraphMemcpyNodeSetParamsToSymbol_GlobalMem(true); + } +} From 2c35e99c9def9e5821542efdeaf34d10ca5cd4f6 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Tue, 27 Sep 2022 15:19:06 +0530 Subject: [PATCH 38/39] [CI] Generate junit output (#2969) --- .jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 3cf3f582a2..cfa988f0f3 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -59,9 +59,9 @@ def hipBuildTest(String backendLabel) { # Check if backend label contains string "amd" or backend host is a server with amd gpu if [[ $backendLabel =~ amd ]]; then sleep 120 - LLVM_PATH=/opt/rocm/llvm ctest -E 'cooperative_streams_least_capacity.tst|cooperative_streams_half_capacity.tst|cooperative_streams_full_capacity.tst|grid_group_data_sharing.tst|hipIpcMemAccessTest.tst|p2p_copy_coherency.tst' + LLVM_PATH=/opt/rocm/llvm ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml -E 'cooperative_streams_least_capacity.tst|cooperative_streams_half_capacity.tst|cooperative_streams_full_capacity.tst|grid_group_data_sharing.tst|hipIpcMemAccessTest.tst|p2p_copy_coherency.tst' else - make test + ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml fi """ } @@ -102,9 +102,9 @@ def hipBuildTest(String backendLabel) { if [[ $backendLabel =~ amd ]]; then sleep 120 export HT_CONFIG_FILE="$HIP_DIR/tests/catch/hipTestMain/config/config_amd_linux.json" - LLVM_PATH=/opt/rocm/llvm ctest -E 'Unit_hipGraphChildGraphNodeGetGraph_Functional|Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative|Unit_hipPtrGetAttribute_Simple|Unit_hipStreamPerThread_DeviceReset_2' + LLVM_PATH=/opt/rocm/llvm ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml -E 'Unit_hipGraphChildGraphNodeGetGraph_Functional|Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative|Unit_hipPtrGetAttribute_Simple|Unit_hipStreamPerThread_DeviceReset_2' else - make test + ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml fi """ } From c02b15fc7c2a14ba04b9b0dc5015410264e4afcc Mon Sep 17 00:00:00 2001 From: Paulius Velesko Date: Sat, 1 Oct 2022 01:07:25 +0300 Subject: [PATCH 39/39] Catch2 Test Fixes (#2961) * test fixes * address PR comment * PR comment fixing Nvidia pass * add additional kernel launch checks * pr comments --- tests/catch/ABM/AddKernels/add.cc | 1 + tests/catch/TypeQualifiers/hipManagedKeyword.cc | 1 + tests/catch/include/hip_test_checkers.hh | 4 ++-- tests/catch/include/hip_test_common.hh | 1 + tests/catch/multiproc/hipIpcEventHandle.cc | 1 + tests/catch/multiproc/hipMallocConcurrencyMproc.cc | 2 +- tests/catch/stress/printf/Stress_printf_ComplexKernels.cc | 6 ++++++ tests/catch/stress/printf/Stress_printf_SimpleKernels.cc | 5 +++++ .../unit/cooperativeGrps/coalesced_groups_shfl_down.cc | 2 ++ .../unit/cooperativeGrps/coalesced_groups_shfl_up.cc | 2 ++ .../catch/unit/cooperativeGrps/simple_coalesced_groups.cc | 5 +++++ tests/catch/unit/device/hipDeviceSynchronize.cc | 8 +++++--- tests/catch/unit/device/hipGetDeviceProperties.cc | 1 + .../unit/deviceLib/AtomicAdd_Coherent_withnoUnsafeflag.cc | 1 + .../unit/deviceLib/AtomicAdd_Coherent_withoutflag.cc | 1 + .../unit/deviceLib/AtomicAdd_Coherent_withunsafeflag.cc | 1 + .../deviceLib/AtomicAdd_NonCoherent_withnoUnsafeflag.cc | 1 + .../unit/deviceLib/AtomicAdd_NonCoherent_withoutflag.cc | 1 + .../deviceLib/AtomicAdd_NonCoherent_withunsafeflag.cc | 1 + tests/catch/unit/deviceLib/BuiltIns_fadd.cc | 2 ++ tests/catch/unit/deviceLib/BuiltIns_fmax.cc | 3 +++ tests/catch/unit/deviceLib/BuiltIns_fmin.cc | 3 +++ tests/catch/unit/deviceLib/anyAll.cc | 1 + tests/catch/unit/deviceLib/ballot.cc | 1 + tests/catch/unit/deviceLib/bitExtract.cc | 1 + tests/catch/unit/deviceLib/bitInsert.cc | 1 + tests/catch/unit/deviceLib/brev.cc | 1 + tests/catch/unit/deviceLib/clz.cc | 1 + tests/catch/unit/deviceLib/ffs.cc | 1 + tests/catch/unit/deviceLib/floatMath.cc | 1 + tests/catch/unit/deviceLib/floatTM.cc | 1 + tests/catch/unit/deviceLib/funnelshift.cc | 2 +- tests/catch/unit/deviceLib/hipTestDeviceSymbol.cc | 7 +++++++ tests/catch/unit/deviceLib/ldg.cc | 5 +++-- tests/catch/unit/deviceLib/mbcnt.cc | 2 +- tests/catch/unit/deviceLib/popc.cc | 2 +- tests/catch/unit/deviceLib/syncthreadsand.cc | 2 +- tests/catch/unit/deviceLib/syncthreadscount.cc | 2 +- tests/catch/unit/deviceLib/syncthreadsor.cc | 2 +- tests/catch/unit/deviceLib/threadfence_system.cc | 1 + .../unsafeAtomicAdd_Coherent_withnounsafeflag.cc | 1 + .../deviceLib/unsafeAtomicAdd_Coherent_withoutflag.cc | 1 + .../deviceLib/unsafeAtomicAdd_Coherent_withunsafeflag.cc | 1 + .../unsafeAtomicAdd_NonCoherent_withnounsafeflag.cc | 1 + .../deviceLib/unsafeAtomicAdd_NonCoherent_withoutflag.cc | 1 + .../unsafeAtomicAdd_NonCoherent_withunsafeflag.cc | 1 + tests/catch/unit/deviceLib/vectorTypesDevice.cc | 3 ++- tests/catch/unit/event/Unit_hipEvent.cc | 5 +++-- tests/catch/unit/event/Unit_hipEventIpc.cc | 2 +- tests/catch/unit/event/Unit_hipEventRecord.cc | 2 +- tests/catch/unit/memory/hipHostRegister.cc | 3 ++- tests/catch/unit/memory/hipMallocConcurrency.cc | 4 ++-- tests/catch/unit/memory/hipMallocManaged.cc | 1 + tests/catch/unit/memory/hipMallocPitch.cc | 1 + tests/catch/unit/memory/hipMemcpy.cc | 7 ++++--- tests/catch/unit/memory/hipMemcpyAllApiNegative.cc | 1 + tests/catch/unit/memory/hipMemcpyAsync.cc | 8 +++++--- tests/catch/unit/memory/hipMemcpyDtoD.cc | 2 ++ tests/catch/unit/memory/hipMemcpyDtoDAsync.cc | 2 ++ tests/catch/unit/memory/hipMemcpyPeer.cc | 2 ++ tests/catch/unit/memory/hipMemcpyPeerAsync.cc | 4 ++++ tests/catch/unit/memory/hipMemcpyWithStream.cc | 8 ++++++++ tests/catch/unit/memory/hipMemcpyWithStreamMultiThread.cc | 8 ++++++++ tests/catch/unit/memory/hipMemoryAllocateCoherent.cc | 1 + .../unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc | 3 ++- tests/catch/unit/memory/hipMemset3DFunctional.cc | 2 +- tests/catch/unit/memory/hipMemset3DRegressMultiThread.cc | 1 + tests/catch/unit/memory/hipMemsetAsyncAndKernel.cc | 4 ++++ tests/catch/unit/memory/hipPointerGetAttribute.cc | 1 + tests/catch/unit/multiThread/hipMultiThreadStreams1.cc | 1 + tests/catch/unit/multiThread/hipMultiThreadStreams2.cc | 3 +++ tests/catch/unit/stream/hipAPIStreamDisable.cc | 2 ++ tests/catch/unit/stream/hipMultiStream.cc | 4 ++++ tests/catch/unit/stream/hipStreamACb_MultiThread.cc | 2 +- tests/catch/unit/stream/hipStreamAddCallback.cc | 4 ++-- tests/catch/unit/stream/hipStreamCreateWithPriority.cc | 3 +++ tests/catch/unit/stream/hipStreamWithCUMask.cc | 3 +++ tests/catch/unit/texture/hipBindTex2DPitch.cc | 1 + tests/catch/unit/texture/hipBindTexRef1DFetch.cc | 1 + tests/catch/unit/texture/hipNormalizedFloatValueTex.cc | 1 + tests/catch/unit/texture/hipSimpleTexture2DLayered.cc | 4 +++- tests/catch/unit/texture/hipSimpleTexture3D.cc | 1 + tests/catch/unit/texture/hipTex1DFetchCheckModes.cc | 1 + tests/catch/unit/texture/hipTexObjPitch.cc | 1 + tests/catch/unit/texture/hipTextureMipmapObj2D.cc | 1 + tests/catch/unit/texture/hipTextureObj1DCheckModes.cc | 1 + tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc | 2 ++ tests/catch/unit/texture/hipTextureObj1DFetch.cc | 1 + tests/catch/unit/texture/hipTextureObj2D.cc | 1 + tests/catch/unit/texture/hipTextureObj2DCheckModes.cc | 1 + tests/catch/unit/texture/hipTextureObj2DCheckSRGBModes.cc | 1 + tests/catch/unit/texture/hipTextureObj3DCheckModes.cc | 1 + tests/catch/unit/texture/hipTextureObjFetchVector.cc | 1 + tests/catch/unit/texture/hipTextureRef2D.cc | 1 + tests/src/cudaRegister.cu | 4 ++-- tests/src/runtimeApi/memory/hipHostGetFlags.cpp | 4 ++-- tests/src/runtimeApi/memory/hipHostMalloc.cpp | 4 ++-- 97 files changed, 183 insertions(+), 40 deletions(-) diff --git a/tests/catch/ABM/AddKernels/add.cc b/tests/catch/ABM/AddKernels/add.cc index 785d975945..1b7c56cdfa 100644 --- a/tests/catch/ABM/AddKernels/add.cc +++ b/tests/catch/ABM/AddKernels/add.cc @@ -29,6 +29,7 @@ TEMPLATE_TEST_CASE("ABM_AddKernel_MultiTypeMultiSize", "", int, long, float, lon REQUIRE(res == hipSuccess); hipLaunchKernelGGL(add, 1, size, 0, 0, d_a, d_b, d_c, size); + HIP_CHECK(hipGetLastError()); res = hipMemcpy(a.data(), d_c, sizeof(TestType) * size, hipMemcpyDeviceToHost); REQUIRE(res == hipSuccess); diff --git a/tests/catch/TypeQualifiers/hipManagedKeyword.cc b/tests/catch/TypeQualifiers/hipManagedKeyword.cc index 57462764a9..4d6a97b119 100644 --- a/tests/catch/TypeQualifiers/hipManagedKeyword.cc +++ b/tests/catch/TypeQualifiers/hipManagedKeyword.cc @@ -53,6 +53,7 @@ TEST_CASE("Unit_hipManagedKeyword_SingleGpu") { hipLaunchKernelGGL(add, dimGrid, dimBlock, 0, 0, static_cast(A), static_cast(B)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); float maxError = 0.0f; diff --git a/tests/catch/include/hip_test_checkers.hh b/tests/catch/include/hip_test_checkers.hh index 3e152f099b..bd1fa62610 100644 --- a/tests/catch/include/hip_test_checkers.hh +++ b/tests/catch/include/hip_test_checkers.hh @@ -26,7 +26,7 @@ THE SOFTWARE. #include #include #include - +#define TOL 0.001 #define guarantee(cond, str) \ { \ if (!(cond)) { \ @@ -45,7 +45,7 @@ size_t checkVectors(T* A, T* B, T* Out, size_t N, T (*F)(T a, T b), bool expectM size_t mismatchesToPrint = 10; for (size_t i = 0; i < N; i++) { T expected = F(A[i], B[i]); - if (Out[i] != expected) { + if (std::fabs(Out[i] - expected) > TOL) { if (mismatchCount == 0) { firstMismatch = i; } diff --git a/tests/catch/include/hip_test_common.hh b/tests/catch/include/hip_test_common.hh index 3a8501f62c..ed8412b673 100644 --- a/tests/catch/include/hip_test_common.hh +++ b/tests/catch/include/hip_test_common.hh @@ -270,6 +270,7 @@ void launchKernel(K kernel, Dim numBlocks, Dim numThreads, std::uint32_t memPerB launchRTCKernel(kernel, numBlocks, numThreads, memPerBlock, stream, std::forward(packedArgs)...); #endif +HIP_CHECK(hipGetLastError()); } //--- diff --git a/tests/catch/multiproc/hipIpcEventHandle.cc b/tests/catch/multiproc/hipIpcEventHandle.cc index 4a4be2eb5a..78b12bdff3 100644 --- a/tests/catch/multiproc/hipIpcEventHandle.cc +++ b/tests/catch/multiproc/hipIpcEventHandle.cc @@ -221,6 +221,7 @@ void runMultiProcKernel(ipcEventInfo_t *shmEventInfo, int index) { const dim3 blocks(BUF_SIZE / threads.x, 1); hipLaunchKernelGGL(computeKernel, dim3(blocks), dim3(threads), 0, 0, d_ptr + index *BUF_SIZE, d_ptr, index + 1); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipEventRecord(event)); // Barrier 2 : Signals that event is recorded diff --git a/tests/catch/multiproc/hipMallocConcurrencyMproc.cc b/tests/catch/multiproc/hipMallocConcurrencyMproc.cc index d13a31949d..7134801dac 100644 --- a/tests/catch/multiproc/hipMallocConcurrencyMproc.cc +++ b/tests/catch/multiproc/hipMallocConcurrencyMproc.cc @@ -120,7 +120,7 @@ static bool validateMemoryOnGPU(int gpu, bool concurOnOneGPU = false) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, N); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); if (!HipTest::checkVectorADD(A_h, B_h, C_h, N)) { diff --git a/tests/catch/stress/printf/Stress_printf_ComplexKernels.cc b/tests/catch/stress/printf/Stress_printf_ComplexKernels.cc index eec8e162f7..46bb6f74b1 100644 --- a/tests/catch/stress/printf/Stress_printf_ComplexKernels.cc +++ b/tests/catch/stress/printf/Stress_printf_ComplexKernels.cc @@ -276,12 +276,15 @@ bool test_printf_multistream(uint32_t num_blocks, hipLaunchKernelGGL(kernel_complex_opX, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, stream[i], Ad, Bd, iterCount); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(kernel_complex_opY, dim3(1, num_blocks, 1), dim3(1, threads_per_block, 1), 0, stream[i], Ad, Bd, iterCount); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(kernel_complex_opZ, dim3(1, 1, num_blocks), dim3(1, 1, threads_per_block), 0, stream[i], Ad, Bd, iterCount); + HIP_CHECK(hipGetLastError()); } HIP_CHECK(hipDeviceSynchronize()); for (int i = 0; i < NUM_STREAM; i++) { @@ -368,12 +371,15 @@ bool test_printf_multigpu(int gpu, hipLaunchKernelGGL(kernel_complex_opX, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, 0, Ad, Bd, iterCount); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(kernel_complex_opY, dim3(1, num_blocks, 1), dim3(1, threads_per_block, 1), 0, 0, Ad, Bd, iterCount); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(kernel_complex_opZ, dim3(1, 1, num_blocks), dim3(1, 1, threads_per_block), 0, 0, Ad, Bd, iterCount); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); std::ifstream CapturedData = captured.getCapturedData(); char *buffer = new char[CHUNK_SIZE]; diff --git a/tests/catch/stress/printf/Stress_printf_SimpleKernels.cc b/tests/catch/stress/printf/Stress_printf_SimpleKernels.cc index 1ec20ec873..82dc309313 100644 --- a/tests/catch/stress/printf/Stress_printf_SimpleKernels.cc +++ b/tests/catch/stress/printf/Stress_printf_SimpleKernels.cc @@ -246,6 +246,7 @@ bool test_printf_conststr(uint32_t num_blocks, uint32_t threads_per_block, hipLaunchKernelGGL(kernel_printf_conststr, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, 0, iterCount); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(0)); std::ifstream CapturedData = captured.getCapturedData(); char *buffer = new char[CHUNK_SIZE]; @@ -308,6 +309,7 @@ bool test_printf_two_conditionalstr(uint32_t num_blocks, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, 0, iterCount); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(0)); std::ifstream CapturedData = captured.getCapturedData(); char *buffer = new char[CHUNK_SIZE]; @@ -370,6 +372,7 @@ bool test_printf_single_conditionalstr(uint32_t num_blocks, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, 0, iterCount); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(0)); std::ifstream CapturedData = captured.getCapturedData(); char *buffer = new char[CHUNK_SIZE]; @@ -427,6 +430,7 @@ bool test_variable_str(uint32_t print_limit, hipLaunchKernelGGL(func, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, 0, iterCount, Ad); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(0)); HIP_CHECK(hipMemcpy(Ah, Ad, buffsize*sizeof(int32_t), hipMemcpyDeviceToHost)); @@ -483,6 +487,7 @@ bool test_decimal_str(uint32_t num_blocks, uint32_t threads_per_block, hipLaunchKernelGGL(kernel_decimal_calculation, dim3(num_blocks, 1, 1), dim3(threads_per_block, 1, 1), 0, 0, iterCount, maxPrecision); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(0)); std::ifstream CapturedData = captured.getCapturedData(); char *buffer = new char[CHUNK_SIZE]; diff --git a/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_down.cc b/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_down.cc index f4220f02bb..63d569c0e5 100644 --- a/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_down.cc +++ b/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_down.cc @@ -157,6 +157,7 @@ static void test_group_partition(unsigned int tileSz) { // Launch Kernel hipLaunchKernelGGL(kernel_cg_group_partition, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0, dResult, tileSz, i); + HIP_CHECK(hipGetLastError()); err = hipDeviceSynchronize(); if (err != hipSuccess) { fprintf(stderr, "Failed to launch kernel (error code %s)!\n", hipGetErrorString(err)); @@ -217,6 +218,7 @@ static void test_shfl_down() { // Launch Kernel hipLaunchKernelGGL(kernel_shfl_down, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0, dPtr, dResults, lane_delta, i); + HIP_CHECK(hipGetLastError()); hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost); err = hipDeviceSynchronize(); if (err != hipSuccess) { diff --git a/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_up.cc b/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_up.cc index c317452549..e3c9d3d9f4 100644 --- a/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_up.cc +++ b/tests/catch/unit/cooperativeGrps/coalesced_groups_shfl_up.cc @@ -138,6 +138,7 @@ static void test_group_partition(unsigned tileSz) { // Launch Kernel hipLaunchKernelGGL(kernel_cg_group_partition, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0, dPtr, tileSz, i); + HIP_CHECK(hipGetLastError()); hipMemcpy(hPtr, dPtr, arrSize, hipMemcpyDeviceToHost); err = hipDeviceSynchronize(); if (err != hipSuccess) { @@ -207,6 +208,7 @@ static void test_shfl_up() { hipLaunchKernelGGL(kernel_shfl_up, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0, dPtr, dResults, lane_delta, i); hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost); + HIP_CHECK(hipGetLastError()); err = hipDeviceSynchronize(); if (err != hipSuccess) { fprintf(stderr, "Failed to launch kernel (error code %s)!\n", hipGetErrorString(err)); diff --git a/tests/catch/unit/cooperativeGrps/simple_coalesced_groups.cc b/tests/catch/unit/cooperativeGrps/simple_coalesced_groups.cc index 008595a04d..cef1d94e96 100644 --- a/tests/catch/unit/cooperativeGrps/simple_coalesced_groups.cc +++ b/tests/catch/unit/cooperativeGrps/simple_coalesced_groups.cc @@ -244,6 +244,7 @@ static void test_active_threads_grouping() { // Launch Kernel hipLaunchKernelGGL(kernel_coalesced_active_groups, blockSize, threadsPerBlock, 0, 0); + HIP_CHECK(hipGetLastError()); err = hipDeviceSynchronize(); if (err != hipSuccess) { @@ -308,6 +309,7 @@ static void test_group_partition(unsigned int tileSz, bool useGlobalMem) { if (useGlobalMem) { hipLaunchKernelGGL(kernel_cg_coalesced_group_partition, blockSize, threadsPerBlock, 0, 0, tileSz, dResult, useGlobalMem, globalMem, i); + HIP_CHECK(hipGetLastError()); err = hipDeviceSynchronize(); if (err != hipSuccess) { @@ -316,6 +318,7 @@ static void test_group_partition(unsigned int tileSz, bool useGlobalMem) { } else { hipLaunchKernelGGL(kernel_cg_coalesced_group_partition, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0, tileSz, dResult, useGlobalMem, globalMem, i); + HIP_CHECK(hipGetLastError()); err = hipDeviceSynchronize(); if (err != hipSuccess) { @@ -390,6 +393,7 @@ static void test_shfl_any_to_any() { // Launch Kernel hipLaunchKernelGGL(kernel_shfl_any_to_any, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0 , dPtr, dsrcArr, dResults, i); + HIP_CHECK(hipGetLastError()); hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost); err = hipDeviceSynchronize(); if (err != hipSuccess) { @@ -459,6 +463,7 @@ static void test_shfl_broadcast() { // Launch Kernel hipLaunchKernelGGL(kernel_shfl, blockSize, threadsPerBlock, threadsPerBlock * sizeof(int), 0, dPtr, dResults, srcLane, i); + HIP_CHECK(hipGetLastError()); hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost); err = hipDeviceSynchronize(); if (err != hipSuccess) { diff --git a/tests/catch/unit/device/hipDeviceSynchronize.cc b/tests/catch/unit/device/hipDeviceSynchronize.cc index a73cc2b65e..0b54463159 100644 --- a/tests/catch/unit/device/hipDeviceSynchronize.cc +++ b/tests/catch/unit/device/hipDeviceSynchronize.cc @@ -27,6 +27,7 @@ THE SOFTWARE. #define _SIZE sizeof(int) * 1024 * 1024 #define NUM_STREAMS 2 +#define NUM_ITERS 1 << 30 static __global__ void Iter(int* Ad, int num) { int tx = threadIdx.x + blockIdx.x * blockDim.x; @@ -57,7 +58,8 @@ TEST_CASE("Unit_hipDeviceSynchronize_Functional") { } for (int i = 0; i < NUM_STREAMS; i++) { hipLaunchKernelGGL(HIP_KERNEL_NAME(Iter), dim3(1), dim3(1), 0, - stream[i], Ad[i], 1 << 30); + stream[i], Ad[i], NUM_ITERS); + HIP_CHECK(hipGetLastError()); } for (int i = 0; i < NUM_STREAMS; i++) { HIP_CHECK(hipMemcpyAsync(A[i], Ad[i], _SIZE, hipMemcpyDeviceToHost, @@ -71,7 +73,7 @@ TEST_CASE("Unit_hipDeviceSynchronize_Functional") { // Conservative implementations which synchronize the hipMemcpyAsync will // fail, ie if HIP_LAUNCH_BLOCKING=true. - CHECK(1 << 30 != A[NUM_STREAMS - 1][0] - 1); + CHECK(NUM_ITERS != A[NUM_STREAMS - 1][0] - 1); HIP_CHECK(hipDeviceSynchronize()); - CHECK(1 << 30 == A[NUM_STREAMS - 1][0] - 1); + CHECK(NUM_ITERS == A[NUM_STREAMS - 1][0] - 1); } diff --git a/tests/catch/unit/device/hipGetDeviceProperties.cc b/tests/catch/unit/device/hipGetDeviceProperties.cc index 0bb97af52c..ae8d7db439 100644 --- a/tests/catch/unit/device/hipGetDeviceProperties.cc +++ b/tests/catch/unit/device/hipGetDeviceProperties.cc @@ -163,6 +163,7 @@ TEST_CASE("Unit_hipGetDeviceProperties_ArchPropertiesTst") { hipMemcpyHostToDevice)); hipLaunchKernelGGL(mykernel, dim3(1), dim3(1), 0, 0, archProp_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(archProp_h, archProp_d, NUM_OF_ARCHPROP*sizeof(int), hipMemcpyDeviceToHost)); // Validate the host architecture property with device diff --git a/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withnoUnsafeflag.cc b/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withnoUnsafeflag.cc index 3622300514..58e0d1d6a2 100644 --- a/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withnoUnsafeflag.cc +++ b/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withnoUnsafeflag.cc @@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_Coherentwithnounsafeflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; testResult = HipTest::assemblyFile_Verification( diff --git a/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withoutflag.cc b/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withoutflag.cc index 4d12ea1f2c..300b84fed0 100644 --- a/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withoutflag.cc +++ b/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withoutflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_Coherentwithoutflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; testResult = HipTest::assemblyFile_Verification( diff --git a/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withunsafeflag.cc b/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withunsafeflag.cc index 27120d930e..5472b6225f 100644 --- a/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withunsafeflag.cc +++ b/tests/catch/unit/deviceLib/AtomicAdd_Coherent_withunsafeflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_CoherentwithUnsafeflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; diff --git a/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withnoUnsafeflag.cc b/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withnoUnsafeflag.cc index 01f6e6ec07..98df491998 100644 --- a/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withnoUnsafeflag.cc +++ b/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withnoUnsafeflag.cc @@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_NonCoherentwithnounsafeflag", "", dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withoutflag.cc b/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withoutflag.cc index a5d4c58e94..38ba5a5690 100644 --- a/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withoutflag.cc +++ b/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withoutflag.cc @@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_NonCoherentwithoutflag", "", dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withunsafeflag.cc b/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withunsafeflag.cc index 59e4ccfeb4..6bfff7262c 100644 --- a/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withunsafeflag.cc +++ b/tests/catch/unit/deviceLib/AtomicAdd_NonCoherent_withunsafeflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_NonCoherentwithUnsafeflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/BuiltIns_fadd.cc b/tests/catch/unit/deviceLib/BuiltIns_fadd.cc index 472e89491c..2eaaa94baa 100644 --- a/tests/catch/unit/deviceLib/BuiltIns_fadd.cc +++ b/tests/catch/unit/deviceLib/BuiltIns_fadd.cc @@ -76,6 +76,7 @@ TEST_CASE("Unit_BuiltInAtomicAdd_CoherentGlobalMem") { hipLaunchKernelGGL(AtomicAdd_GlobalMem, dim3(1), dim3(1), 0, 0, A_d, result); + HIP_CHECK(hipGetLastError()); std::cout << "test 1" << std::endl; HIP_CHECK(hipDeviceSynchronize()); REQUIRE(A_h[0] == INITIAL_VAL); @@ -118,6 +119,7 @@ TEST_CASE("Unit_BuiltInAtomicAdd_NonCoherentGlobalMem") { hipLaunchKernelGGL(AtomicAdd_GlobalMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(result)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost)); REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/BuiltIns_fmax.cc b/tests/catch/unit/deviceLib/BuiltIns_fmax.cc index 40f4c52397..5049348c61 100644 --- a/tests/catch/unit/deviceLib/BuiltIns_fmax.cc +++ b/tests/catch/unit/deviceLib/BuiltIns_fmax.cc @@ -112,6 +112,7 @@ TEST_CASE("Unit_BuiltinAtomics_fmaxCoherentGlobalMem") { HIP_CHECK(hipMalloc(reinterpret_cast(&result), sizeof(double))); hipLaunchKernelGGL(unsafeAtomicMax_GlobalMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), result); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost)); REQUIRE(*B_h == 0); @@ -159,9 +160,11 @@ TEST_CASE("Unit_BuiltinAtomics_fmaxNonCoherentGlobalFlatMem") { if (mem_type) { hipLaunchKernelGGL(unsafeAtomicMax_GlobalMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), result); + HIP_CHECK(hipGetLastError()); } else { hipLaunchKernelGGL(unsafeAtomicMax_FlatMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), result); + HIP_CHECK(hipGetLastError()); } HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/BuiltIns_fmin.cc b/tests/catch/unit/deviceLib/BuiltIns_fmin.cc index 8ff1814db3..25e52eff29 100644 --- a/tests/catch/unit/deviceLib/BuiltIns_fmin.cc +++ b/tests/catch/unit/deviceLib/BuiltIns_fmin.cc @@ -112,6 +112,7 @@ TEST_CASE("Unit_BuiltinAtomics_fminCoherentGlobalMem") { HIP_CHECK(hipMalloc(reinterpret_cast(&result), sizeof(double))); hipLaunchKernelGGL(unsafeAtomicMin_GlobalMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), result); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost)); REQUIRE(*B_h == 0); @@ -159,9 +160,11 @@ TEST_CASE("Unit_BuiltinAtomics_fminNonCoherentGlobalFlatMem") { if (mem_type) { hipLaunchKernelGGL(unsafeAtomicMin_GlobalMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), result); + HIP_CHECK(hipGetLastError()); } else { hipLaunchKernelGGL(unsafeAtomicMin_FlatMem, dim3(1), dim3(1), 0, 0, static_cast(A_d), result); + HIP_CHECK(hipGetLastError()); } HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/anyAll.cc b/tests/catch/unit/deviceLib/anyAll.cc index f9e690941c..9b4cfca3ec 100644 --- a/tests/catch/unit/deviceLib/anyAll.cc +++ b/tests/catch/unit/deviceLib/anyAll.cc @@ -65,6 +65,7 @@ TEST_CASE("Unit_AnyAll_CompileTest") { hipLaunchKernelGGL(warpvote, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0, device_any, device_all, pshift); + HIP_CHECK(hipGetLastError()); HIP_CHECK( hipMemcpy(host_any, device_any, Num_Warps_per_Grid * sizeof(int), hipMemcpyDeviceToHost)); HIP_CHECK( diff --git a/tests/catch/unit/deviceLib/ballot.cc b/tests/catch/unit/deviceLib/ballot.cc index 09de1fa5b6..d7870d1b15 100644 --- a/tests/catch/unit/deviceLib/ballot.cc +++ b/tests/catch/unit/deviceLib/ballot.cc @@ -66,6 +66,7 @@ TEST_CASE("Unit_ballot") { hipLaunchKernelGGL(gpu_ballot, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0, device_ballot, Num_Warps_per_Block, pshift); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(host_ballot, device_ballot, Num_Warps_per_Grid * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/bitExtract.cc b/tests/catch/unit/deviceLib/bitExtract.cc index b8997db021..9c97924572 100644 --- a/tests/catch/unit/deviceLib/bitExtract.cc +++ b/tests/catch/unit/deviceLib/bitExtract.cc @@ -146,6 +146,7 @@ TEST_CASE("Unit_bitExtract") { hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block), 0, 0, deviceOut32, deviceSrc032, deviceSrc132, deviceSrc232, deviceOut64, deviceSrc064, deviceSrc164, deviceSrc264); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostOut32, deviceOut32, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/bitInsert.cc b/tests/catch/unit/deviceLib/bitInsert.cc index 27a63663fd..57c1a66fd4 100644 --- a/tests/catch/unit/deviceLib/bitInsert.cc +++ b/tests/catch/unit/deviceLib/bitInsert.cc @@ -158,6 +158,7 @@ TEST_CASE("Unit_bitInsert") { hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block), 0, 0, deviceOut32, deviceSrc032, deviceSrc132, deviceSrc232, deviceSrc332, deviceOut64, deviceSrc064, deviceSrc164, deviceSrc264, deviceSrc364); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostOut32, deviceOut32, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/brev.cc b/tests/catch/unit/deviceLib/brev.cc index a28c0b688c..20d2395f2a 100644 --- a/tests/catch/unit/deviceLib/brev.cc +++ b/tests/catch/unit/deviceLib/brev.cc @@ -115,6 +115,7 @@ TEST_CASE("Unit_brev") { hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC, deviceD, WIDTH, HEIGHT); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/clz.cc b/tests/catch/unit/deviceLib/clz.cc index 82c7346f9c..f3edd42105 100644 --- a/tests/catch/unit/deviceLib/clz.cc +++ b/tests/catch/unit/deviceLib/clz.cc @@ -136,6 +136,7 @@ TEST_CASE("Unit_clz") { dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC, deviceD, WIDTH, HEIGHT); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/ffs.cc b/tests/catch/unit/deviceLib/ffs.cc index 7e3828e286..4cda0175f0 100644 --- a/tests/catch/unit/deviceLib/ffs.cc +++ b/tests/catch/unit/deviceLib/ffs.cc @@ -110,6 +110,7 @@ TEST_CASE("Unit_ffs") { dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC, deviceD, WIDTH, HEIGHT); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/floatMath.cc b/tests/catch/unit/deviceLib/floatMath.cc index 430df9a847..d13a251303 100644 --- a/tests/catch/unit/deviceLib/floatMath.cc +++ b/tests/catch/unit/deviceLib/floatMath.cc @@ -56,6 +56,7 @@ TEST_CASE("Unit_deviceFunctions_CompileTest") { res = hipMalloc((void**)&Outd, SIZE); REQUIRE(res == hipSuccess); hipLaunchKernelGGL(floatMath, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0, Ind, Outd); + HIP_CHECK(hipGetLastError()); res = hipDeviceSynchronize(); REQUIRE(res == hipSuccess); res = hipGetLastError(); diff --git a/tests/catch/unit/deviceLib/floatTM.cc b/tests/catch/unit/deviceLib/floatTM.cc index df04904d59..2ed208e392 100644 --- a/tests/catch/unit/deviceLib/floatTM.cc +++ b/tests/catch/unit/deviceLib/floatTM.cc @@ -129,6 +129,7 @@ template void testType(int msize) { auto kernel = testOperationsGPU; hipLaunchKernelGGL(kernel, 1, msize, 0, 0, d_fa, d_fb, msize); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(fc, d_fa, sizeof(T) * msize, hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/funnelshift.cc b/tests/catch/unit/deviceLib/funnelshift.cc index 881f51947a..f5b5cfefab 100644 --- a/tests/catch/unit/deviceLib/funnelshift.cc +++ b/tests/catch/unit/deviceLib/funnelshift.cc @@ -145,7 +145,7 @@ TEST_CASE("Unit_funnelshift") { hipLaunchKernelGGL(funnelshift_kernel, dim3(1), dim3(1), 0, 0, device_l_output, device_lc_output, device_r_output, device_rc_output); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(host_l_output, device_l_output, NUM_TESTS * sizeof(unsigned int), hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(host_lc_output, device_lc_output, NUM_TESTS * sizeof(unsigned int), diff --git a/tests/catch/unit/deviceLib/hipTestDeviceSymbol.cc b/tests/catch/unit/deviceLib/hipTestDeviceSymbol.cc index d1c39b600a..c7bfa59283 100644 --- a/tests/catch/unit/deviceLib/hipTestDeviceSymbol.cc +++ b/tests/catch/unit/deviceLib/hipTestDeviceSymbol.cc @@ -69,6 +69,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") { hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), Am, SIZE, 0, hipMemcpyHostToDevice, stream)); HIP_CHECK(hipStreamSynchronize(stream)); hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpyFromSymbolAsync(Cm, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream)); @@ -83,6 +84,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") { SECTION("Calling hipMemcpyTo/FromSymbol - validate value in host memory") { HIP_CHECK(hipMemcpyToSymbol(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice)); hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpyFromSymbol(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost)); @@ -99,6 +101,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") { hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice, stream)); HIP_CHECK(hipStreamSynchronize(stream)); hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost)); HIP_CHECK( hipMemcpyFromSymbolAsync(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream)); @@ -116,6 +119,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") { hipStreamPerThread)); HIP_CHECK(hipStreamSynchronize(hipStreamPerThread)); hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpyFromSymbolAsync(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, hipStreamPerThread)); @@ -139,6 +143,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") { HIP_CHECK(hipGetSymbolAddress((void**)&symbolAddress, HIP_SYMBOL(globalConst))); HIP_CHECK(hipMalloc((void**)&checkOkD, sizeof(bool))); hipLaunchKernelGGL(checkAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, symbolAddress, checkOkD); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost)); HIP_CHECK(hipFree(checkOkD)); HIP_ASSERT(checkOk); @@ -171,6 +176,7 @@ TEST_CASE("Unit_hipGetSymbolAddressAndSize_Validation") { HIP_CHECK(hipMalloc(&checkOkD, sizeof(bool))); hipLaunchKernelGGL(checkGlobalConstAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, symbolArrAddress, checkOkD); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost)); HIP_CHECK(hipFree(checkOkD)); HIP_ASSERT(checkOk); @@ -184,6 +190,7 @@ TEST_CASE("Unit_hipGetSymbolAddressAndSize_Validation") { HIP_CHECK(hipMalloc(&checkOkD, sizeof(bool))); hipLaunchKernelGGL(checkStaticConstVarAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, symbolVarAddress, checkOkD); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost)); HIP_CHECK(hipFree(checkOkD)); HIP_ASSERT(checkOk); diff --git a/tests/catch/unit/deviceLib/ldg.cc b/tests/catch/unit/deviceLib/ldg.cc index a485740e8c..eec83dd710 100644 --- a/tests/catch/unit/deviceLib/ldg.cc +++ b/tests/catch/unit/deviceLib/ldg.cc @@ -100,6 +100,7 @@ template int dataTypesRun() { dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, static_cast(deviceB), WIDTH, HEIGHT); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(T), hipMemcpyDeviceToHost)); @@ -148,7 +149,7 @@ template int dataTypesRun2() { dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, static_cast(deviceB), WIDTH, HEIGHT); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(T), hipMemcpyDeviceToHost)); @@ -198,7 +199,7 @@ template int dataTypesRun4() { dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, static_cast(deviceB), WIDTH, HEIGHT); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(T), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/mbcnt.cc b/tests/catch/unit/deviceLib/mbcnt.cc index f9ffa7ef72..1fc37ee1c3 100644 --- a/tests/catch/unit/deviceLib/mbcnt.cc +++ b/tests/catch/unit/deviceLib/mbcnt.cc @@ -63,7 +63,7 @@ TEST_CASE("Unit_mbcnt") { hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block), 0, 0, device_mbcnt_lo, device_mbcnt_hi, device_lane_id); - + HIP_CHECK(hipGetLastError()); unsigned int* host_mbcnt_lo = (unsigned int*)malloc(buffer_size); unsigned int* host_mbcnt_hi = (unsigned int*)malloc(buffer_size); unsigned int* host_lane_id = (unsigned int*)malloc(buffer_size); diff --git a/tests/catch/unit/deviceLib/popc.cc b/tests/catch/unit/deviceLib/popc.cc index 29d9764692..a86bb11320 100644 --- a/tests/catch/unit/deviceLib/popc.cc +++ b/tests/catch/unit/deviceLib/popc.cc @@ -100,7 +100,7 @@ TEST_CASE("Unit_popc") { hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y), dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB, deviceC, deviceD, WIDTH, HEIGHT); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(hostC, deviceC, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/syncthreadsand.cc b/tests/catch/unit/deviceLib/syncthreadsand.cc index 04a364345b..4bbc2efcd2 100644 --- a/tests/catch/unit/deviceLib/syncthreadsand.cc +++ b/tests/catch/unit/deviceLib/syncthreadsand.cc @@ -88,7 +88,7 @@ static void test_syncthreads_and(int blockSize) { // Launch Kernel hipLaunchKernelGGL(kernel_syncthreads_and, 2, blockSize, 0, 0, syncTestD, allThreadsZeroD, allThreadsOneD, oneThreadZeroD, allThreadsMinusOneD); - + HIP_CHECK(hipGetLastError()); // Copy result from device to host HIP_CHECK(hipMemcpy(syncTestH, syncTestD, nBytes, hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(allThreadsZeroH, allThreadsZeroD, nBytes, hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/syncthreadscount.cc b/tests/catch/unit/deviceLib/syncthreadscount.cc index ee66810d7f..9a78dadfee 100644 --- a/tests/catch/unit/deviceLib/syncthreadscount.cc +++ b/tests/catch/unit/deviceLib/syncthreadscount.cc @@ -95,7 +95,7 @@ void test_syncthreads_count(int blockSize) { // Launch Kernel hipLaunchKernelGGL(kernel_syncthreads_count, 2, blockSize, 0, 0, syncTestD, allThreadsZeroD, allThreadsOneD, oddThreadsOneD, allThreadsMinusOneD, allThreadsIdD); - + HIP_CHECK(hipGetLastError()); // Copy result from device to host HIP_CHECK(hipMemcpy(syncTestH, syncTestD, nBytes, hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(allThreadsZeroH, allThreadsZeroD, nBytes, hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/syncthreadsor.cc b/tests/catch/unit/deviceLib/syncthreadsor.cc index 511c655ad3..a06bc32795 100644 --- a/tests/catch/unit/deviceLib/syncthreadsor.cc +++ b/tests/catch/unit/deviceLib/syncthreadsor.cc @@ -88,7 +88,7 @@ static void test_syncthreads_or(int blockSize) { // Launch Kernel hipLaunchKernelGGL(kernel_syncthreads_or, 2, blockSize, 0, 0, syncTestD, allThreadsZeroD, allThreadsOneD, oneThreadOneD, allThreadsMinusOneD); - + HIP_CHECK(hipGetLastError()); // Copy result from device to host HIP_CHECK(hipMemcpy(syncTestH, syncTestD, nBytes, hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(allThreadsZeroH, allThreadsZeroD, nBytes, hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/deviceLib/threadfence_system.cc b/tests/catch/unit/deviceLib/threadfence_system.cc index 322d19507f..5d65366708 100644 --- a/tests/catch/unit/deviceLib/threadfence_system.cc +++ b/tests/catch/unit/deviceLib/threadfence_system.cc @@ -92,6 +92,7 @@ TEST_CASE("Unit_threadfence_system") { HIP_CHECK(hipSetDevice(next_id - 1)); hipLaunchKernelGGL(gpu_round_robin, dim_grid, dim_block, 0, 0x0, next_id, num_dev, num_iter, data, flag); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); })); } diff --git a/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withnounsafeflag.cc b/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withnounsafeflag.cc index 384347de77..596fb1ef04 100644 --- a/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withnounsafeflag.cc +++ b/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withnounsafeflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentwithnoUnsafeflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; diff --git a/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withoutflag.cc b/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withoutflag.cc index 993705b764..685f91c6ca 100644 --- a/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withoutflag.cc +++ b/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withoutflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_Coherentwithoutflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; diff --git a/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withunsafeflag.cc b/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withunsafeflag.cc index 868257384a..4263e412e1 100644 --- a/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withunsafeflag.cc +++ b/tests/catch/unit/deviceLib/unsafeAtomicAdd_Coherent_withunsafeflag.cc @@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentwithUnsafeflag", "", hipLaunchKernelGGL(AtomicCheck, dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; diff --git a/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withnounsafeflag.cc b/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withnounsafeflag.cc index aff54abd14..b0f1d86421 100644 --- a/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withnounsafeflag.cc +++ b/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withnounsafeflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_NonCoherentnounsafeatomicsflag", "", dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withoutflag.cc b/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withoutflag.cc index d0b611d89c..fc298a8592 100644 --- a/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withoutflag.cc +++ b/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withoutflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_NonCoherentwithoutflag", "", dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withunsafeflag.cc b/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withunsafeflag.cc index ba4af3df96..bff5e00483 100644 --- a/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withunsafeflag.cc +++ b/tests/catch/unit/deviceLib/unsafeAtomicAdd_NonCoherent_withunsafeflag.cc @@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_NonCoherentwithunsafeatomicsflag", "", dim3(1), dim3(1), 0, 0, A_d, result_d); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); bool testResult; REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL); diff --git a/tests/catch/unit/deviceLib/vectorTypesDevice.cc b/tests/catch/unit/deviceLib/vectorTypesDevice.cc index c4237e28ed..5a842809f4 100644 --- a/tests/catch/unit/deviceLib/vectorTypesDevice.cc +++ b/tests/catch/unit/deviceLib/vectorTypesDevice.cc @@ -224,6 +224,7 @@ template bool run_CheckSharedVectorType() { if (hipMalloc(&ptr, sizeof(bool)) != HIP_SUCCESS) return false; unique_ptr correct{ptr, hipFree}; hipLaunchKernelGGL((CheckSharedVectorType), dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, correct.get()); + HIP_CHECK(hipGetLastError()); bool passed = true; if (hipMemcpyDtoH(&passed, correct.get(), sizeof(bool)) != HIP_SUCCESS) { return false; @@ -252,7 +253,7 @@ TEST_CASE("Unit_vectorTypes_CompileTest") { unique_ptr correct{ptr, hipFree}; hipLaunchKernelGGL(CheckVectorTypes, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, correct.get()); - + HIP_CHECK(hipGetLastError()); bool passed = true; res = hipMemcpyDtoH(&passed, correct.get(), sizeof(bool)); REQUIRE(res == hipSuccess); diff --git a/tests/catch/unit/event/Unit_hipEvent.cc b/tests/catch/unit/event/Unit_hipEvent.cc index d0b2fd0a1e..6654c58d5b 100644 --- a/tests/catch/unit/event/Unit_hipEvent.cc +++ b/tests/catch/unit/event/Unit_hipEvent.cc @@ -80,6 +80,7 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_ HIP_CHECK(hipEventRecord(start, stream)); hipLaunchKernelGGL(HipTest::addCountReverse, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(C_d), C_h, numElements, count); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipEventRecord(stop, stream)); if (waitStart) { @@ -111,7 +112,7 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_ REQUIRE(false); } - if (e == hipSuccess) assert(t == 0.0f); + if (e == hipSuccess) HIP_ASSERT(t == 0.0f); // stop usually ready unless we skipped the synchronization (syncNone) e = hipEventElapsedTime(&t, stop, stop); @@ -137,7 +138,7 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_ HIP_ASSERT(hipEventElapsedTime(&t, start, neverCreated) == hipErrorInvalidHandle); HIP_ASSERT(hipEventElapsedTime(&t, neverRecorded, stop) == hipErrorInvalidHandle); - HIP_ASSERT(hipEventElapsedTime(&t, start, neverRecorded) == hipErrorInvalidHandle); + HIP_ASSERT(hipGetLastError() == hipErrorInvalidHandle); } HIP_CHECK(hipEventDestroy(neverRecorded)); diff --git a/tests/catch/unit/event/Unit_hipEventIpc.cc b/tests/catch/unit/event/Unit_hipEventIpc.cc index 1d59089bf4..cc0d70ae71 100644 --- a/tests/catch/unit/event/Unit_hipEventIpc.cc +++ b/tests/catch/unit/event/Unit_hipEventIpc.cc @@ -65,7 +65,7 @@ TEST_CASE("Unit_hipEventIpc") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, N); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipEventRecord(stop, NULL)); HIP_CHECK(hipEventSynchronize(stop)); diff --git a/tests/catch/unit/event/Unit_hipEventRecord.cc b/tests/catch/unit/event/Unit_hipEventRecord.cc index 7bf5462637..70e5a684ec 100644 --- a/tests/catch/unit/event/Unit_hipEventRecord.cc +++ b/tests/catch/unit/event/Unit_hipEventRecord.cc @@ -88,7 +88,7 @@ TEST_CASE("Unit_hipEventRecord") { HipTest::launchKernel(HipTest::vectorADD, blocks, 1, 0, 0, static_cast(A_d), static_cast(B_d), C_d, N); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipEventRecord(stop, NULL)); HIP_CHECK(hipEventSynchronize(stop)); long long hostStop = HipTest::get_time(); diff --git a/tests/catch/unit/memory/hipHostRegister.cc b/tests/catch/unit/memory/hipHostRegister.cc index 8d30ae30f7..f6964db616 100644 --- a/tests/catch/unit/memory/hipHostRegister.cc +++ b/tests/catch/unit/memory/hipHostRegister.cc @@ -101,7 +101,8 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_ReferenceFromKernelandhipMemset", "", i // Reference the registered device pointer Ad from inside the kernel: for (int i = 0; i < num_devices; i++) { HIP_CHECK(hipSetDevice(i)); - hipLaunchKernelGGL(Inc, dim3(LEN / 512), dim3(512), 0, 0, Ad[i]); + hipLaunchKernelGGL(Inc, dim3(LEN / 32), dim3(32), 0, 0, Ad[i]); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); } REQUIRE(A[10] == 1 + static_cast(num_devices)); diff --git a/tests/catch/unit/memory/hipMallocConcurrency.cc b/tests/catch/unit/memory/hipMallocConcurrency.cc index 1283284022..885a13ee7e 100644 --- a/tests/catch/unit/memory/hipMallocConcurrency.cc +++ b/tests/catch/unit/memory/hipMallocConcurrency.cc @@ -111,7 +111,7 @@ static bool validateMemoryOnGPU(int gpu, bool concurOnOneGPU = false) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, N); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); if (!HipTest::checkVectorADD(A_h, B_h, C_h, N)) { @@ -219,7 +219,7 @@ static bool validateMemoryOnGpuMThread(int gpu, bool concurOnOneGPU = false) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, N); - + HIP_CHECK(hipGetLastError()); HIPCHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); if (!HipTest::checkVectorADD(A_h, B_h, C_h, N)) { diff --git a/tests/catch/unit/memory/hipMallocManaged.cc b/tests/catch/unit/memory/hipMallocManaged.cc index 672db36485..5921ec122e 100644 --- a/tests/catch/unit/memory/hipMallocManaged.cc +++ b/tests/catch/unit/memory/hipMallocManaged.cc @@ -114,6 +114,7 @@ TEST_CASE("Unit_hipMallocManaged_Advanced") { HIP_CHECK(hipEventRecord(event0, 0)); hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A), static_cast(B), C, numElements); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipEventRecord(event1, 0)); HIP_CHECK(hipDeviceSynchronize()); float time = 0.0f; diff --git a/tests/catch/unit/memory/hipMallocPitch.cc b/tests/catch/unit/memory/hipMallocPitch.cc index 47afb66fff..5a20671e14 100644 --- a/tests/catch/unit/memory/hipMallocPitch.cc +++ b/tests/catch/unit/memory/hipMallocPitch.cc @@ -536,6 +536,7 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_KernelLaunch", "" hipLaunchKernelGGL(copy_var, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), ROWS, pitch_A); + HIP_CHECK(hipGetLastError()); // hipMemcpy2D Device to Host diff --git a/tests/catch/unit/memory/hipMemcpy.cc b/tests/catch/unit/memory/hipMemcpy.cc index f6343e52fc..20860d2843 100644 --- a/tests/catch/unit/memory/hipMemcpy.cc +++ b/tests/catch/unit/memory/hipMemcpy.cc @@ -241,6 +241,7 @@ void memcpytest2(DeviceMemory* dmem, HostMemory* hmem, hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(dmem->A_d()), static_cast(dmem->B_d()), dmem->C_d(), numElements); + HIP_CHECK(hipGetLastError()); if (useDeviceToDevice) { // Do an extra device-to-device copy here to mix things up: @@ -402,7 +403,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_KernelLaunch", "", int, float, hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, NUM_ELM); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HIP_CHECK(hipDeviceSynchronize()); @@ -567,7 +568,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_PinnedRegMemWithKernelLaunch", hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, NUM_ELM); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM); @@ -595,7 +596,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_PinnedRegMemWithKernelLaunch", hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, NUM_ELM); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, Z_d, Nbytes, hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM); diff --git a/tests/catch/unit/memory/hipMemcpyAllApiNegative.cc b/tests/catch/unit/memory/hipMemcpyAllApiNegative.cc index 76a5da166a..7ea39d30be 100644 --- a/tests/catch/unit/memory/hipMemcpyAllApiNegative.cc +++ b/tests/catch/unit/memory/hipMemcpyAllApiNegative.cc @@ -319,6 +319,7 @@ TEST_CASE("Unit_hipMemcpy_HalfMemCopy") { HIP_CHECK(hipMemcpyAsync(B_h, A_d, (NUM_ELM/2)*sizeof(float), hipMemcpyDeviceToHost, stream)); + HIP_CHECK(hipDeviceSynchronize()); HipTest::checkTest(A_h, B_h, NUM_ELM/2); } HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); diff --git a/tests/catch/unit/memory/hipMemcpyAsync.cc b/tests/catch/unit/memory/hipMemcpyAsync.cc index b9798f963e..503763aed8 100644 --- a/tests/catch/unit/memory/hipMemcpyAsync.cc +++ b/tests/catch/unit/memory/hipMemcpyAsync.cc @@ -50,6 +50,7 @@ void Thread_func(T *A_d, T *B_d, T* C_d, T* C_h, size_t Nbytes, hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, mystream, A_d, C_d, N_ELMTS); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream)); // The following two MemcpyAsync calls are for sole // purpose of loading stream with multiple async calls @@ -76,6 +77,7 @@ void Thread_func_MultiStream() { hipLaunchKernelGGL((HipTest::vector_square), dim3(blocks), dim3(threadsPerBlock), 0, mystream, A_d, C_d, N_ELMTS); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream)); // The following hipMemcpyAsync() is called only to // load stream with multiple Async calls @@ -121,7 +123,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_KernelLaunch", "", int, float, hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, NUM_ELM); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, stream)); HIP_CHECK(hipStreamSynchronize(stream)); HIP_CHECK(hipStreamDestroy(stream)); @@ -348,7 +350,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_PinnedRegMemWithKernelLaunch", hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, NUM_ELM); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM); @@ -379,7 +381,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_PinnedRegMemWithKernelLaunch", hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, NUM_ELM); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, Z_d, Nbytes, hipMemcpyDeviceToHost, gpu1Stream)); HIP_CHECK(hipStreamSynchronize(gpu1Stream)); diff --git a/tests/catch/unit/memory/hipMemcpyDtoD.cc b/tests/catch/unit/memory/hipMemcpyDtoD.cc index ab6dc99ebe..ff5eb2c90c 100644 --- a/tests/catch/unit/memory/hipMemcpyDtoD.cc +++ b/tests/catch/unit/memory/hipMemcpyDtoD.cc @@ -66,6 +66,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoD_Basic", "", dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, NUM_ELM); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HIP_CHECK(hipDeviceSynchronize()); HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM); @@ -80,6 +81,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoD_Basic", "", dim3(1), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, NUM_ELM); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyDtoH(C_h, (hipDeviceptr_t)Z_d, Nbytes)); HIP_CHECK(hipDeviceSynchronize()); HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM); diff --git a/tests/catch/unit/memory/hipMemcpyDtoDAsync.cc b/tests/catch/unit/memory/hipMemcpyDtoDAsync.cc index af5be6d284..8dc20bf612 100644 --- a/tests/catch/unit/memory/hipMemcpyDtoDAsync.cc +++ b/tests/catch/unit/memory/hipMemcpyDtoDAsync.cc @@ -68,6 +68,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoDAsync_Basic", "", dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, NUM_ELM); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HIP_CHECK(hipDeviceSynchronize()); HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM); @@ -84,6 +85,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoDAsync_Basic", "", dim3(1), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, NUM_ELM); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyDtoHAsync(C_h, (hipDeviceptr_t)Z_d, Nbytes, stream)); HIP_CHECK(hipStreamSynchronize(stream)); HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/memory/hipMemcpyPeer.cc b/tests/catch/unit/memory/hipMemcpyPeer.cc index d991d95924..a8ebe9534f 100644 --- a/tests/catch/unit/memory/hipMemcpyPeer.cc +++ b/tests/catch/unit/memory/hipMemcpyPeer.cc @@ -127,6 +127,7 @@ TEST_CASE("Unit_hipMemcpyPeer_Basic") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, numElements*sizeof(int)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, numElements*sizeof(int), hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, numElements); @@ -138,6 +139,7 @@ TEST_CASE("Unit_hipMemcpyPeer_Basic") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, numElements*sizeof(int)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, Z_d, numElements*sizeof(int), hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, numElements); diff --git a/tests/catch/unit/memory/hipMemcpyPeerAsync.cc b/tests/catch/unit/memory/hipMemcpyPeerAsync.cc index c3a0b31501..1c738f1c76 100644 --- a/tests/catch/unit/memory/hipMemcpyPeerAsync.cc +++ b/tests/catch/unit/memory/hipMemcpyPeerAsync.cc @@ -143,6 +143,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Basic") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, numElements*sizeof(int)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, numElements*sizeof(int), hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, numElements); @@ -166,6 +167,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Basic") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, numElements*sizeof(int)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, Z_d, numElements*sizeof(int), hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, numElements); @@ -227,6 +229,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_StreamOnDiffDevice") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(A_d), static_cast(B_d), C_d, numElements*sizeof(int)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, C_d, numElements*sizeof(int), hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, numElements); @@ -240,6 +243,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_StreamOnDiffDevice") { hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0, static_cast(X_d), static_cast(Y_d), Z_d, numElements*sizeof(int)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy(C_h, Z_d, numElements*sizeof(int), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/memory/hipMemcpyWithStream.cc b/tests/catch/unit/memory/hipMemcpyWithStream.cc index f7e1be6001..5efc690b8d 100644 --- a/tests/catch/unit/memory/hipMemcpyWithStream.cc +++ b/tests/catch/unit/memory/hipMemcpyWithStream.cc @@ -99,6 +99,7 @@ void TestwithOnestream(void) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(A_d), static_cast(B_d), C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(stream)); HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); HipTest::checkVectorADD(A_h, B_h, C_h, N); @@ -136,6 +137,7 @@ void TestwithTwoStream(void) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NUM_STREAMS; ++i) { @@ -191,6 +193,7 @@ void TestDtoDonSameDevice(void) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NUM_STREAMS; ++i) { @@ -262,6 +265,7 @@ void TestOnMultiGPUwithOneStream(void) { dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NumDevices; ++i) { @@ -298,6 +302,7 @@ void TestkindDtoH(void) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(A_d), static_cast(B_d), C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(stream)); HIP_CHECK(hipMemcpyWithStream(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, stream)); @@ -365,6 +370,7 @@ void TestkindDtoD(void) { dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NumDevices; ++i) { @@ -411,6 +417,7 @@ void TestkindDefault(void) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(A_d), static_cast(B_d), C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(stream)); HIP_CHECK(hipMemcpyWithStream(C_h, C_d, Nbytes, hipMemcpyDefault, stream)); HipTest::checkVectorADD(A_h, B_h, C_h, N); @@ -472,6 +479,7 @@ void TestkindDefaultForDtoD(void) { dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NumDevices; ++i) { diff --git a/tests/catch/unit/memory/hipMemcpyWithStreamMultiThread.cc b/tests/catch/unit/memory/hipMemcpyWithStreamMultiThread.cc index 435a94ac2b..187654ac31 100644 --- a/tests/catch/unit/memory/hipMemcpyWithStreamMultiThread.cc +++ b/tests/catch/unit/memory/hipMemcpyWithStreamMultiThread.cc @@ -167,6 +167,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestwithOnestream(bool &val_res) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(A_d), static_cast(B_d), C_d, N); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipStreamSynchronize(stream)); HIPCHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost)); val_res = ValidateResult(A_h, B_h, C_h); @@ -203,6 +204,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestwithTwoStream(bool &val_res) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NoofStreams; ++i) { @@ -258,6 +260,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestDtoDonSameDevice(bool &val_res) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < NoofStreams; ++i) { @@ -329,6 +332,7 @@ void HipMemcpyWithStreamMultiThreadtests:: hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < numDevices; ++i) { @@ -363,6 +367,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestkindDtoH(bool &val_res) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(A_d), static_cast(B_d), C_d, N); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipStreamSynchronize(stream)); HIPCHECK(hipMemcpyWithStream(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, stream)); @@ -434,6 +439,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestkindDtoD(bool &val_res) { hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < numDevices; ++i) { @@ -481,6 +487,7 @@ void HipMemcpyWithStreamMultiThreadtests:: hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream, static_cast(A_d), static_cast(B_d), C_d, N); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipStreamSynchronize(stream)); HIPCHECK(hipMemcpyWithStream(C_h, C_d, Nbytes, hipMemcpyDefault, stream)); val_res = ValidateResult(A_h, B_h, C_h); @@ -544,6 +551,7 @@ void HipMemcpyWithStreamMultiThreadtests:: hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, stream[i], static_cast(A_d[i]), static_cast(B_d[i]), C_d[i], N); + HIP_CHECK(hipGetLastError()); } for (int i=0; i < numDevices; ++i) { diff --git a/tests/catch/unit/memory/hipMemoryAllocateCoherent.cc b/tests/catch/unit/memory/hipMemoryAllocateCoherent.cc index 0d14539191..50747e275d 100644 --- a/tests/catch/unit/memory/hipMemoryAllocateCoherent.cc +++ b/tests/catch/unit/memory/hipMemoryAllocateCoherent.cc @@ -53,6 +53,7 @@ TEST_CASE("Unit_hipHostMalloc_CoherentAccess") { std::cout << clkRate << std::endl; hipLaunchKernelGGL(HIP_KERNEL_NAME(Kernel), dim3(1), dim3(blocks), 0, 0, hostRes, clkRate); + HIP_CHECK(hipGetLastError()); int eleCounter = 0; while (eleCounter < blocks) { // blocks until the value changes diff --git a/tests/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc b/tests/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc index 89390bb908..3870f9bf6f 100644 --- a/tests/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc +++ b/tests/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc @@ -31,7 +31,7 @@ /* Defines */ #define NUM_THREADS 1000 -#define ITER 100 +#define ITER 10 #define NUM_H 256 #define NUM_W 256 @@ -105,6 +105,7 @@ TEST_CASE("Unit_hipMemset2DAsync_WithKernel") { for (size_t k = 0; k < ITER; k++) { hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, hipStreamPerThread, B_d, C_d, elements); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(hipStreamPerThread)); HIP_CHECK(hipMemset2DAsync(C_d, pitch_C, memsetval, NUM_W, NUM_H, hipStreamPerThread)); diff --git a/tests/catch/unit/memory/hipMemset3DFunctional.cc b/tests/catch/unit/memory/hipMemset3DFunctional.cc index 20e97278e5..11d36a70cc 100644 --- a/tests/catch/unit/memory/hipMemset3DFunctional.cc +++ b/tests/catch/unit/memory/hipMemset3DFunctional.cc @@ -369,7 +369,7 @@ static void seekAndSet3DArrayPortion(bool bAsync) { myparms.srcPos = make_hipPos(0, 0, 0); myparms.dstPos = make_hipPos(0, 0, 0); myparms.dstPtr = make_hipPitchedPtr(array3D, sizeof(char) * arr_dimensions.x, - arr_dimensions.x, arr_dimensions.y); + arr_dimensions.y, arr_dimensions.z); myparms.srcPtr = devicePitchedPointer; myparms.extent = extent; #if HT_NVIDIA diff --git a/tests/catch/unit/memory/hipMemset3DRegressMultiThread.cc b/tests/catch/unit/memory/hipMemset3DRegressMultiThread.cc index b3a65f2104..2f3c31933b 100644 --- a/tests/catch/unit/memory/hipMemset3DRegressMultiThread.cc +++ b/tests/catch/unit/memory/hipMemset3DRegressMultiThread.cc @@ -84,6 +84,7 @@ static void threadFunc(hipStream_t stream, hipPitchedPtr devpPtr, hipLaunchKernelGGL(func_set_value, dim3(blocks), dim3(threadsPerBlock), 0, stream, devpPtr, extent, memsetval); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipMemset3DAsync(devpPtr, testval, extent, stream)); HIPCHECK(hipMemcpy3DAsync(&myparms, stream)); } diff --git a/tests/catch/unit/memory/hipMemsetAsyncAndKernel.cc b/tests/catch/unit/memory/hipMemsetAsyncAndKernel.cc index a13e937de7..a3578e9b28 100644 --- a/tests/catch/unit/memory/hipMemsetAsyncAndKernel.cc +++ b/tests/catch/unit/memory/hipMemsetAsyncAndKernel.cc @@ -92,6 +92,7 @@ static bool testhipMemsetAsyncWithKernel(bool UseStrmPerThrd) { hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, hipStreamPerThread, obj.B_d, obj.C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamSynchronize(hipStreamPerThread)); HIP_CHECK(hipMemsetAsync(obj.C_d , obj.memSetVal, N, hipStreamPerThread)); HIP_CHECK(hipStreamSynchronize(hipStreamPerThread)); @@ -117,6 +118,7 @@ static bool testhipMemsetD32AsyncWithKernel() { for (int k = 0 ; k < ITER ; k++) { hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, obj.stream, obj.B_d, obj.C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemsetD32Async((hipDeviceptr_t)obj.C_d , obj.memSetVal, N, obj.stream)); HIP_CHECK(hipStreamSynchronize(obj.stream)); @@ -135,6 +137,7 @@ static bool testhipMemsetD16AsyncWithKernel() { for (int k = 0 ; k < ITER ; k++) { hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, obj.stream, obj.B_d, obj.C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemsetD16Async((hipDeviceptr_t)obj.C_d , obj.memSetVal, N, obj.stream)); HIP_CHECK(hipStreamSynchronize(obj.stream)); @@ -153,6 +156,7 @@ static bool testhipMemsetD8AsyncWithKernel() { for (int k = 0; k < ITER; k++) { hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, obj.stream, obj.B_d, obj.C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemsetD8Async((hipDeviceptr_t)obj.C_d, obj.memSetVal, N, obj.stream)); HIP_CHECK(hipStreamSynchronize(obj.stream)); diff --git a/tests/catch/unit/memory/hipPointerGetAttribute.cc b/tests/catch/unit/memory/hipPointerGetAttribute.cc index f56f0a0e49..393221da11 100644 --- a/tests/catch/unit/memory/hipPointerGetAttribute.cc +++ b/tests/catch/unit/memory/hipPointerGetAttribute.cc @@ -138,6 +138,7 @@ TEST_CASE("Unit_hipPointerGetAttribute_KernelUpdation") { reinterpret_cast(A_d))); hipLaunchKernelGGL(var_update, dim3(1), dim3(1), 0, 0, reinterpret_cast(data)); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(A_h, A_d, Nbytes, hipMemcpyDeviceToHost)); for (unsigned int i = 0; i < N; i++) { diff --git a/tests/catch/unit/multiThread/hipMultiThreadStreams1.cc b/tests/catch/unit/multiThread/hipMultiThreadStreams1.cc index d4e3af63bd..0d672c3146 100644 --- a/tests/catch/unit/multiThread/hipMultiThreadStreams1.cc +++ b/tests/catch/unit/multiThread/hipMultiThreadStreams1.cc @@ -74,6 +74,7 @@ void simpleVectorAdd(size_t numElements, int iters, hipStream_t stream) { hipLaunchKernelGGL(HipTest::vectorADDReverse, dim3(blocks), dim3(threadsPerBlock), 0, 0, static_cast(A_d), static_cast(B_d), C_d, numElements); + HIP_CHECK(hipGetLastError()); MemTraits::Copy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, stream); diff --git a/tests/catch/unit/multiThread/hipMultiThreadStreams2.cc b/tests/catch/unit/multiThread/hipMultiThreadStreams2.cc index d6b6573cb1..4ee323c05d 100644 --- a/tests/catch/unit/multiThread/hipMultiThreadStreams2.cc +++ b/tests/catch/unit/multiThread/hipMultiThreadStreams2.cc @@ -56,6 +56,7 @@ void run1(size_t size, hipStream_t stream) { HIPCHECK(hipMemcpyAsync(Bh, Ah, size, hipMemcpyHostToHost, stream)); HIPCHECK(hipMemcpyAsync(Cd, Bh, size, hipMemcpyHostToDevice, stream)); hipLaunchKernelGGL(HIP_KERNEL_NAME(Inc), dim3(N / 500), dim3(500), 0, stream, Cd); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipMemcpyAsync(Dd, Cd, size, hipMemcpyDeviceToDevice, stream)); HIPCHECK(hipMemcpyAsync(Eh, Dd, size, hipMemcpyDeviceToHost, stream)); HIPCHECK(hipDeviceSynchronize()); @@ -97,7 +98,9 @@ void run(size_t size, hipStream_t stream1, hipStream_t stream2) { HIPCHECK(hipMemcpyAsync(Cd, Bh, size, hipMemcpyHostToDevice, stream1)); HIPCHECK(hipMemcpyAsync(Cdd, Bhh, size, hipMemcpyHostToDevice, stream2)); hipLaunchKernelGGL(HIP_KERNEL_NAME(Inc), dim3(N / 500), dim3(500), 0, stream1, Cd); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(HIP_KERNEL_NAME(Inc), dim3(N / 500), dim3(500), 0, stream2, Cdd); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipMemcpyAsync(Dd, Cd, size, hipMemcpyDeviceToDevice, stream1)); HIPCHECK(hipMemcpyAsync(Ddd, Cdd, size, hipMemcpyDeviceToDevice, stream2)); HIPCHECK(hipMemcpyAsync(Eh, Dd, size, hipMemcpyDeviceToHost, stream1)); diff --git a/tests/catch/unit/stream/hipAPIStreamDisable.cc b/tests/catch/unit/stream/hipAPIStreamDisable.cc index 4c6c6693da..e1163471ef 100644 --- a/tests/catch/unit/stream/hipAPIStreamDisable.cc +++ b/tests/catch/unit/stream/hipAPIStreamDisable.cc @@ -59,8 +59,10 @@ TEST_CASE("Unit_hipStreamCreate_MultistreamBasicFunctionalities") { hipLaunchKernelGGL(HIP_KERNEL_NAME(hipAPIStreamDisableTest::kernel), dim3(1), dim3(1), 0, streams[i], data[i], xd, hipAPIStreamDisableTest::NN); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(HIP_KERNEL_NAME(hipAPIStreamDisableTest::nKernel), dim3(1), dim3(1), 0, 0, yd); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipStreamDestroy(streams[i])); } HIP_CHECK(hipMemcpy(&x, xd, sizeof(float), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/stream/hipMultiStream.cc b/tests/catch/unit/stream/hipMultiStream.cc index 64e4bb13b0..cffc9af887 100644 --- a/tests/catch/unit/stream/hipMultiStream.cc +++ b/tests/catch/unit/stream/hipMultiStream.cc @@ -49,7 +49,9 @@ TEST_CASE("Unit_hipMultiStream_sameDevice") { HIP_CHECK(hipStreamCreate(&streams[i])); HIP_CHECK(hipMalloc(&data[i], NN * sizeof(float))); hipLaunchKernelGGL(kernel, dim3(1), dim3(1), 0, streams[i], data[i], xd, NN); + HIP_CHECK(hipGetLastError()); hipLaunchKernelGGL(HIP_KERNEL_NAME(nKernel), dim3(1), dim3(1), 0, 0, yd); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipFree(data[i])); HIP_CHECK(hipStreamDestroy(streams[i])); } @@ -80,9 +82,11 @@ TEST_CASE("Unit_hipMultiStream_multimeDevice") { HIP_CHECK(hipDeviceSynchronize()); // Launch kernel with default stream hipLaunchKernelGGL(kernel_do_nothing, dim3(1), dim3(1), 0, 0, 1); + HIP_CHECK(hipGetLastError()); // Launch kernel on all streams for (int i = 0; i < nStreams; i++) { hipLaunchKernelGGL(kernel_do_nothing, dim3(1), dim3(1), 0, streams[i], 1); + HIP_CHECK(hipGetLastError()); } // Sync stream 1 HIP_CHECK(hipStreamSynchronize(streams[0])); diff --git a/tests/catch/unit/stream/hipStreamACb_MultiThread.cc b/tests/catch/unit/stream/hipStreamACb_MultiThread.cc index 07b999d72a..09946ced5d 100644 --- a/tests/catch/unit/stream/hipStreamACb_MultiThread.cc +++ b/tests/catch/unit/stream/hipStreamACb_MultiThread.cc @@ -131,7 +131,7 @@ TEST_CASE("Unit_hipStreamAddCallback_MultipleThreads") { hipLaunchKernelGGL((device_function), dim3(blocks), dim3(threadsPerBlock), 0, mystream, C_d, A_d, N); - + HIP_CHECK(hipGetLastError()); HIP_CHECK( hipMemcpyAsync(C1_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream)); diff --git a/tests/catch/unit/stream/hipStreamAddCallback.cc b/tests/catch/unit/stream/hipStreamAddCallback.cc index 15dd98741d..567cfa1686 100644 --- a/tests/catch/unit/stream/hipStreamAddCallback.cc +++ b/tests/catch/unit/stream/hipStreamAddCallback.cc @@ -86,7 +86,7 @@ bool testStreamCallbackFunctionality(bool isDefault) { const unsigned threadsPerBlock = 256; hipLaunchKernelGGL((HipTest::vector_square), dim3(blocks), dim3(threadsPerBlock), 0, 0, A_d, C_d, NSize); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, 0)); HIP_CHECK(hipStreamAddCallback(0, Callback, nullptr, 0)); @@ -102,7 +102,7 @@ bool testStreamCallbackFunctionality(bool isDefault) { const unsigned threadsPerBlock = 256; hipLaunchKernelGGL((HipTest::vector_square), dim3(blocks), dim3(threadsPerBlock), 0, mystream, A_d, C_d, NSize); - + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream)); HIP_CHECK(hipStreamAddCallback(mystream, Callback, nullptr, 0)); diff --git a/tests/catch/unit/stream/hipStreamCreateWithPriority.cc b/tests/catch/unit/stream/hipStreamCreateWithPriority.cc index 9405db8289..39b4b98061 100644 --- a/tests/catch/unit/stream/hipStreamCreateWithPriority.cc +++ b/tests/catch/unit/stream/hipStreamCreateWithPriority.cc @@ -146,6 +146,7 @@ void funcTestsForAllPriorityLevelsWrtNullStrm(unsigned int flags, hipLaunchKernelGGL((HipTest::vector_square), dim3(GRIDSIZE), dim3(BLOCKSIZE), 0, stream[idx], A_d[idx], C_d[idx], MEMCPYSIZE2); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h[idx], C_d[idx], size, hipMemcpyDeviceToHost, stream[idx])); } @@ -227,6 +228,7 @@ void queueTasksInStreams(std::vector *stream, hipLaunchKernelGGL((HipTest::vector_square), dim3(GRIDSIZE), dim3(BLOCKSIZE), 0, (*stream)[idx], A_d[idx], C_d[idx], MEMCPYSIZE2); + HIP_CHECK(hipGetLastError()); HIPCHECK(hipMemcpyAsync(C_h[idx], C_d[idx], size, hipMemcpyDeviceToHost, (*stream)[idx])); } @@ -426,6 +428,7 @@ bool validateStreamPrioritiesWithEvents() { hipLaunchKernelGGL((memcpy_kernel), dim3(GRIDSIZE), \ dim3(BLOCKSIZE), 0, stream_##x, dst_d_##x + j, src_d_##x + j, \ (MEMCPYSIZE / sizeof(T))); \ + HIP_CHECK(hipGetLastError()); \ } OP(low) OP(normal) diff --git a/tests/catch/unit/stream/hipStreamWithCUMask.cc b/tests/catch/unit/stream/hipStreamWithCUMask.cc index adf1db3e80..61535ed2cf 100644 --- a/tests/catch/unit/stream/hipStreamWithCUMask.cc +++ b/tests/catch/unit/stream/hipStreamWithCUMask.cc @@ -157,6 +157,7 @@ TEST_CASE("Unit_hipExtStreamCreateWithCUMask_ValidateCallbackFunc") { const unsigned threadsPerBlock = BLOCKSIZE; hipLaunchKernelGGL((HipTest::vector_square), dim3(blocks), dim3(threadsPerBlock), 0, mystream, A_d, C_d, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream)); HIP_CHECK(hipStreamAddCallback(mystream, Callback, nullptr, 0)); @@ -250,6 +251,7 @@ TEST_CASE("Unit_hipExtStreamCreateWithCUMask_Functionality") { hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, streams[0], dA[0], dC[0], N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); auto single_end = std::chrono::steady_clock::now(); @@ -269,6 +271,7 @@ TEST_CASE("Unit_hipExtStreamCreateWithCUMask_Functionality") { << streams[np] << " with CU mask: 0x" << ss[np].str().c_str()); hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks), dim3(threadsPerBlock), 0, streams[np], dA[np], dC[np], N); + HIP_CHECK(hipGetLastError()); } HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/texture/hipBindTex2DPitch.cc b/tests/catch/unit/texture/hipBindTex2DPitch.cc index fc5c5e5b59..4bd671af00 100644 --- a/tests/catch/unit/texture/hipBindTex2DPitch.cc +++ b/tests/catch/unit/texture/hipBindTex2DPitch.cc @@ -66,6 +66,7 @@ TEST_CASE("Unit_hipBindTexture2D_Pitch") { hipLaunchKernelGGL(texture2dCopyKernel, dim3(4, 4, 1), dim3(32, 32, 1), 0, 0, devPtrB); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy2D(B, SIZE_W*sizeof(TYPE_t), devPtrB, SIZE_W*sizeof(TYPE_t), SIZE_W*sizeof(TYPE_t), diff --git a/tests/catch/unit/texture/hipBindTexRef1DFetch.cc b/tests/catch/unit/texture/hipBindTexRef1DFetch.cc index 4e96abc806..7291b786bb 100644 --- a/tests/catch/unit/texture/hipBindTexRef1DFetch.cc +++ b/tests/catch/unit/texture/hipBindTexRef1DFetch.cc @@ -63,6 +63,7 @@ TEST_CASE("Unit_hipBindTexture_tex1DfetchVerification") { dim3 dimGrid(N / dimBlock.x, 1, 1); hipLaunchKernelGGL(kernel, dim3(dimGrid), dim3(dimBlock), 0, 0, devBuf); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(output, devBuf, N * sizeof(float), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/texture/hipNormalizedFloatValueTex.cc b/tests/catch/unit/texture/hipNormalizedFloatValueTex.cc index a6eceef38d..8e660c41cf 100644 --- a/tests/catch/unit/texture/hipNormalizedFloatValueTex.cc +++ b/tests/catch/unit/texture/hipNormalizedFloatValueTex.cc @@ -118,6 +118,7 @@ static void textureTest(texture, dim3(1, 1, 1), dim3(SIZE, 1, 1), 0, 0, SIZE, dOutputData); + HIP_CHECK(hipGetLastError()); float *hOutputData = new float[SIZE]; REQUIRE(hOutputData != nullptr); diff --git a/tests/catch/unit/texture/hipSimpleTexture2DLayered.cc b/tests/catch/unit/texture/hipSimpleTexture2DLayered.cc index fdf28458d2..1bf6ea3af7 100644 --- a/tests/catch/unit/texture/hipSimpleTexture2DLayered.cc +++ b/tests/catch/unit/texture/hipSimpleTexture2DLayered.cc @@ -86,9 +86,11 @@ TEST_CASE("Unit_hipSimpleTexture2DLayered_Check") { dim3 dimBlock(8, 8, 1); dim3 dimGrid(width / dimBlock.x, height / dimBlock.y, 1); - for (unsigned int layer = 0; layer < num_layers; layer++) + for (unsigned int layer = 0; layer < num_layers; layer++) { hipLaunchKernelGGL(simpleKernelLayeredArray, dimGrid, dimBlock, 0, 0, dData, width, height, layer); + HIP_CHECK(hipGetLastError()); + } HIP_CHECK(hipDeviceSynchronize()); // Allocate mem for the result on host side diff --git a/tests/catch/unit/texture/hipSimpleTexture3D.cc b/tests/catch/unit/texture/hipSimpleTexture3D.cc index 3d59101d51..0de3aec096 100644 --- a/tests/catch/unit/texture/hipSimpleTexture3D.cc +++ b/tests/catch/unit/texture/hipSimpleTexture3D.cc @@ -92,6 +92,7 @@ static void runSimpleTexture3D_Check(int width, int height, int depth, hipLaunchKernelGGL(simpleKernel3DArray, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, dData, width, height, depth); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); // Allocate mem for the result on host side diff --git a/tests/catch/unit/texture/hipTex1DFetchCheckModes.cc b/tests/catch/unit/texture/hipTex1DFetchCheckModes.cc index c3249411b6..158777e42b 100644 --- a/tests/catch/unit/texture/hipTex1DFetchCheckModes.cc +++ b/tests/catch/unit/texture/hipTex1DFetchCheckModes.cc @@ -79,6 +79,7 @@ static void runTest(hipTextureAddressMode addressMode, hipLaunchKernelGGL(tex1dKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, texBufOut, texObj); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(output, texBufOut, N * sizeof(float), diff --git a/tests/catch/unit/texture/hipTexObjPitch.cc b/tests/catch/unit/texture/hipTexObjPitch.cc index 6c7184bd3a..364bc79a21 100644 --- a/tests/catch/unit/texture/hipTexObjPitch.cc +++ b/tests/catch/unit/texture/hipTexObjPitch.cc @@ -85,6 +85,7 @@ TEMPLATE_TEST_CASE("Unit_hipTexObjPitch_texture2D", "", float, int, hipLaunchKernelGGL(texture2dCopyKernel, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, texObj, devPtrB); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipMemcpy2D(B, SIZE_W*sizeof(TestType), devPtrB, SIZE_W*sizeof(TestType), SIZE_W*sizeof(TestType), diff --git a/tests/catch/unit/texture/hipTextureMipmapObj2D.cc b/tests/catch/unit/texture/hipTextureMipmapObj2D.cc index 7545f2a073..7c55e6103e 100644 --- a/tests/catch/unit/texture/hipTextureMipmapObj2D.cc +++ b/tests/catch/unit/texture/hipTextureMipmapObj2D.cc @@ -97,6 +97,7 @@ static void runMipMapTest(unsigned int width, unsigned int height, unsigned int hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, textureObject, width, (2 * mipmap_level)); + HIP_CHECK(hipGetLastError()); hipDeviceSynchronize(); float* hOutputData = reinterpret_cast(malloc(size)); diff --git a/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc b/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc index 55f4910370..390ef5abc0 100644 --- a/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc +++ b/tests/catch/unit/texture/hipTextureObj1DCheckModes.cc @@ -73,6 +73,7 @@ static void runTest(const int width, const float offsetX) { hipLaunchKernelGGL(tex1DKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, offsetX); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc b/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc index c54bdfc2db..848a25bc89 100644 --- a/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc +++ b/tests/catch/unit/texture/hipTextureObj1DCheckSRGBModes.cc @@ -113,9 +113,11 @@ static void runTest(const int width, const float offsetX = 0) { if (resType == hipResourceTypeArray) { hipLaunchKernelGGL(tex1DRGBAKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, offsetX); + HIP_CHECK(hipGetLastError()); } else { hipLaunchKernelGGL(tex1DRGBAKernelFetch, dimGrid, dimBlock, 0, 0, dData, textureObject, offsetX); + HIP_CHECK(hipGetLastError()); } HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/texture/hipTextureObj1DFetch.cc b/tests/catch/unit/texture/hipTextureObj1DFetch.cc index a7e25c6a40..62c6c2c5c1 100644 --- a/tests/catch/unit/texture/hipTextureObj1DFetch.cc +++ b/tests/catch/unit/texture/hipTextureObj1DFetch.cc @@ -69,6 +69,7 @@ TEST_CASE("Unit_hipCreateTextureObject_tex1DfetchVerification") { hipLaunchKernelGGL(tex1dKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, texBufOut, texObj); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(output, texBufOut, N * sizeof(float), diff --git a/tests/catch/unit/texture/hipTextureObj2D.cc b/tests/catch/unit/texture/hipTextureObj2D.cc index 48efb13bb1..d545962165 100644 --- a/tests/catch/unit/texture/hipTextureObj2D.cc +++ b/tests/catch/unit/texture/hipTextureObj2D.cc @@ -85,6 +85,7 @@ TEST_CASE("Unit_hipTextureObj2D_Check") { hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, textureObject, width); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(hOutputData, dData, size, hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc b/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc index e9d1665c20..84f1081a2a 100644 --- a/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc +++ b/tests/catch/unit/texture/hipTextureObj2DCheckModes.cc @@ -81,6 +81,7 @@ static void runTest(const int width, const int height, const float offsetX, cons hipLaunchKernelGGL(tex2DKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, height, offsetX, offsetY); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/texture/hipTextureObj2DCheckSRGBModes.cc b/tests/catch/unit/texture/hipTextureObj2DCheckSRGBModes.cc index 5f44e2d7e9..73df5dd16b 100644 --- a/tests/catch/unit/texture/hipTextureObj2DCheckSRGBModes.cc +++ b/tests/catch/unit/texture/hipTextureObj2DCheckSRGBModes.cc @@ -86,6 +86,7 @@ static void runTest(const int width, const int height, const float offsetX, cons hipLaunchKernelGGL(tex2DRGBAKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, height, offsetX, offsetY); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc b/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc index b7f0a6215e..04d8433566 100644 --- a/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc +++ b/tests/catch/unit/texture/hipTextureObj3DCheckModes.cc @@ -113,6 +113,7 @@ static void runTest(const int width, const int height, const int depth, const fl hipLaunchKernelGGL(tex3DKernel, dimGrid, dimBlock, 0, 0, dData, textureObject, width, height, depth, offsetX, offsetY, offsetZ); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); diff --git a/tests/catch/unit/texture/hipTextureObjFetchVector.cc b/tests/catch/unit/texture/hipTextureObjFetchVector.cc index 616602038a..b965ac74e8 100644 --- a/tests/catch/unit/texture/hipTextureObjFetchVector.cc +++ b/tests/catch/unit/texture/hipTextureObjFetchVector.cc @@ -178,6 +178,7 @@ bool runTest() { hipLaunchKernelGGL(tex1dKernelFetch, dimGrid, dimBlock, 0, 0, texBufOut, texObj, N); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); HIP_CHECK(hipMemcpy(output, texBufOut, N * sizeof(T), hipMemcpyDeviceToHost)); diff --git a/tests/catch/unit/texture/hipTextureRef2D.cc b/tests/catch/unit/texture/hipTextureRef2D.cc index b4c98d7ae9..d0a31644be 100644 --- a/tests/catch/unit/texture/hipTextureRef2D.cc +++ b/tests/catch/unit/texture/hipTextureRef2D.cc @@ -69,6 +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); + HIP_CHECK(hipGetLastError()); HIP_CHECK(hipDeviceSynchronize()); float* hOutputData = reinterpret_cast(malloc(size)); diff --git a/tests/src/cudaRegister.cu b/tests/src/cudaRegister.cu index 64de0a468b..4712171898 100644 --- a/tests/src/cudaRegister.cu +++ b/tests/src/cudaRegister.cu @@ -69,8 +69,8 @@ int main(){ check("Registering A",status); cudaHostGetDevicePointer(&Ad, A, 0); cudaMalloc((void**)&Bd, SIZE); - dim3 dimGrid(LEN/512,1,1); - dim3 dimBlock(512,1,1); + dim3 dimGrid(LEN/256,1,1); + dim3 dimBlock(256,1,1); Inc1<<>>(Ad, Bd); sleep(3); A[0] = -(ITER*1.0f); diff --git a/tests/src/runtimeApi/memory/hipHostGetFlags.cpp b/tests/src/runtimeApi/memory/hipHostGetFlags.cpp index 449de741f9..85dc76960f 100644 --- a/tests/src/runtimeApi/memory/hipHostGetFlags.cpp +++ b/tests/src/runtimeApi/memory/hipHostGetFlags.cpp @@ -71,8 +71,8 @@ int main() { B[i] = 2.0f; } - dim3 dimGrid(LEN / 512, 1, 1); - dim3 dimBlock(512, 1, 1); + dim3 dimGrid(LEN / 256, 1, 1); + dim3 dimBlock(256, 1, 1); hipLaunchKernelGGL(HIP_KERNEL_NAME(Add), dimGrid, dimBlock, 0, 0, Ad, Bd, Cd); diff --git a/tests/src/runtimeApi/memory/hipHostMalloc.cpp b/tests/src/runtimeApi/memory/hipHostMalloc.cpp index e07127eee2..7af5bfdddf 100644 --- a/tests/src/runtimeApi/memory/hipHostMalloc.cpp +++ b/tests/src/runtimeApi/memory/hipHostMalloc.cpp @@ -134,8 +134,8 @@ int main() { HIPCHECK(hipMalloc((void**)&Bd, SIZE)); HIPCHECK(hipMemcpy(Bd, B, SIZE, hipMemcpyHostToDevice)); - dim3 dimGrid(LEN / 512, 1, 1); - dim3 dimBlock(512, 1, 1); + dim3 dimGrid(LEN / 256, 1, 1); + dim3 dimBlock(256, 1, 1); hipLaunchKernelGGL(Add, dimGrid, dimBlock, 0, 0, Ad, Bd, Cd);