diff --git a/catch/unit/graph/hipGraphAddMemcpyNode.cc b/catch/unit/graph/hipGraphAddMemcpyNode.cc index 745b29d41a..45e4077c66 100644 --- a/catch/unit/graph/hipGraphAddMemcpyNode.cc +++ b/catch/unit/graph/hipGraphAddMemcpyNode.cc @@ -66,6 +66,8 @@ Testcase Scenarios : Functional */ TEST_CASE("Unit_hipGraphAddMemcpyNode_Negative") { + CHECK_IMAGE_SUPPORT + constexpr int width{10}, height{10}, depth{10}; hipArray *devArray1; hipChannelFormatKind formatKind = hipChannelFormatKindSigned; @@ -479,6 +481,8 @@ static void validateMemcpyNode1DArray(bool peerAccess = false) { * Tests also verify memcpy node addition with 1D, 2D and 3D objects. */ TEST_CASE("Unit_hipGraphAddMemcpyNode_BasicFunctional") { + CHECK_IMAGE_SUPPORT + SECTION("Memcpy with 3D array on default device") { validateMemcpyNode3DArray(); } @@ -499,6 +503,8 @@ TEST_CASE("Unit_hipGraphAddMemcpyNode_BasicFunctional") { * Tests also verify memcpy node addition with 1D, 2D and 3D objects. */ TEST_CASE("Unit_hipGraphAddMemcpyNode_PeerAccessFunctional") { + CHECK_IMAGE_SUPPORT + int numDevices{}, peerAccess{}; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { diff --git a/catch/unit/graph/hipGraphAddMemsetNode.cc b/catch/unit/graph/hipGraphAddMemsetNode.cc index 1080741731..4d4359b2b1 100644 --- a/catch/unit/graph/hipGraphAddMemsetNode.cc +++ b/catch/unit/graph/hipGraphAddMemsetNode.cc @@ -56,6 +56,8 @@ static char memSetVal = 'a'; * - HIP_VERSION >= 5.2 */ TEMPLATE_TEST_CASE("Unit_hipGraphAddMemsetNode_Positive_Basic", "", uint8_t, uint16_t, uint32_t) { + CHECK_IMAGE_SUPPORT + const auto f = [](hipMemsetParams* params) { hipGraph_t graph = nullptr; HIP_CHECK(hipGraphCreate(&graph, 0)); @@ -129,6 +131,8 @@ TEST_CASE("Unit_hipGraphAddMemsetNode_Negative_Parameters") { * hipGraphAddMemcpyNode. Verify the results. */ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMallocPitch_2D") { + CHECK_IMAGE_SUPPORT + size_t width = SIZE * sizeof(char), numW{SIZE}, numH{SIZE}, pitch_A; char *A_d; @@ -198,6 +202,8 @@ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMallocPitch_2D") { * hipGraphAddMemcpyNode. Verify the results. */ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMallocPitch_1D") { + CHECK_IMAGE_SUPPORT + size_t width = SIZE * sizeof(char), numW{SIZE}, pitch_A; char *A_d; @@ -260,6 +266,8 @@ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMallocPitch_1D") { * hipGraphAddMemcpyNode. Verify the results. */ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMalloc3D_2D") { + CHECK_IMAGE_SUPPORT + size_t width = SIZE * sizeof(char); size_t numW = SIZE, numH = SIZE; @@ -337,6 +345,8 @@ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMalloc3D_2D") { * memory to host using hipGraphAddMemcpyNode. Verify the results. */ TEST_CASE("Unit_hipGraphAddMemsetNode_hipMalloc3D_1D") { + CHECK_IMAGE_SUPPORT + size_t width = SIZE * sizeof(char); size_t numW = SIZE; diff --git a/catch/unit/graph/hipGraphCloneComplx.cc b/catch/unit/graph/hipGraphCloneComplx.cc index 65d7b05e5c..52589cd105 100644 --- a/catch/unit/graph/hipGraphCloneComplx.cc +++ b/catch/unit/graph/hipGraphCloneComplx.cc @@ -482,6 +482,8 @@ static void hipGraphClone_Test_hipGraphMemcpyNodeSetParams() { } TEST_CASE("Unit_hipGraphClone_Test_hipGraphMemcpyNodeSetParams") { + CHECK_IMAGE_SUPPORT + hipGraphClone_Test_hipGraphMemcpyNodeSetParams(); } @@ -1873,6 +1875,9 @@ static void hipGraphClone_Test_All_API(int dev) { Run all the above writen test cases for multiple GPU scenarios */ TEST_CASE("Unit_hipGraphClone_multi_GPU_test") { + //FIXME: This test tests 3D as well, decouple it + CHECK_IMAGE_SUPPORT + int devcount = 0; HIP_CHECK(hipGetDeviceCount(&devcount)); // If only single GPU is detected then return diff --git a/catch/unit/graph/hipGraphDebugDotPrint.cc b/catch/unit/graph/hipGraphDebugDotPrint.cc index d3d559cbd2..8cea4756e9 100644 --- a/catch/unit/graph/hipGraphDebugDotPrint.cc +++ b/catch/unit/graph/hipGraphDebugDotPrint.cc @@ -295,6 +295,8 @@ static void hipGraphDebugDotPrint_Functional(const char* fName, Verify that DOT file get created or not for each flag passed. */ TEST_CASE("Unit_hipGraphDebugDotPrint_Functional") { + CHECK_IMAGE_SUPPORT + SECTION("Call with hipGraphDebugDotFlagsVerbose flag") { hipGraphDebugDotPrint_Functional("./graphDotFileFuncVerbose.dot", hipGraphDebugDotFlagsVerbose); diff --git a/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc b/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc index f849f45487..9e180f5117 100644 --- a/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc +++ b/catch/unit/graph/hipGraphExecMemcpyNodeSetParams.cc @@ -38,6 +38,8 @@ Negative- /* Test verifies hipGraphExecMemcpyNodeSetParams API Negative scenarios. */ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Negative") { + CHECK_IMAGE_SUPPORT + constexpr int width{10}, height{10}, depth{10}; hipArray *devArray, *devArray2; hipChannelFormatKind formatKind = hipChannelFormatKindSigned; @@ -152,6 +154,8 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Negative") { /* Test verifies hipGraphExecMemcpyNodeSetParams API Functional scenarios. */ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Functional") { + CHECK_IMAGE_SUPPORT + constexpr int XSIZE = 1024; int harray1D[XSIZE]{}; int harray1Dres[XSIZE]{}; diff --git a/catch/unit/graph/hipGraphExecMemcpyNodeSetParamsFromSymbol.cc b/catch/unit/graph/hipGraphExecMemcpyNodeSetParamsFromSymbol.cc index 8f31fdc0cf..6116966bea 100644 --- a/catch/unit/graph/hipGraphExecMemcpyNodeSetParamsFromSymbol.cc +++ b/catch/unit/graph/hipGraphExecMemcpyNodeSetParamsFromSymbol.cc @@ -184,17 +184,6 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative_Parameters") } #endif - if (HipTest::getDeviceCount() >= 2) { - SECTION("Changing dst allocation device") { - HIP_CHECK(hipSetDevice(1)); - LinearAllocGuard new_var(LinearAllocs::hipMalloc, sizeof(int)); - HIP_CHECK_ERROR(hipGraphExecMemcpyNodeSetParamsFromSymbol( - graph_exec, node, new_var.ptr(), SYMBOL(int_device_var), - sizeof(*new_var.ptr()), 0, hipMemcpyDeviceToDevice), - hipErrorInvalidValue); - } - } - HIP_CHECK(hipGraphExecDestroy(graph_exec)); HIP_CHECK(hipGraphDestroy(graph)); } diff --git a/catch/unit/graph/hipGraphExecMemsetNodeSetParams.cc b/catch/unit/graph/hipGraphExecMemsetNodeSetParams.cc index 72ea020ca8..edecbfad9a 100644 --- a/catch/unit/graph/hipGraphExecMemsetNodeSetParams.cc +++ b/catch/unit/graph/hipGraphExecMemsetNodeSetParams.cc @@ -56,6 +56,8 @@ THE SOFTWARE. */ TEMPLATE_TEST_CASE("Unit_hipGraphExecMemsetNodeSetParams_Positive_Basic", "", uint8_t, uint16_t, uint32_t) { + CHECK_IMAGE_SUPPORT + const size_t width = GENERATE(1, 64, kPageSize / sizeof(TestType) + 1); hipGraph_t graph = nullptr; @@ -129,6 +131,10 @@ TEMPLATE_TEST_CASE("Unit_hipGraphExecMemsetNodeSetParams_Positive_Basic", "", ui * - HIP_VERSION >= 5.2 */ TEST_CASE("Unit_hipGraphExecMemsetNodeSetParams_Negative_Parameters") { + // FIXME: this test tests 1D/2D/3D stuff in one single go, need to decouple it so that it can run + // on devices with no image support + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; hipGraph_t graph = nullptr; @@ -187,6 +193,8 @@ TEST_CASE("Unit_hipGraphExecMemsetNodeSetParams_Negative_Parameters") { * - HIP_VERSION >= 5.2 */ TEST_CASE("Unit_hipGraphExecMemsetNodeSetParams_Negative_Updating_Non1D_Node") { + CHECK_IMAGE_SUPPORT + hipGraph_t graph = nullptr; HIP_CHECK(hipGraphCreate(&graph, 0)); diff --git a/catch/unit/graph/hipGraphMemcpyNodeGetParams.cc b/catch/unit/graph/hipGraphMemcpyNodeGetParams.cc index 6393358bb2..17163f7ad4 100644 --- a/catch/unit/graph/hipGraphMemcpyNodeGetParams.cc +++ b/catch/unit/graph/hipGraphMemcpyNodeGetParams.cc @@ -39,6 +39,8 @@ Functional - /* Test verifies hipGraphMemcpyNodeGetParams API Negative scenarios. */ TEST_CASE("Unit_hipGraphMemcpyNodeGetParams_Negative") { + CHECK_IMAGE_SUPPORT + constexpr int width{SIZE}, height{SIZE}, depth{SIZE}; hipArray *devArray; hipChannelFormatKind formatKind = hipChannelFormatKindSigned; @@ -145,6 +147,8 @@ static bool memcpyNodeCompare(hipMemcpy3DParms *mNode1, } TEST_CASE("Unit_hipGraphMemcpyNodeGetParams_Functional") { + CHECK_IMAGE_SUPPORT + constexpr int width{SIZE}, height{SIZE}, depth{SIZE}; hipArray *devArray; hipChannelFormatKind formatKind = hipChannelFormatKindSigned; diff --git a/catch/unit/graph/hipGraphMemcpyNodeSetParams.cc b/catch/unit/graph/hipGraphMemcpyNodeSetParams.cc index 12cf7e22eb..01741dc034 100644 --- a/catch/unit/graph/hipGraphMemcpyNodeSetParams.cc +++ b/catch/unit/graph/hipGraphMemcpyNodeSetParams.cc @@ -38,6 +38,8 @@ Functional - /* Test verifies hipGraphMemcpyNodeSetParams API Negative scenarios. */ TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Negative") { + CHECK_IMAGE_SUPPORT + constexpr int width{SIZE}, height{SIZE}, depth{SIZE}; hipArray *devArray; hipChannelFormatKind formatKind = hipChannelFormatKindSigned; @@ -94,6 +96,8 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Negative") { /* Test verifies hipGraphMemcpyNodeSetParams API Functional scenarios. */ TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Functional") { + CHECK_IMAGE_SUPPORT + constexpr int width{SIZE}, height{SIZE}, depth{SIZE}; hipArray *devArray; hipChannelFormatKind formatKind = hipChannelFormatKindSigned; diff --git a/catch/unit/graph/hipGraphMemsetNodeGetParams.cc b/catch/unit/graph/hipGraphMemsetNodeGetParams.cc index b776b9171e..25fe849206 100644 --- a/catch/unit/graph/hipGraphMemsetNodeGetParams.cc +++ b/catch/unit/graph/hipGraphMemsetNodeGetParams.cc @@ -50,6 +50,8 @@ THE SOFTWARE. * - HIP_VERSION >= 5.2 */ TEST_CASE("Unit_hipGraphMemsetNodeGetParams_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + LinearAllocGuard2D alloc(1, 1); hipMemsetParams params = {}; params.dst = alloc.ptr(); diff --git a/catch/unit/graph/hipGraphMemsetNodeSetParams.cc b/catch/unit/graph/hipGraphMemsetNodeSetParams.cc index 937eaa06dd..d8f7cac249 100644 --- a/catch/unit/graph/hipGraphMemsetNodeSetParams.cc +++ b/catch/unit/graph/hipGraphMemsetNodeSetParams.cc @@ -54,6 +54,8 @@ THE SOFTWARE. */ TEMPLATE_TEST_CASE("Unit_hipGraphMemsetNodeSetParams_Positive_Basic", "", uint8_t, uint16_t, uint32_t) { + CHECK_IMAGE_SUPPORT + const auto f = [](hipMemsetParams* params) { hipGraph_t graph = nullptr; HIP_CHECK(hipGraphCreate(&graph, 0)); diff --git a/catch/unit/memory/hipArray.cc b/catch/unit/memory/hipArray.cc index 3afab53cfc..e3ca7ff902 100644 --- a/catch/unit/memory/hipArray.cc +++ b/catch/unit/memory/hipArray.cc @@ -18,6 +18,8 @@ THE SOFTWARE. */ #include TEST_CASE("Unit_hipArray_Valid") { + CHECK_IMAGE_SUPPORT + hipArray* array = nullptr; HIP_ARRAY_DESCRIPTOR desc; desc.Format = HIP_AD_FORMAT_FLOAT; @@ -27,17 +29,24 @@ TEST_CASE("Unit_hipArray_Valid") { HIP_CHECK(hipArrayCreate(&array, &desc)); HIP_CHECK(hipFreeArray(array)); } + TEST_CASE("Unit_hipArray_Invalid") { + CHECK_IMAGE_SUPPORT + void* data = malloc(sizeof(char)); hipArray_t arrayPtr = static_cast(data); REQUIRE(hipFreeArray(arrayPtr) == hipErrorContextIsDestroyed); free(data); } TEST_CASE("Unit_hipArray_Nullptr") { + CHECK_IMAGE_SUPPORT + hipArray* array = nullptr; REQUIRE(hipFreeArray(array) == hipErrorInvalidValue); } TEST_CASE("Unit_hipArray_DoubleFree") { + CHECK_IMAGE_SUPPORT + hipArray* array = nullptr; HIP_ARRAY_DESCRIPTOR desc; desc.Format = HIP_AD_FORMAT_FLOAT; @@ -49,6 +58,8 @@ TEST_CASE("Unit_hipArray_DoubleFree") { REQUIRE(hipFreeArray(array) == hipErrorContextIsDestroyed); } TEST_CASE("Unit_hipArray_TrippleDestroy") { + CHECK_IMAGE_SUPPORT + hipArray* array = nullptr; HIP_ARRAY_DESCRIPTOR desc; desc.Format = HIP_AD_FORMAT_FLOAT; @@ -61,11 +72,15 @@ TEST_CASE("Unit_hipArray_TrippleDestroy") { REQUIRE(hipArrayDestroy(array) == hipErrorContextIsDestroyed); } TEST_CASE("Unit_hipArray_DoubleNullptr") { + CHECK_IMAGE_SUPPORT + hipArray* array = nullptr; REQUIRE(hipFreeArray(array) == hipErrorInvalidValue); REQUIRE(hipFreeArray(array) == hipErrorInvalidValue); } TEST_CASE("Unit_hipArray_DoubleInvalid") { + CHECK_IMAGE_SUPPORT + void* data = malloc(sizeof(char)); hipArray_t arrayPtr = static_cast(data); REQUIRE(hipFreeArray(arrayPtr) == hipErrorContextIsDestroyed); diff --git a/catch/unit/memory/hipArray3DCreate.cc b/catch/unit/memory/hipArray3DCreate.cc index 4cf189611b..6a747abc27 100644 --- a/catch/unit/memory/hipArray3DCreate.cc +++ b/catch/unit/memory/hipArray3DCreate.cc @@ -50,6 +50,8 @@ void testInvalidDescription(HIP_ARRAY3D_DESCRIPTOR desc) { TEMPLATE_TEST_CASE("Unit_hipArray3DCreate_happy", "", char, uchar2, uint2, int4, short4, float, float2, float4) { + CHECK_IMAGE_SUPPORT + using vec_info = vector_info; DriverContext ctx; @@ -88,6 +90,8 @@ TEMPLATE_TEST_CASE("Unit_hipArray3DCreate_happy", "", char, uchar2, uint2, int4, TEMPLATE_TEST_CASE("Unit_hipArray3DCreate_MaxTexture", "", int, uint4, short, ushort2, unsigned char, float, float4) { + CHECK_IMAGE_SUPPORT + using vec_info = vector_info; DriverContext ctx; @@ -207,6 +211,8 @@ constexpr HIP_ARRAY3D_DESCRIPTOR defaultDescriptor(unsigned int flags, size_t si // Providing the array pointer as nullptr should return an error TEST_CASE("Unit_hipArray3DCreate_Negative_NullArrayPtr") { + CHECK_IMAGE_SUPPORT + auto desc = defaultDescriptor(0, 64); DriverContext ctx; @@ -215,6 +221,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_NullArrayPtr") { // Providing the description pointer as nullptr should return an error TEST_CASE("Unit_hipArray3DCreate_Negative_NullDescPtr") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; hiparray array; HIP_CHECK_ERROR(hipArray3DCreate(&array, nullptr), hipErrorInvalidValue); @@ -223,6 +231,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_NullDescPtr") { // Zero width arrays are not allowed TEST_CASE("Unit_hipArray3DCreate_Negative_ZeroWidth") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; unsigned int flags = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); @@ -235,6 +245,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_ZeroWidth") { // Zero height arrays are only allowed for 1D arrays and layered arrays TEST_CASE("Unit_hipArray3DCreate_Negative_ZeroHeight") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; unsigned int flags = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); @@ -255,6 +267,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_ZeroHeight") { // Arrays must be created with a valid data format TEST_CASE("Unit_hipArray3DCreate_Negative_InvalidFormat") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; unsigned int flags = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); @@ -269,6 +283,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_InvalidFormat") { // An array must have either 1,2, or 4 channels TEST_CASE("Unit_hipArray3DCreate_Negative_NumChannels") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; unsigned int flags = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); auto desc = defaultDescriptor(flags, 6); @@ -279,6 +295,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_NumChannels") { // Using invalid flags should result in an error TEST_CASE("Unit_hipArray3DCreate_Negative_InvalidFlags") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; // FIXME: use the same flags for both tests when the values exist for hip @@ -304,6 +322,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_InvalidFlags") { // hipArray3DCreate should handle the max numeric value gracefully. TEST_CASE("Unit_hipArray3DCreate_Negative_NumericLimit") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; unsigned int flags = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); @@ -315,6 +335,8 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_NumericLimit") { // texture gather arrays may only be 2D TEMPLATE_TEST_CASE("Unit_hipArray3DCreate_Negative_Non2DTextureGather", "", char, uint2, int4, float2, float4) { + CHECK_IMAGE_SUPPORT + #if HT_AMD HipTest::HIP_SKIP_TEST("Texture Gather arrays not supported using AMD backend"); return; diff --git a/catch/unit/memory/hipArrayCreate.cc b/catch/unit/memory/hipArrayCreate.cc index b6058c8176..44cd53d597 100644 --- a/catch/unit/memory/hipArrayCreate.cc +++ b/catch/unit/memory/hipArrayCreate.cc @@ -73,6 +73,8 @@ static void ArrayCreate_DiffSizes(int gpu) { /* This testcase verifies hipArrayCreate API for small and big chunks data*/ TEST_CASE("Unit_hipArrayCreate_DiffSizes") { + CHECK_IMAGE_SUPPORT + ArrayCreate_DiffSizes(0); HIP_CHECK_THREAD_FINALIZE(); } @@ -83,6 +85,8 @@ scenario by launching threads in parallel on multiple GPUs and verifies the hipArrayCreate API with small and big chunks data */ TEST_CASE("Unit_hipArrayCreate_MultiThread") { + CHECK_IMAGE_SUPPORT + std::vector threadlist; int devCnt = 0; @@ -200,6 +204,8 @@ 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) { + CHECK_IMAGE_SUPPORT + using vec_info = vector_info; DriverContext ctx; @@ -223,6 +229,8 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, sho // Only widths and Heights up to the maxTexture size is supported TEMPLATE_TEST_CASE("Unit_hipArrayCreate_maxTexture", "", uint, int, int4, ushort, short2, char, uchar2, char4, float, float2, float4) { + CHECK_IMAGE_SUPPORT + using vec_info = vector_info; DriverContext ctx; @@ -281,6 +289,8 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_maxTexture", "", uint, int, int4, ushort // zero-width array is not supported TEST_CASE("Unit_hipArrayCreate_ZeroWidth") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; HIP_ARRAY_DESCRIPTOR desc; desc.Format = driverFormats[0]; @@ -295,6 +305,8 @@ TEST_CASE("Unit_hipArrayCreate_ZeroWidth") { // HipArrayCreate will return an error when nullptr is used as the array argument TEST_CASE("Unit_hipArrayCreate_Nullptr") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; SECTION("Null array") { HIP_ARRAY_DESCRIPTOR desc; @@ -313,6 +325,8 @@ TEST_CASE("Unit_hipArrayCreate_Nullptr") { // Only elements with 1,2, or 4 channels is supported TEST_CASE("Unit_hipArrayCreate_BadNumberChannelElement") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; HIP_ARRAY_DESCRIPTOR desc; desc.Format = GENERATE(from_range(std::begin(driverFormats), std::end(driverFormats))); @@ -329,6 +343,8 @@ TEST_CASE("Unit_hipArrayCreate_BadNumberChannelElement") { // Only certain channel formats are acceptable. TEST_CASE("Unit_hipArrayCreate_BadChannelFormat") { + CHECK_IMAGE_SUPPORT + DriverContext ctx; HIP_ARRAY_DESCRIPTOR desc; diff --git a/catch/unit/memory/hipDrvMemcpy3D.cc b/catch/unit/memory/hipDrvMemcpy3D.cc index beed5b3ba8..6e33de8c0a 100644 --- a/catch/unit/memory/hipDrvMemcpy3D.cc +++ b/catch/unit/memory/hipDrvMemcpy3D.cc @@ -29,6 +29,8 @@ THE SOFTWARE. #include TEST_CASE("Unit_hipDrvMemcpy3D_Positive_Basic") { + CHECK_IMAGE_SUPPORT + constexpr bool async = false; #if HT_NVIDIA // Disabled on AMD due to defect - EXSWHTEC-236 @@ -52,6 +54,8 @@ TEST_CASE("Unit_hipDrvMemcpy3D_Positive_Basic") { } TEST_CASE("Unit_hipDrvMemcpy3D_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipDeviceSynchronize()); SECTION("Host to Device") { Memcpy3DHtoDSyncBehavior(DrvMemcpy3DWrapper<>, true); } @@ -78,18 +82,24 @@ TEST_CASE("Unit_hipDrvMemcpy3D_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipDrvMemcpy3D_Positive_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr bool async = false; Memcpy3DZeroWidthHeightDepth(DrvMemcpy3DWrapper); } // Disabled on AMD due to defect - EXSWHTEC-238 TEST_CASE("Unit_hipDrvMemcpy3D_Positive_Array") { + CHECK_IMAGE_SUPPORT + constexpr bool async = false; SECTION("Array from/to Host") { DrvMemcpy3DArrayHostShell(DrvMemcpy3DWrapper); } SECTION("Array from/to Device") { DrvMemcpy3DArrayDeviceShell(DrvMemcpy3DWrapper); } } TEST_CASE("Unit_hipDrvMemcpy3D_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr hipExtent extent{128 * sizeof(int), 128, 8}; constexpr auto NegativeTests = [](hipPitchedPtr dst_ptr, hipPos dst_pos, hipPitchedPtr src_ptr, diff --git a/catch/unit/memory/hipDrvMemcpy3DAsync.cc b/catch/unit/memory/hipDrvMemcpy3DAsync.cc index 746fdcae6b..4b6e291337 100644 --- a/catch/unit/memory/hipDrvMemcpy3DAsync.cc +++ b/catch/unit/memory/hipDrvMemcpy3DAsync.cc @@ -29,6 +29,8 @@ THE SOFTWARE. #include TEST_CASE("Unit_hipDrvMemcpy3DAsync_Positive_Basic") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; const auto stream_type = GENERATE(Streams::nullstream, Streams::perThread, Streams::created); @@ -56,6 +58,8 @@ TEST_CASE("Unit_hipDrvMemcpy3DAsync_Positive_Basic") { } TEST_CASE("Unit_hipDrvMemcpy3DAsync_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; HIP_CHECK(hipDeviceSynchronize()); @@ -82,18 +86,24 @@ TEST_CASE("Unit_hipDrvMemcpy3DAsync_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipDrvMemcpy3DAsync_Positive_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; Memcpy3DZeroWidthHeightDepth(DrvMemcpy3DWrapper); } // Disabled on AMD due to defect - EXSWHTEC-238 TEST_CASE("Unit_hipDrvMemcpy3DAsync_Positive_Array") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; SECTION("Array from/to Host") { DrvMemcpy3DArrayHostShell(DrvMemcpy3DWrapper); } SECTION("Array from/to Device") { DrvMemcpy3DArrayDeviceShell(DrvMemcpy3DWrapper); } } TEST_CASE("Unit_hipDrvMemcpy3DAsync_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; constexpr hipExtent extent{128 * sizeof(int), 128, 8}; diff --git a/catch/unit/memory/hipDrvMemcpy3DAsync_old.cc b/catch/unit/memory/hipDrvMemcpy3DAsync_old.cc index 9f81da6250..07273749fa 100644 --- a/catch/unit/memory/hipDrvMemcpy3DAsync_old.cc +++ b/catch/unit/memory/hipDrvMemcpy3DAsync_old.cc @@ -522,8 +522,9 @@ void DrvMemcpy3DAsync::DeAllocateMemory() { } /* Verifying hipDrvMemcpy3DAsync API Host to Array for different datatypes */ -TEMPLATE_TEST_CASE("Unit_hipDrvMemcpy3DAsync_MultipleDataTypes", "", - uint8_t, int, float) { +TEMPLATE_TEST_CASE("Unit_hipDrvMemcpy3DAsync_MultipleDataTypes", "", uint8_t, int, float) { + CHECK_IMAGE_SUPPORT + for (int i = 1; i < 25; i++) { if (std::is_same::value) { DrvMemcpy3DAsync memcpy3d_float(i, i, i, @@ -543,6 +544,8 @@ TEMPLATE_TEST_CASE("Unit_hipDrvMemcpy3DAsync_MultipleDataTypes", "", /* This testcase verifies H2D copy of hipDrvMemcpy3DAsync API */ TEST_CASE("Unit_hipDrvMemcpy3DAsync_HosttoDevice") { + CHECK_IMAGE_SUPPORT + DrvMemcpy3DAsync memcpy3d_D2H_float(10, 10, 1, HIP_AD_FORMAT_FLOAT); memcpy3d_D2H_float.HostDevice_DrvMemcpy3DAsync(); } @@ -558,6 +561,8 @@ TEST_CASE("Unit_hipDrvMemcpy3DAsync_Negative") { /* This testcase verifies extent validation scenarios of hipDrvMemcpy3DAsync API */ TEST_CASE("Unit_hipDrvMemcpy3DAsync_ExtentValidation") { + CHECK_IMAGE_SUPPORT + DrvMemcpy3DAsync memcpy3d(10, 10, 1, HIP_AD_FORMAT_FLOAT); memcpy3d.Extent_Validation(); } @@ -566,6 +571,8 @@ TEST_CASE("Unit_hipDrvMemcpy3DAsync_ExtentValidation") { change scenario for hipDrvMemcpy3DAsync API */ #if HT_AMD TEST_CASE("Unit_hipDrvMemcpy3DAsync_H2DDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -580,6 +587,8 @@ TEST_CASE("Unit_hipDrvMemcpy3DAsync_H2DDeviceContextChange") { /* This testcase verifies Host to Array copy in device context change scenario for hipDrvMemcpy3DAsync API */ TEST_CASE("Unit_hipDrvMemcpy3DAsync_Host2ArrayDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { diff --git a/catch/unit/memory/hipDrvMemcpy3D_old.cc b/catch/unit/memory/hipDrvMemcpy3D_old.cc index 0b524655a9..d8d6f75187 100644 --- a/catch/unit/memory/hipDrvMemcpy3D_old.cc +++ b/catch/unit/memory/hipDrvMemcpy3D_old.cc @@ -507,8 +507,9 @@ void DrvMemcpy3D::DeAllocateMemory() { } /* Verifying hipDrvMemcpy3D API Host to Array for different datatypes */ -TEMPLATE_TEST_CASE("Unit_hipDrvMemcpy3D_MultipleDataTypes", "", - uint8_t, int, float) { +TEMPLATE_TEST_CASE("Unit_hipDrvMemcpy3D_MultipleDataTypes", "", uint8_t, int, float) { + CHECK_IMAGE_SUPPORT + for (int i = 1; i < 25; i++) { if (std::is_same::value) { DrvMemcpy3D memcpy3d_float(i, i, i, HIP_AD_FORMAT_FLOAT); @@ -525,6 +526,8 @@ TEMPLATE_TEST_CASE("Unit_hipDrvMemcpy3D_MultipleDataTypes", "", /* This testcase verifies H2D copy of hipDrvMemcpy3D API */ TEST_CASE("Unit_hipDrvMemcpy3D_HosttoDevice") { + CHECK_IMAGE_SUPPORT + DrvMemcpy3D memcpy3d_D2H_float(10, 10, 1, HIP_AD_FORMAT_FLOAT); memcpy3d_D2H_float.HostDevice_DrvMemcpy3D(); } @@ -539,6 +542,8 @@ TEST_CASE("Unit_hipDrvMemcpy3D_Negative") { /* This testcase verifies extent validation scenarios of hipDrvMemcpy3D API */ TEST_CASE("Unit_hipDrvMemcpy3D_ExtentValidation") { + CHECK_IMAGE_SUPPORT + DrvMemcpy3D memcpy3d(10, 10, 1, HIP_AD_FORMAT_FLOAT); memcpy3d.Extent_Validation(); } @@ -547,6 +552,8 @@ TEST_CASE("Unit_hipDrvMemcpy3D_ExtentValidation") { /* This testcase verifies H2D copy in device context change scenario for hipDrvMemcpy3D API */ TEST_CASE("Unit_hipDrvMemcpy3D_H2DDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -561,6 +568,8 @@ TEST_CASE("Unit_hipDrvMemcpy3D_H2DDeviceContextChange") { /* This testcase verifies Host to Array copy in device context change scenario for hipDrvMemcpy3D API */ TEST_CASE("Unit_hipDrvMemcpy3D_Host2ArrayDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { diff --git a/catch/unit/memory/hipFree.cc b/catch/unit/memory/hipFree.cc index bc06a4c7a6..3914e12c38 100644 --- a/catch/unit/memory/hipFree.cc +++ b/catch/unit/memory/hipFree.cc @@ -76,6 +76,8 @@ TEST_CASE("Unit_hipFreeImplicitSyncHost") { #if HT_NVIDIA TEMPLATE_TEST_CASE("Unit_hipFreeImplicitSyncArray", "", char, float, float2, float4) { + CHECK_IMAGE_SUPPORT + using vec_info = vector_info; DriverContext ctx; @@ -113,6 +115,8 @@ TEMPLATE_TEST_CASE("Unit_hipFreeImplicitSyncArray", "", char, float, float2, flo #else // AMD TEMPLATE_TEST_CASE("Unit_hipFreeImplicitSyncArray", "", char, float, float2, float4) { + CHECK_IMAGE_SUPPORT + hipArray_t arrayPtr{}; hipExtent extent{}; extent.width = GENERATE(32, 128, 256, 512, 1024); @@ -242,6 +246,8 @@ TEST_CASE("Unit_hipFreeDoubleArrayDestroy") { #else // AMD TEST_CASE("Unit_hipFreeDoubleArray") { + CHECK_IMAGE_SUPPORT + size_t width = GENERATE(32, 512, 1024); size_t height = GENERATE(0, 32, 512, 1024); hipArray_t arrayPtr{}; @@ -373,6 +379,8 @@ TEMPLATE_TEST_CASE("Unit_hipFreeMultiTArray", "", char, int, float2, float4) { #else TEMPLATE_TEST_CASE("Unit_hipFreeMultiTArray", "", char, int, float2, float4) { + CHECK_IMAGE_SUPPORT + using vec_info = vector_info; hipExtent extent{}; diff --git a/catch/unit/memory/hipMalloc3D.cc b/catch/unit/memory/hipMalloc3D.cc index 47dae81522..b5f12bade9 100644 --- a/catch/unit/memory/hipMalloc3D.cc +++ b/catch/unit/memory/hipMalloc3D.cc @@ -63,6 +63,8 @@ static void Malloc3DThreadFunc(int gpu) { * assigning width,height and depth as 10 */ TEST_CASE("Unit_hipMalloc3D_Basic") { + CHECK_IMAGE_SUPPORT + size_t width = SMALL_SIZE * sizeof(char); size_t height{SMALL_SIZE}, depth{SMALL_SIZE}; hipPitchedPtr devPitchedPtr; @@ -75,6 +77,8 @@ This testcase verifies the hipMalloc3D API by allocating smaller and big chunk data. */ TEST_CASE("Unit_hipMalloc3D_SmallandBigChunks") { + CHECK_IMAGE_SUPPORT + MemoryAlloc3DDiffSizes(0); } @@ -84,6 +88,8 @@ scenario by launching threads in parallel on multiple GPUs and verifies the hipMalloc3D API with small and big chunks data */ TEST_CASE("Unit_hipMalloc3D_MultiThread") { + CHECK_IMAGE_SUPPORT + std::vector threadlist; int devCnt = 0; diff --git a/catch/unit/memory/hipMalloc3DArray.cc b/catch/unit/memory/hipMalloc3DArray.cc index d5b840d7dd..a0741a1055 100644 --- a/catch/unit/memory/hipMalloc3DArray.cc +++ b/catch/unit/memory/hipMalloc3DArray.cc @@ -67,6 +67,8 @@ static void Malloc3DArray_DiffSizes(int gpu) { } TEST_CASE("Unit_hipMalloc3DArray_DiffSizes") { + CHECK_IMAGE_SUPPORT + Malloc3DArray_DiffSizes(0); HIP_CHECK_THREAD_FINALIZE(); } @@ -77,6 +79,8 @@ scenario by launching threads in parallel on multiple GPUs and verifies the hipMalloc3DArray API with small and big chunks data */ TEST_CASE("Unit_hipMalloc3DArray_MultiThread") { + CHECK_IMAGE_SUPPORT + std::vector threadlist; int devCnt = 0; devCnt = HipTest::getDeviceCount(); @@ -122,6 +126,8 @@ void checkArrayIsExpected(hipArray_t array, const hipChannelFormatDesc& expected TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_happy", "", char, uchar2, uint2, int4, short4, float, float2, float4) { + CHECK_IMAGE_SUPPORT + hipArray_t array; const auto desc = hipCreateChannelDesc(); #if HT_AMD @@ -151,6 +157,8 @@ TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_happy", "", char, uchar2, uint2, int4, TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_MaxTexture", "", int, uint4, short, ushort2, unsigned char, float, float4) { + CHECK_IMAGE_SUPPORT + hipArray_t array; const hipChannelFormatDesc desc = hipCreateChannelDesc(); #if HT_AMD @@ -241,6 +249,8 @@ hipExtent makeExtent(unsigned int flag, size_t s) { // Providing the array pointer as nullptr should return an error TEST_CASE("Unit_hipMalloc3DArray_Negative_NullArrayPtr") { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = hipCreateChannelDesc(); constexpr size_t s = 6; @@ -251,6 +261,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_NullArrayPtr") { // Providing the description pointer as nullptr should return an error TEST_CASE("Unit_hipMalloc3DArray_Negative_NullDescPtr") { + CHECK_IMAGE_SUPPORT + constexpr size_t s = 6; // 6 to keep cubemap happy hipArray_t array; @@ -262,6 +274,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_NullDescPtr") { // Zero width arrays are not allowed TEST_CASE("Unit_hipMalloc3DArray_Negative_ZeroWidth") { + CHECK_IMAGE_SUPPORT + constexpr size_t s = 6; // 6 to keep cubemap happy hipArray_t array; hipChannelFormatDesc desc = hipCreateChannelDesc(); @@ -274,6 +288,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_ZeroWidth") { // Zero height arrays are only allowed for 1D arrays and layered arrays TEST_CASE("Unit_hipMalloc3DArray_Negative_ZeroHeight") { + CHECK_IMAGE_SUPPORT + constexpr size_t s = 6; // 6 to keep cubemap happy hipArray_t array; hipChannelFormatDesc desc = hipCreateChannelDesc(); @@ -290,6 +306,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_ZeroHeight") { } TEST_CASE("Unit_hipMalloc3DArray_Negative_InvalidFlags") { + CHECK_IMAGE_SUPPORT + constexpr size_t s = 6; // 6 to keep cubemap happy hipArray_t array; hipChannelFormatDesc desc = hipCreateChannelDesc(); @@ -325,12 +343,16 @@ void testInvalidDescription(hipChannelFormatDesc desc) { } TEST_CASE("Unit_hipMalloc3DArray_Negative_InvalidFormat") { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = hipCreateChannelDesc(); desc.f = GENERATE(hipChannelFormatKindNone, 0xBEEF); testInvalidDescription(desc); } TEST_CASE("Unit_hipMalloc3DArray_Negative_BadChannelLayout") { + CHECK_IMAGE_SUPPORT + const int bits = GENERATE(8, 16, 32); const hipChannelFormatKind formatKind = GENERATE(hipChannelFormatKindSigned, hipChannelFormatKindUnsigned, hipChannelFormatKindFloat); @@ -352,6 +374,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_BadChannelLayout") { } TEST_CASE("Unit_hipMalloc3DArray_Negative_8BitFloat") { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = GENERATE(hipCreateChannelDesc(8, 0, 0, 0, hipChannelFormatKindFloat), hipCreateChannelDesc(8, 8, 0, 0, hipChannelFormatKindFloat), hipCreateChannelDesc(8, 8, 8, 8, hipChannelFormatKindFloat)); @@ -360,6 +384,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_8BitFloat") { } TEST_CASE("Unit_hipMalloc3DArray_Negative_DifferentChannelSizes") { + CHECK_IMAGE_SUPPORT + const int bitsX = GENERATE(8, 16, 32); const int bitsY = GENERATE(8, 16, 32); const int bitsZ = GENERATE(8, 16, 32); @@ -383,6 +409,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_DifferentChannelSizes") { } TEST_CASE("Unit_hipMalloc3DArray_Negative_BadChannelSize") { + CHECK_IMAGE_SUPPORT + const int badBits = GENERATE(-1, 0, 10, 100); const hipChannelFormatKind formatKind = GENERATE(hipChannelFormatKindSigned, hipChannelFormatKindUnsigned, hipChannelFormatKindFloat); @@ -396,6 +424,8 @@ TEST_CASE("Unit_hipMalloc3DArray_Negative_BadChannelSize") { // hipMalloc3DArray should handle the max numeric value gracefully. TEST_CASE("Unit_hipMalloc3DArray_Negative_NumericLimit") { + CHECK_IMAGE_SUPPORT + hipArray_t arrayPtr; hipChannelFormatDesc desc = hipCreateChannelDesc(); diff --git a/catch/unit/memory/hipMallocArray.cc b/catch/unit/memory/hipMallocArray.cc index 14a095f6fd..33db8b8b16 100644 --- a/catch/unit/memory/hipMallocArray.cc +++ b/catch/unit/memory/hipMallocArray.cc @@ -68,6 +68,8 @@ static void MallocArray_DiffSizes(int gpu) { } TEST_CASE("Unit_hipMallocArray_DiffSizes") { + CHECK_IMAGE_SUPPORT + MallocArray_DiffSizes(0); HIP_CHECK_THREAD_FINALIZE(); } @@ -78,6 +80,8 @@ scenario by launching threads in parallel on multiple GPUs and verifies the hipMallocArray API with small and big chunks data */ TEST_CASE("Unit_hipMallocArray_MultiThread") { + CHECK_IMAGE_SUPPORT + std::vector threadlist; int devCnt = 0; devCnt = HipTest::getDeviceCount(); @@ -373,6 +377,7 @@ 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) { + CHECK_IMAGE_SUPPORT hipChannelFormatDesc desc = hipCreateChannelDesc(); @@ -425,6 +430,8 @@ TEMPLATE_TEST_CASE("Unit_hipMallocArray_happy", "", uint, int, int4, ushort, sho // EXSWCPHIPT-71 - no equivalent value for maxSurface and maxTexture2DGather. TEMPLATE_TEST_CASE("Unit_hipMallocArray_MaxTexture_Default", "", uint, int4, ushort, short2, char, char4, float2, float4) { + CHECK_IMAGE_SUPPORT + size_t width, height; hipArray_t array{}; hipChannelFormatDesc desc = hipCreateChannelDesc(); @@ -482,6 +489,8 @@ TEMPLATE_TEST_CASE("Unit_hipMallocArray_MaxTexture_Default", "", uint, int4, ush // Arrays with channels of different size are not allowed. TEST_CASE("Unit_hipMallocArray_Negative_DifferentChannelSizes") { + CHECK_IMAGE_SUPPORT + const int bitsX = GENERATE(8, 16, 32); const int bitsY = GENERATE(8, 16, 32); const int bitsZ = GENERATE(8, 16, 32); @@ -520,6 +529,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_DifferentChannelSizes") { // Zero-width array is not supported TEST_CASE("Unit_hipMallocArray_Negative_ZeroWidth") { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = hipCreateChannelDesc(); // pointer to the array in device memory @@ -534,6 +545,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_ZeroWidth") { // Providing the array pointer as nullptr should return an error TEST_CASE("Unit_hipMallocArray_Negative_NullArrayPtr") { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = hipCreateChannelDesc(); HIP_CHECK_ERROR(hipMallocArray(nullptr, &desc, 1024, 0, hipArrayDefault), hipErrorInvalidValue); @@ -541,6 +554,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_NullArrayPtr") { // Providing the desc pointer as nullptr should return an error TEST_CASE("Unit_hipMallocArray_Negative_NullDescPtr") { + CHECK_IMAGE_SUPPORT + hipArray_t arrayPtr; HIP_CHECK_ERROR(hipMallocArray(&arrayPtr, nullptr, 1024, 0, hipArrayDefault), hipErrorInvalidValue); @@ -548,6 +563,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_NullDescPtr") { // Inappropriate but related flags should still return an error TEST_CASE("Unit_hipMallocArray_Negative_BadFlags") { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = hipCreateChannelDesc(); hipArray_t arrayPtr; @@ -574,6 +591,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_BadFlags") { // 8-bit float channels are not supported TEMPLATE_TEST_CASE("Unit_hipMallocArray_Negative_8bitFloat", "", float, float2, float4) { + CHECK_IMAGE_SUPPORT + hipChannelFormatDesc desc = GENERATE(hipCreateChannelDesc(8, 0, 0, 0, hipChannelFormatKindFloat), hipCreateChannelDesc(8, 8, 0, 0, hipChannelFormatKindFloat), hipCreateChannelDesc(8, 8, 8, 8, hipChannelFormatKindFloat)); @@ -592,6 +611,8 @@ TEMPLATE_TEST_CASE("Unit_hipMallocArray_Negative_8bitFloat", "", float, float2, // Only 8, 16, and 32 bit channels are supported TEST_CASE("Unit_hipMallocArray_Negative_BadNumberOfBits") { + CHECK_IMAGE_SUPPORT + const int badBits = GENERATE(-1, 0, 10, 100); const hipChannelFormatKind formatKind = GENERATE(hipChannelFormatKindSigned, hipChannelFormatKindUnsigned, hipChannelFormatKindFloat); @@ -618,6 +639,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_BadNumberOfBits") { // creating elements with 3 channels is not supported. TEST_CASE("Unit_hipMallocArray_Negative_3ChannelElement") { + CHECK_IMAGE_SUPPORT + const int bits = GENERATE(8, 16, 32); hipChannelFormatKind formatKind = GENERATE(hipChannelFormatKindSigned, hipChannelFormatKindUnsigned, hipChannelFormatKindFloat); @@ -644,6 +667,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_3ChannelElement") { // The bit channel description should not allow any channels after a zero channel TEST_CASE("Unit_hipMallocArray_Negative_ChannelAfterZeroChannel") { + CHECK_IMAGE_SUPPORT + const int bits = GENERATE(8, 16, 32); const hipChannelFormatKind formatKind = GENERATE(hipChannelFormatKindSigned, hipChannelFormatKindUnsigned, hipChannelFormatKindFloat); @@ -671,6 +696,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_ChannelAfterZeroChannel") { // The channel format should be one of the defined formats TEST_CASE("Unit_hipMallocArray_Negative_InvalidChannelFormat") { + CHECK_IMAGE_SUPPORT + const int bits = 32; hipChannelFormatKind formatKind = static_cast(0xFF); hipChannelFormatDesc desc = hipCreateChannelDesc(bits, bits, bits, bits, formatKind); @@ -695,6 +722,8 @@ TEST_CASE("Unit_hipMallocArray_Negative_InvalidChannelFormat") { // hipMallocArray should handle the max numeric value gracefully. TEST_CASE("Unit_hipMallocArray_Negative_NumericLimit") { + CHECK_IMAGE_SUPPORT + hipArray_t arrayPtr; hipChannelFormatDesc desc = hipCreateChannelDesc(); diff --git a/catch/unit/memory/hipMallocPitch.cc b/catch/unit/memory/hipMallocPitch.cc index 7b26c16034..b3f61c4372 100644 --- a/catch/unit/memory/hipMallocPitch.cc +++ b/catch/unit/memory/hipMallocPitch.cc @@ -131,6 +131,8 @@ hipExtent generateExtent(AllocationApi api) { TEST_CASE("Unit_hipMalloc3D_ValidatePitch") { + CHECK_IMAGE_SUPPORT + hipPitchedPtr hipPitchedPtr; hipExtent validExtent{generateExtent(AllocationApi::hipMalloc3D)}; @@ -140,6 +142,8 @@ TEST_CASE("Unit_hipMalloc3D_ValidatePitch") { } TEST_CASE("Unit_hipMemAllocPitch_ValidatePitch") { + CHECK_IMAGE_SUPPORT + size_t pitch = 0; hipDeviceptr_t ptr; hipExtent validExtent{generateExtent(AllocationApi::hipMemAllocPitch)}; @@ -159,6 +163,8 @@ TEST_CASE("Unit_hipMemAllocPitch_ValidatePitch") { } TEST_CASE("Unit_hipMallocPitch_ValidatePitch") { + CHECK_IMAGE_SUPPORT + size_t pitch = 0; void* ptr; hipExtent validExtent{generateExtent(AllocationApi::hipMemAllocPitch)}; @@ -168,6 +174,8 @@ TEST_CASE("Unit_hipMallocPitch_ValidatePitch") { } TEST_CASE("Unit_hipMalloc3D_Negative") { + CHECK_IMAGE_SUPPORT + SECTION("Invalid ptr") { hipExtent validExtent{1, 1, 1}; HIP_CHECK_ERROR(hipMalloc3D(nullptr, validExtent), hipErrorInvalidValue); @@ -204,6 +212,8 @@ TEST_CASE("Unit_hipMalloc3D_Negative") { } TEST_CASE("Unit_hipMallocPitch_Negative") { + CHECK_IMAGE_SUPPORT + size_t pitch = 0; void* ptr; constexpr size_t maxSizeT = std::numeric_limits::max(); @@ -229,6 +239,8 @@ TEST_CASE("Unit_hipMallocPitch_Negative") { } TEST_CASE("Unit_hipMallocPitch_Zero_Dims") { + CHECK_IMAGE_SUPPORT + void* ptr = nullptr; size_t pitch = 0; @@ -244,6 +256,8 @@ TEST_CASE("Unit_hipMallocPitch_Zero_Dims") { } TEST_CASE("Unit_hipMemAllocPitch_Negative") { + CHECK_IMAGE_SUPPORT + size_t pitch = 0; hipDeviceptr_t ptr{}; unsigned int validElementSizeBytes{4}; @@ -381,8 +395,9 @@ static void threadFunc(int gpu) { * hipMallocPitch API for different datatypes * */ -TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Basic", - "[hipMallocPitch]", int, unsigned int, float) { +TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Basic", "[hipMallocPitch]", int, unsigned int, float) { + CHECK_IMAGE_SUPPORT + TestType* A_d; size_t pitch_A = 0; size_t width{NUM_W * sizeof(TestType)}; @@ -396,8 +411,10 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Basic", * This testcase verifies hipMallocPitch API for small * and big chunks of data. */ -TEMPLATE_TEST_CASE("Unit_hipMallocPitch_SmallandBigChunks", - "[hipMallocPitch]", int, unsigned int, float) { +TEMPLATE_TEST_CASE("Unit_hipMallocPitch_SmallandBigChunks", "[hipMallocPitch]", int, unsigned int, + float) { + CHECK_IMAGE_SUPPORT + MemoryAllocDiffSizes(0); } @@ -405,8 +422,9 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_SmallandBigChunks", * This testcase verifies the memory allocated by hipMallocPitch API * by performing Memcpy2D on the allocated memory. */ -TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Memcpy2D", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Memcpy2D", "", int, float, double) { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); TestType *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, *A_d{nullptr}, *B_d{nullptr}; @@ -450,7 +468,6 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Memcpy2D", "" } - /* This testcase verifies the hipMallocPitch API in multithreaded scenario by launching threads in parallel on multiple GPUs @@ -458,6 +475,8 @@ and verifies the hipMallocPitch API with small and big chunks data */ TEST_CASE("Unit_hipMallocPitch_MultiThread", "") { + CHECK_IMAGE_SUPPORT + std::vector threadlist; int devCnt = 0; @@ -478,8 +497,9 @@ TEST_CASE("Unit_hipMallocPitch_MultiThread", "") { * variable to another kernel variable. * 3. Validating the result */ -TEMPLATE_TEST_CASE("Unit_hipMallocPitch_KernelLaunch", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMallocPitch_KernelLaunch", "", int, float, double) { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); TestType *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, *A_d{nullptr}, *B_d{nullptr}; diff --git a/catch/unit/memory/hipMemcpy2D.cc b/catch/unit/memory/hipMemcpy2D.cc index d598e2600b..8820a2b3fa 100644 --- a/catch/unit/memory/hipMemcpy2D.cc +++ b/catch/unit/memory/hipMemcpy2D.cc @@ -55,8 +55,9 @@ Input : "A_h" initialized based on data type Output: Validating A_h with B_h both should be equal for the number of COLUMNS and ROWS copied */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_H2D-D2D-D2H", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_H2D-D2D-D2H", "", int, float, double) { + CHECK_IMAGE_SUPPORT + // 1 refers to pinned host memory auto mem_type = GENERATE(0, 1); HIP_CHECK(hipSetDevice(0)); @@ -124,8 +125,9 @@ Input : "A_h" initialized based on data type Output: Validating A_h with B_h both should be equal for the number of COLUMNS and ROWS copied */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_H2D-D2D-D2H_WithOffset", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_H2D-D2D-D2H_WithOffset", "", int, float, double) { + CHECK_IMAGE_SUPPORT + // 1 refers to pinned host memory auto mem_type = GENERATE(0, 1); HIP_CHECK(hipSetDevice(0)); @@ -195,8 +197,9 @@ Input : "A_h" initialized based on data type Output: Validating A_h with B_h both should be equal for the number of COLUMNS and ROWS copied */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_multiDevice-D2D", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_multiDevice-D2D", "", int, float, double) { + CHECK_IMAGE_SUPPORT + auto mem_type = GENERATE(0, 1); int numDevices = 0; int canAccessPeer = 0; @@ -269,6 +272,8 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy2D_multiDevice-D2D", "" This Testcase verifies the null size checks of hipMemcpy2D API */ TEST_CASE("Unit_hipMemcpy2D_SizeCheck") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); int* A_h{nullptr}, *A_d{nullptr}; size_t pitch_A; @@ -316,6 +321,8 @@ TEST_CASE("Unit_hipMemcpy2D_SizeCheck") { This Testcase verifies all the negative scenarios of hipMemcpy2D API */ TEST_CASE("Unit_hipMemcpy2D_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); int* A_h{nullptr}, *A_d{nullptr}; size_t pitch_A; diff --git a/catch/unit/memory/hipMemcpy2DAsync.cc b/catch/unit/memory/hipMemcpy2DAsync.cc index 76b20ac574..645d9ddc4e 100644 --- a/catch/unit/memory/hipMemcpy2DAsync.cc +++ b/catch/unit/memory/hipMemcpy2DAsync.cc @@ -56,8 +56,9 @@ Input : "A_h" initialized based on data type Output: Validating A_h with B_h both should be equal for the number of COLUMNS and ROWS copied */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_Host&PinnedMem", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_Host&PinnedMem", "", int, float, double) { + CHECK_IMAGE_SUPPORT + // 1 refers to pinned host memory auto mem_type = GENERATE(0, 1); HIP_CHECK(hipSetDevice(0)); @@ -148,8 +149,9 @@ Input : "A_h" initialized based on data type Output: Validating A_h with B_h both should be equal for the number of COLUMNS and ROWS copied */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_multiDevice-Host&PinnedMem", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_multiDevice-Host&PinnedMem", "", int, float, double) { + CHECK_IMAGE_SUPPORT + auto mem_type = GENERATE(0, 1); int numDevices = 0; int canAccessPeer = 0; @@ -238,8 +240,9 @@ Input : "A_h" initialized based on data type Output: Validating A_h with B_h both should be equal for the number of COLUMNS and ROWS copied */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_multiDevice-StreamOnDiffDevice", "" - , int, float, double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_multiDevice-StreamOnDiffDevice", "", int, float, double) { + CHECK_IMAGE_SUPPORT + auto mem_type = GENERATE(0, 1); int numDevices = 0; int canAccessPeer = 0; @@ -319,6 +322,8 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy2DAsync_multiDevice-StreamOnDiffDevice", "" This testcase verifies the null checks of hipMemcpy2DAsync API */ TEST_CASE("Unit_hipMemcpy2DAsync_SizeCheck") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); int* A_h{nullptr}, *A_d{nullptr}; size_t pitch_A; @@ -368,6 +373,8 @@ TEST_CASE("Unit_hipMemcpy2DAsync_SizeCheck") { This testcase performs the negative scenarios of hipMemcpy2DAsync API */ TEST_CASE("Unit_hipMemcpy2DAsync_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); int* A_h{nullptr}, *A_d{nullptr}; size_t pitch_A; diff --git a/catch/unit/memory/hipMemcpy2DFromArray.cc b/catch/unit/memory/hipMemcpy2DFromArray.cc index 809e18fb6e..013aa39222 100644 --- a/catch/unit/memory/hipMemcpy2DFromArray.cc +++ b/catch/unit/memory/hipMemcpy2DFromArray.cc @@ -36,6 +36,8 @@ invalid TEST_CASE("Unit_hipMemcpy2DFromArray_Positive_Default") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = GENERATE(16, 32, 48); @@ -87,6 +89,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_Positive_Default") { } TEST_CASE("Unit_hipMemcpy2DFromArray_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; HIP_CHECK(hipDeviceSynchronize()); @@ -114,6 +118,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipMemcpy2DFromArray_Positive_ZeroWidthHeight") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 16; const auto height = 16; @@ -147,6 +153,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_Positive_ZeroWidthHeight") { } TEST_CASE("Unit_hipMemcpy2DFromArray_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 32; diff --git a/catch/unit/memory/hipMemcpy2DFromArrayAsync.cc b/catch/unit/memory/hipMemcpy2DFromArrayAsync.cc index 35cb11a566..65c772008b 100644 --- a/catch/unit/memory/hipMemcpy2DFromArrayAsync.cc +++ b/catch/unit/memory/hipMemcpy2DFromArrayAsync.cc @@ -35,6 +35,8 @@ of hipMemcpy2DFromArrayAsync api when parameters are invalid #include TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Positive_Default") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto stream_type = GENERATE(Streams::nullstream, Streams::perThread, Streams::created); @@ -91,6 +93,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Positive_Default") { } TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; HIP_CHECK(hipDeviceSynchronize()); @@ -119,6 +123,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Positive_ZeroWidthHeight") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto stream_type = GENERATE(Streams::nullstream, Streams::perThread, Streams::created); @@ -157,6 +163,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Positive_ZeroWidthHeight") { } TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 32; diff --git a/catch/unit/memory/hipMemcpy2DFromArrayAsync_old.cc b/catch/unit/memory/hipMemcpy2DFromArrayAsync_old.cc index f7c8e75b71..385ddad162 100644 --- a/catch/unit/memory/hipMemcpy2DFromArrayAsync_old.cc +++ b/catch/unit/memory/hipMemcpy2DFromArrayAsync_old.cc @@ -44,6 +44,8 @@ static constexpr auto NUM_H{10}; * and verifying A_h with Phi */ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Basic") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -88,6 +90,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Basic") { * of hipMemcpy2DFromArrayAsync API */ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_ExtentValidation") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -167,6 +171,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_ExtentValidation") { * and verifying A_h with PinnedMem[0](i.e., 10) */ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_PinnedHostMemSameGpu") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; constexpr auto def_val{10}; @@ -212,6 +218,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_PinnedHostMemSameGpu") { * OUTPUT: validating the result by comparing A_h and E_h */ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_multiDevicePinnedHostMem") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; constexpr auto def_val{10}; HIP_CHECK(hipGetDeviceCount(&numDevices)); @@ -273,6 +281,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_multiDevicePinnedHostMem") { * and verifying A_h with Phi * */ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_multiDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -320,6 +330,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_multiDeviceContextChange") { * of hipMemcpy2DFromArrayAsync API */ TEST_CASE("Unit_hipMemcpy2DFromArrayAsync_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; diff --git a/catch/unit/memory/hipMemcpy2DFromArray_old.cc b/catch/unit/memory/hipMemcpy2DFromArray_old.cc index 1972a5f10a..2186073a74 100644 --- a/catch/unit/memory/hipMemcpy2DFromArray_old.cc +++ b/catch/unit/memory/hipMemcpy2DFromArray_old.cc @@ -41,6 +41,8 @@ static constexpr auto NUM_H{10}; * and verifying A_h with Phi */ TEST_CASE("Unit_hipMemcpy2DFromArray_Basic") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -73,6 +75,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_Basic") { * of hipMemcpy2DFromArray API */ TEST_CASE("Unit_hipMemcpy2DFromArray_ExtentValidation") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -143,6 +147,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_ExtentValidation") { * and verifying A_h with PinnedMem[0](i.e., 10) */ TEST_CASE("Unit_hipMemcpy2DFromArray_PinnedMemSameGPU") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; constexpr auto def_val{10}; @@ -185,6 +191,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_PinnedMemSameGPU") { * and verifying A_h with E_h */ TEST_CASE("Unit_hipMemcpy2DFromArray_multiDevicePinnedMemPeerGpu") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; constexpr auto def_val{10}; HIP_CHECK(hipGetDeviceCount(&numDevices)); @@ -242,6 +250,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_multiDevicePinnedMemPeerGpu") { * and verifying A_h with Phi * */ TEST_CASE("Unit_hipMemcpy2DFromArray_multiDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -286,6 +296,8 @@ TEST_CASE("Unit_hipMemcpy2DFromArray_multiDeviceContextChange") { * hipMemcpy2DFromArray API */ TEST_CASE("Unit_hipMemcpy2DFromArray_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; diff --git a/catch/unit/memory/hipMemcpy2DToArray.cc b/catch/unit/memory/hipMemcpy2DToArray.cc index 15a518ce96..544578557f 100644 --- a/catch/unit/memory/hipMemcpy2DToArray.cc +++ b/catch/unit/memory/hipMemcpy2DToArray.cc @@ -35,6 +35,8 @@ unsuccessful execution of hipMemcpy2DToArray api when parameters are invalid TEST_CASE("Unit_hipMemcpy2DToArray_Positive_Default") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = GENERATE(16, 32, 48); @@ -85,6 +87,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_Positive_Default") { } TEST_CASE("Unit_hipMemcpy2DToArray_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; HIP_CHECK(hipDeviceSynchronize()); @@ -109,6 +113,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipMemcpy2DToArray_Positive_ZeroWidthHeight") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 16; const auto height = 16; @@ -142,6 +148,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_Positive_ZeroWidthHeight") { } TEST_CASE("Unit_hipMemcpy2DToArray_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 32; diff --git a/catch/unit/memory/hipMemcpy2DToArrayAsync.cc b/catch/unit/memory/hipMemcpy2DToArrayAsync.cc index 7e3414e184..d8190ccaef 100644 --- a/catch/unit/memory/hipMemcpy2DToArrayAsync.cc +++ b/catch/unit/memory/hipMemcpy2DToArrayAsync.cc @@ -36,6 +36,8 @@ of hipMemcpy2DToArrayAsync api when parameters are invalid TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Positive_Default") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto stream_type = GENERATE(Streams::nullstream, Streams::perThread, Streams::created); @@ -92,6 +94,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Positive_Default") { } TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; HIP_CHECK(hipDeviceSynchronize()); @@ -115,6 +119,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Positive_ZeroWidthHeight") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 16; const auto height = 16; @@ -152,6 +158,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Positive_ZeroWidthHeight") { } TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 32; diff --git a/catch/unit/memory/hipMemcpy2DToArrayAsync_old.cc b/catch/unit/memory/hipMemcpy2DToArrayAsync_old.cc index 990b9c651e..15cc200f5b 100644 --- a/catch/unit/memory/hipMemcpy2DToArrayAsync_old.cc +++ b/catch/unit/memory/hipMemcpy2DToArrayAsync_old.cc @@ -44,6 +44,8 @@ static constexpr auto NUM_H{10}; * and verifying A_h with Phi */ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Basic") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -86,6 +88,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Basic") { * This testcase verifies the extent validation scenarios */ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_ExtentValidation") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -163,6 +167,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_ExtentValidation") { * and verifying A_h with PinnedMem[0](i.e., 10) */ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_PinnedHostMemSameGpu") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; constexpr auto def_val{10}; @@ -211,6 +217,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_PinnedHostMemSameGpu") { * and verifying A_h with E_h[0]+i(i.e., 10+i) */ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_multiDevicePinnedHostMem") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; constexpr auto def_val{10}; HIP_CHECK(hipGetDeviceCount(&numDevices)); @@ -274,6 +282,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_multiDevicePinnedHostMem") { * and verifying A_h with Phi * */ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_multiDeviceDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -321,6 +331,8 @@ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_multiDeviceDeviceContextChange") { /* This testcase verifies the negative scenarios */ TEST_CASE("Unit_hipMemcpy2DToArrayAsync_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; diff --git a/catch/unit/memory/hipMemcpy2DToArray_old.cc b/catch/unit/memory/hipMemcpy2DToArray_old.cc index e75e2c6af3..25ac8cb332 100644 --- a/catch/unit/memory/hipMemcpy2DToArray_old.cc +++ b/catch/unit/memory/hipMemcpy2DToArray_old.cc @@ -42,6 +42,8 @@ static constexpr auto NUM_H{10}; * and verifying A_h with Phi */ TEST_CASE("Unit_hipMemcpy2DToArray_Basic") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -73,6 +75,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_Basic") { * This testcase verifies the extent validation scenarios */ TEST_CASE("Unit_hipMemcpy2DToArray_ExtentValidation") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; @@ -143,6 +147,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_ExtentValidation") { * and verifying A_h with PinnedMem[0](i.e., 10) */ TEST_CASE("Unit_hipMemcpy2DToArray_PinnedMemSameGPU") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; constexpr auto def_val{10}; @@ -186,6 +192,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_PinnedMemSameGPU") { * and verifying A_h with E_h[0]+i(i.e., 10+i) */ TEST_CASE("Unit_hipMemcpy2DToArray_multiDevicePinnedMemPeerGpu") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; constexpr auto def_val{10}; HIP_CHECK(hipGetDeviceCount(&numDevices)); @@ -244,6 +252,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_multiDevicePinnedMemPeerGpu") { * and verifying A_h with Phi * */ TEST_CASE("Unit_hipMemcpy2DToArray_multiDeviceDeviceContextChange") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -287,6 +297,8 @@ TEST_CASE("Unit_hipMemcpy2DToArray_multiDeviceDeviceContextChange") { /* This testcase verifies the negative scenarios */ TEST_CASE("Unit_hipMemcpy2DToArray_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d{nullptr}; size_t width{sizeof(float)*NUM_W}; diff --git a/catch/unit/memory/hipMemcpy3D.cc b/catch/unit/memory/hipMemcpy3D.cc index 026be6c5d6..b62f23c8a6 100644 --- a/catch/unit/memory/hipMemcpy3D.cc +++ b/catch/unit/memory/hipMemcpy3D.cc @@ -31,6 +31,8 @@ THE SOFTWARE. #pragma clang diagnostic ignored "-Wunused-variable" TEST_CASE("Unit_hipMemcpy3D_Positive_Basic") { + CHECK_IMAGE_SUPPORT + constexpr bool async = false; SECTION("Device to Host") { Memcpy3DDeviceToHostShell(Memcpy3DWrapper<>); } @@ -48,6 +50,8 @@ TEST_CASE("Unit_hipMemcpy3D_Positive_Basic") { } TEST_CASE("Unit_hipMemcpy3D_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipDeviceSynchronize()); SECTION("Host to Device") { Memcpy3DHtoDSyncBehavior(Memcpy3DWrapper<>, true); } @@ -70,11 +74,15 @@ TEST_CASE("Unit_hipMemcpy3D_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipMemcpy3D_Positive_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr bool async = false; Memcpy3DZeroWidthHeightDepth(Memcpy3DWrapper); } TEST_CASE("Unit_hipMemcpy3D_Positive_Array") { + CHECK_IMAGE_SUPPORT + constexpr bool async = false; SECTION("Array from/to Host") { Memcpy3DArrayHostShell(Memcpy3DWrapper); } #if HT_NVIDIA // Disabled on AMD due to defect - EXSWHTEC-238 @@ -83,6 +91,8 @@ TEST_CASE("Unit_hipMemcpy3D_Positive_Array") { } TEST_CASE("Unit_hipMemcpy3D_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr hipExtent extent{128 * sizeof(int), 128, 8}; constexpr auto NegativeTests = [](hipPitchedPtr dst_ptr, hipPos dst_pos, hipPitchedPtr src_ptr, diff --git a/catch/unit/memory/hipMemcpy3DAsync.cc b/catch/unit/memory/hipMemcpy3DAsync.cc index 93baeb42d2..b1d8641329 100644 --- a/catch/unit/memory/hipMemcpy3DAsync.cc +++ b/catch/unit/memory/hipMemcpy3DAsync.cc @@ -31,6 +31,8 @@ THE SOFTWARE. #pragma clang diagnostic ignored "-Wunused-variable" TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Basic") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; const auto stream_type = GENERATE(Streams::nullstream, Streams::perThread, Streams::created); @@ -54,6 +56,8 @@ TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Basic") { } TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; HIP_CHECK(hipDeviceSynchronize()); @@ -78,6 +82,8 @@ TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Synchronization_Behavior") { } TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; Memcpy3DZeroWidthHeightDepth(Memcpy3DWrapper); } @@ -91,6 +97,8 @@ TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Array") { } TEST_CASE("Unit_hipMemcpy3DAsync_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + constexpr bool async = true; constexpr hipExtent extent{128 * sizeof(int), 128, 8}; diff --git a/catch/unit/memory/hipMemcpy3DAsync_old.cc b/catch/unit/memory/hipMemcpy3DAsync_old.cc index 451da3e4fc..cccbc3fc3f 100644 --- a/catch/unit/memory/hipMemcpy3DAsync_old.cc +++ b/catch/unit/memory/hipMemcpy3DAsync_old.cc @@ -657,9 +657,9 @@ void Memcpy3DAsync::simple_Memcpy3DAsync() { This testcase verifies hipMemcpyAsync for different datatypes and different sizes */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy3DAsync_Basic", - "[hipMemcpy3DAsync]", - int, unsigned int, float) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy3DAsync_Basic", "[hipMemcpy3DAsync]", int, unsigned int, float) { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); int device = -1; @@ -692,6 +692,8 @@ This testcase performs the extent validation scenarios of hipMemcpy3D API */ TEST_CASE("Unit_hipMemcpy3DAsync_ExtentValidation") { + CHECK_IMAGE_SUPPORT + Memcpy3DAsync memcpy3d(width, height, depth, hipChannelFormatKindSigned); memcpy3d.Extent_Validation(); @@ -702,6 +704,8 @@ This testcase performs the negative scenarios of hipMemcpy3DAsync API */ TEST_CASE("Unit_hipMemcpy3DAsync_multiDevice-Negative") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -718,6 +722,8 @@ This testcase performs the D2H,H2D and D2D on peer GPU device */ TEST_CASE("Unit_hipMemcpy3DAsync_multiDevice-D2D") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -743,6 +749,8 @@ allocating memory in one GPU and creating stream in another GPU */ TEST_CASE("Unit_hipMemcpy3DAsync_multiDevice-DiffStream") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { diff --git a/catch/unit/memory/hipMemcpy3D_old.cc b/catch/unit/memory/hipMemcpy3D_old.cc index 4af0883639..2a640a774f 100644 --- a/catch/unit/memory/hipMemcpy3D_old.cc +++ b/catch/unit/memory/hipMemcpy3D_old.cc @@ -550,8 +550,9 @@ void Memcpy3D::simple_Memcpy3D() { This testcase performs hipMemcpy3D API validation for different datatypes and different sizes */ -TEMPLATE_TEST_CASE("Unit_hipMemcpy3D_Basic", "[hipMemcpy3D]", - int, unsigned int, float) { +TEMPLATE_TEST_CASE("Unit_hipMemcpy3D_Basic", "[hipMemcpy3D]", int, unsigned int, float) { + CHECK_IMAGE_SUPPORT + int device = -1; HIP_CHECK(hipGetDevice(&device)); hipDeviceProp_t prop; @@ -581,6 +582,8 @@ This testcase performs the extent validation scenarios of hipMemcpy3D API */ TEST_CASE("Unit_hipMemcpy3D_ExtentValidation") { + CHECK_IMAGE_SUPPORT + Memcpy3D memcpy3d(width, height, depth, hipChannelFormatKindSigned); memcpy3d.Extent_Validation(); @@ -591,6 +594,8 @@ This testcase performs the negative scenarios of hipMemcpy3D API */ TEST_CASE("Unit_hipMemcpy3D_multiDevice-Negative") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -607,6 +612,8 @@ This testcase performs the D2H,H2D and D2D on peer GPU device */ TEST_CASE("Unit_hipMemcpy3D_multiDevice-OnPeerDevice") { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { diff --git a/catch/unit/memory/hipMemcpyAtoH.cc b/catch/unit/memory/hipMemcpyAtoH.cc index b97759a913..4933454297 100644 --- a/catch/unit/memory/hipMemcpyAtoH.cc +++ b/catch/unit/memory/hipMemcpyAtoH.cc @@ -16,17 +16,7 @@ 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_hipMemcpy2DFromArray_Positive_Default - Test basic memcpy between 2D array -and host/device with hipMemcpy2DFromArray api -Unit_hipMemcpy2DFromArray_Positive_Synchronization_Behavior - Test -synchronization behavior for hipMemcpy2DFromArray api -Unit_hipMemcpy2DFromArray_Positive_ZeroWidthHeight - Test that no data is copied -when width/height is set to 0 Unit_hipMemcpy2DFromArray_Negative_Parameters - -Test unsuccessful execution of hipMemcpy2DFromArray api when parameters are -invalid -*/ + #include "array_memcpy_tests_common.hh" #include @@ -35,6 +25,8 @@ invalid #include TEST_CASE("Unit_hipMemcpyAtoH_Positive_Default") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = GENERATE(512, 1024, 2048); @@ -44,6 +36,8 @@ TEST_CASE("Unit_hipMemcpyAtoH_Positive_Default") { } TEST_CASE("Unit_hipMemcpyAtoH_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = GENERATE(512, 1024, 2048); @@ -63,6 +57,8 @@ SWDEV-274683 */ #if HT_NVIDIA TEST_CASE("Unit_hipMemcpyAtoH_Positive_ZeroCount") { + CHECK_IMAGE_SUPPORT + const auto width = 1024; const auto height = 0; const auto allocation_size = width * sizeof(int); @@ -85,6 +81,8 @@ TEST_CASE("Unit_hipMemcpyAtoH_Positive_ZeroCount") { #endif TEST_CASE("Unit_hipMemcpyAtoH_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 1024; diff --git a/catch/unit/memory/hipMemcpyAtoH_old.cc b/catch/unit/memory/hipMemcpyAtoH_old.cc index d8d28432e3..e2319ce567 100644 --- a/catch/unit/memory/hipMemcpyAtoH_old.cc +++ b/catch/unit/memory/hipMemcpyAtoH_old.cc @@ -43,8 +43,9 @@ Output:"B_h" host variable output of hipMemcpyAtoH API The same scenario is then verified with pinned host memory */ -TEMPLATE_TEST_CASE("Unit_hipMemcpyAtoH_Basic", "[hipMemcpyAtoH]", - char, int, float) { +TEMPLATE_TEST_CASE("Unit_hipMemcpyAtoH_Basic", "[hipMemcpyAtoH]", char, int, float) { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); // 1 refers to pinned host memory scenario auto memtype_check = GENERATE(0, 1); @@ -93,9 +94,10 @@ Output:"B_h" host variable output of hipMemcpyAtoH API is then validated with "hData" */ #if HT_AMD -TEMPLATE_TEST_CASE("Unit_hipMemcpyAtoH_multiDevice-PeerDeviceContext", - "[hipMemcpyAtoH]", - char, int, float) { +TEMPLATE_TEST_CASE("Unit_hipMemcpyAtoH_multiDevice-PeerDeviceContext", "[hipMemcpyAtoH]", char, int, + float) { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -143,6 +145,8 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAtoH_multiDevice-PeerDeviceContext", This testcase verifies the negative scenarios of hipMemcpyAtoH API */ TEST_CASE("Unit_hipMemcpyAtoH_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d; float *hData{nullptr}, *B_h{nullptr}; @@ -184,6 +188,8 @@ SWDEV-274683 */ #if HT_NVIDIA TEST_CASE("Unit_hipMemcpyAtoH_SizeCheck") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d; float *hData{nullptr}, *B_h{nullptr}, *def_data{nullptr}; diff --git a/catch/unit/memory/hipMemcpyHtoA.cc b/catch/unit/memory/hipMemcpyHtoA.cc index e144e261f6..6243b452f1 100644 --- a/catch/unit/memory/hipMemcpyHtoA.cc +++ b/catch/unit/memory/hipMemcpyHtoA.cc @@ -35,6 +35,8 @@ hipMemcpyHtoA api when parameters are invalid TEST_CASE("Unit_hipMemcpyHtoA_Positive_Default") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = GENERATE(512, 1024, 2048); @@ -44,6 +46,8 @@ TEST_CASE("Unit_hipMemcpyHtoA_Positive_Default") { } TEST_CASE("Unit_hipMemcpyHtoA_Positive_Synchronization_Behavior") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = GENERATE(512, 1024, 2048); @@ -60,6 +64,8 @@ SWDEV-274683 */ #if HT_NVIDIA TEST_CASE("Unit_hipMemcpyHtoA_Positive_ZeroCount") { + CHECK_IMAGE_SUPPORT + const auto width = 1024; const auto height = 0; const auto allocation_size = width * sizeof(int); @@ -85,6 +91,8 @@ TEST_CASE("Unit_hipMemcpyHtoA_Positive_ZeroCount") { #endif TEST_CASE("Unit_hipMemcpyHtoA_Negative_Parameters") { + CHECK_IMAGE_SUPPORT + using namespace std::placeholders; const auto width = 1024; diff --git a/catch/unit/memory/hipMemcpyHtoA_old.cc b/catch/unit/memory/hipMemcpyHtoA_old.cc index 8712704400..5c87a4fb46 100644 --- a/catch/unit/memory/hipMemcpyHtoA_old.cc +++ b/catch/unit/memory/hipMemcpyHtoA_old.cc @@ -43,8 +43,9 @@ Output: "A_d" output of hipMemcpyHtoA is copied to "hData" host variable The same scenario is then verified with pinned host memory */ -TEMPLATE_TEST_CASE("Unit_hipMemcpyHtoA_Basic", "[hipMemcpyHtoA]", - char, int, float) { +TEMPLATE_TEST_CASE("Unit_hipMemcpyHtoA_Basic", "[hipMemcpyHtoA]", char, int, float) { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); auto memtype_check = GENERATE(0, 1); hipArray *A_d; @@ -95,9 +96,9 @@ Output: "A_d" output of hipMemcpyHtoA is copied to "hData" host variable validated the result with "B_h" */ #if HT_AMD -TEMPLATE_TEST_CASE("Unit_hipMemcpyHtoA_multiDevice-PeerDeviceContext", - "[hipMemcpyHtoA]", - char, int, float) { +TEMPLATE_TEST_CASE("Unit_hipMemcpyHtoA_multiDevice-PeerDeviceContext", "[hipMemcpyHtoA]", char, int, + float) { + CHECK_IMAGE_SUPPORT int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -149,6 +150,8 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyHtoA_multiDevice-PeerDeviceContext", This testcase verifies the negative scenarios of hipMemcpyHtoA API */ TEST_CASE("Unit_hipMemcpyHtoA_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d; float *hData{nullptr}, *B_h{nullptr}; @@ -190,6 +193,8 @@ SWDEV-274683 */ #if HT_NVIDIA TEST_CASE("Unit_hipMemcpyHtoA_SizeCheck") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); hipArray *A_d; float *hData{nullptr}, *B_h{nullptr}, *def_data{nullptr}; diff --git a/catch/unit/memory/hipMemcpyParam2D.cc b/catch/unit/memory/hipMemcpyParam2D.cc index 97ea04739b..06d1654f93 100644 --- a/catch/unit/memory/hipMemcpyParam2D.cc +++ b/catch/unit/memory/hipMemcpyParam2D.cc @@ -39,10 +39,10 @@ static constexpr size_t NUM_H{10}; * it with the initalized data "C_h". * */ -TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2D_multiDevice-D2D", - "[hipMemcpyParam2D]", - char, float, int, +TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2D_multiDevice-D2D", "[hipMemcpyParam2D]", char, float, int, double, long double) { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -125,9 +125,10 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2D_multiDevice-D2D", * * Validating the result by comparing "A_h" to "C_h" */ -TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2D_multiDevice-H2D-D2H", - "[hipMemcpyParam2D]", char, float, - int, double, long double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2D_multiDevice-H2D-D2H", "[hipMemcpyParam2D]", char, float, + int, double, long double) { + CHECK_IMAGE_SUPPORT + // 1 refers to pinned host memory and 0 refers // to unpinned memory auto memory_type = GENERATE(0, 1); @@ -226,6 +227,8 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2D_multiDevice-H2D-D2H", * This testcase verifies the extent validation scenarios */ TEST_CASE("Unit_hipMemcpyParam2D_ExtentValidation") { + CHECK_IMAGE_SUPPORT + // Allocating memory and Initializing the data HIP_CHECK(hipSetDevice(0)); char* A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, @@ -298,6 +301,8 @@ TEST_CASE("Unit_hipMemcpyParam2D_ExtentValidation") { * This testcase verifies the negative scenarios */ TEST_CASE("Unit_hipMemcpyParam2D_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); // Allocating and Initializing the data diff --git a/catch/unit/memory/hipMemcpyParam2DAsync.cc b/catch/unit/memory/hipMemcpyParam2DAsync.cc index 950082678f..1ad5767620 100644 --- a/catch/unit/memory/hipMemcpyParam2DAsync.cc +++ b/catch/unit/memory/hipMemcpyParam2DAsync.cc @@ -44,8 +44,9 @@ static constexpr size_t NUM_H{10}; * */ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-StreamOnDiffDevice", - "[hipMemcpyParam2DAsync]", char, float, int, - double, long double) { + "[hipMemcpyParam2DAsync]", char, float, int, double, long double) { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -131,9 +132,10 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-StreamOnDiffDevice", * it with the initalized data "C_h". * */ -TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-D2D", - "[hipMemcpyParam2DAsync]", char, +TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-D2D", "[hipMemcpyParam2DAsync]", char, int, float, double, long double) { + CHECK_IMAGE_SUPPORT + int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); if (numDevices > 1) { @@ -219,9 +221,10 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-D2D", * * Validating the result by comparing "A_h" to "C_h" */ -TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-H2D-D2H", - "[hipMemcpyParam2DAsync]", char, - int, float, double, long double) { +TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-H2D-D2H", "[hipMemcpyParam2DAsync]", + char, int, float, double, long double) { + CHECK_IMAGE_SUPPORT + // 1 refers to pinned host memory and 0 refers // to unpinned memory auto memory_type = GENERATE(0, 1); @@ -324,6 +327,8 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyParam2DAsync_multiDevice-H2D-D2H", * This testcase verifies the extent validation scenarios */ TEST_CASE("Unit_hipMemcpyParam2DAsync_ExtentValidation") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); char* A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, * A_d{nullptr}; @@ -402,6 +407,8 @@ TEST_CASE("Unit_hipMemcpyParam2DAsync_ExtentValidation") { * This testcase verifies the negative scenarios */ TEST_CASE("Unit_hipMemcpyParam2DAsync_Negative") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); float* A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, * A_d{nullptr}; diff --git a/catch/unit/memory/hipMemset2D.cc b/catch/unit/memory/hipMemset2D.cc index 2b2cb0463d..27284850bb 100644 --- a/catch/unit/memory/hipMemset2D.cc +++ b/catch/unit/memory/hipMemset2D.cc @@ -48,6 +48,8 @@ static constexpr std::initializer_list tableItems { * Basic Functionality of hipMemset2D */ TEST_CASE("Unit_hipMemset2D_BasicFunctional") { + CHECK_IMAGE_SUPPORT + constexpr int memsetval = 0x24; constexpr size_t numH = 256; constexpr size_t numW = 256; @@ -87,6 +89,8 @@ TEST_CASE("Unit_hipMemset2D_BasicFunctional") { * Basic Functionality of hipMemset2DAsync */ TEST_CASE("Unit_hipMemset2DAsync_BasicFunctional") { + CHECK_IMAGE_SUPPORT + constexpr int memsetval = 0x26; constexpr size_t numH = 256; constexpr size_t numW = 256; @@ -130,6 +134,8 @@ TEST_CASE("Unit_hipMemset2DAsync_BasicFunctional") { * Memset partial buffer with unique Width and Height */ TEST_CASE("Unit_hipMemset2D_UniqueWidthHeight") { + CHECK_IMAGE_SUPPORT + int width2D, height2D; int memsetWidth, memsetHeight; char *A_d, *A_h; diff --git a/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc b/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc index 3870f9bf6f..f70736da82 100644 --- a/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc +++ b/catch/unit/memory/hipMemset2DAsyncMultiThreadAndKernel.cc @@ -50,6 +50,8 @@ void queueJobsForhipMemset2DAsync(char* A_d, char* A_h, size_t pitch, * Order of execution of device kernel and hipMemset2DAsync api. */ TEST_CASE("Unit_hipMemset2DAsync_WithKernel") { + CHECK_IMAGE_SUPPORT + constexpr auto N = 4 * 1024 * 1024; constexpr auto blocksPerCU = 6; // to hide latency constexpr auto threadsPerBlock = 256; @@ -132,6 +134,8 @@ TEST_CASE("Unit_hipMemset2DAsync_WithKernel") { * hipMemSet2DAsync execution in multiple threads. */ TEST_CASE("Unit_hipMemset2DAsync_MultiThread") { + CHECK_IMAGE_SUPPORT + constexpr auto memPerThread = 200; constexpr int memsetval = 0x22; char *A_d, *A_h, *B_d, *B_h, *C_d; diff --git a/catch/unit/memory/hipMemset3D.cc b/catch/unit/memory/hipMemset3D.cc index 0fc1a83818..be6ff9198f 100644 --- a/catch/unit/memory/hipMemset3D.cc +++ b/catch/unit/memory/hipMemset3D.cc @@ -32,6 +32,8 @@ THE SOFTWARE. * Basic Functional test of hipMemset3D */ TEST_CASE("Unit_hipMemset3D_BasicFunctional") { + CHECK_IMAGE_SUPPORT + constexpr int memsetval = 0x22; constexpr size_t numH = 256; constexpr size_t numW = 256; @@ -80,6 +82,8 @@ TEST_CASE("Unit_hipMemset3D_BasicFunctional") { * Basic Functional test of hipMemset3DAsync */ TEST_CASE("Unit_hipMemset3DAsync_BasicFunctional") { + CHECK_IMAGE_SUPPORT + constexpr int memsetval = 0x22; constexpr size_t numH = 256; constexpr size_t numW = 256; diff --git a/catch/unit/memory/hipMemset3DFunctional.cc b/catch/unit/memory/hipMemset3DFunctional.cc index 11d36a70cc..aae255e04b 100644 --- a/catch/unit/memory/hipMemset3DFunctional.cc +++ b/catch/unit/memory/hipMemset3DFunctional.cc @@ -416,6 +416,8 @@ static void seekAndSet3DArrayPortion(bool bAsync) { * taking zero and non-zero fields. */ TEST_CASE("Unit_hipMemset3D_MemsetWithExtent") { + CHECK_IMAGE_SUPPORT + hipExtent testExtent; size_t numH = NUMH_EXT, numW = NUMW_EXT, depth = DEPTH_EXT; @@ -450,6 +452,8 @@ TEST_CASE("Unit_hipMemset3D_MemsetWithExtent") { * taking zero and non-zero fields. */ TEST_CASE("Unit_hipMemset3DAsync_MemsetWithExtent") { + CHECK_IMAGE_SUPPORT + hipExtent testExtent; size_t numH = NUMH_EXT, numW = NUMW_EXT, depth = DEPTH_EXT; @@ -482,6 +486,8 @@ TEST_CASE("Unit_hipMemset3DAsync_MemsetWithExtent") { * Memset3D with max unsigned char and verify memset operation is success */ TEST_CASE("Unit_hipMemset3D_MemsetMaxValue") { + CHECK_IMAGE_SUPPORT + testMemsetMaxValue(0); } @@ -489,6 +495,8 @@ TEST_CASE("Unit_hipMemset3D_MemsetMaxValue") { * Memset3DAsync with max unsigned char and verify memset operation is success */ TEST_CASE("Unit_hipMemset3DAsync_MemsetMaxValue") { + CHECK_IMAGE_SUPPORT + testMemsetMaxValue(1); } @@ -496,6 +504,8 @@ TEST_CASE("Unit_hipMemset3DAsync_MemsetMaxValue") { * Seek and set random slice of 3d array, verify memset is success */ TEST_CASE("Unit_hipMemset3D_SeekSetSlice") { + CHECK_IMAGE_SUPPORT + seekAndSet3DArraySlice(0); } @@ -503,6 +513,8 @@ TEST_CASE("Unit_hipMemset3D_SeekSetSlice") { * Seek and set random slice of 3d array with async, verify memset is success */ TEST_CASE("Unit_hipMemset3DAsync_SeekSetSlice") { + CHECK_IMAGE_SUPPORT + seekAndSet3DArraySlice(1); } @@ -510,6 +522,8 @@ TEST_CASE("Unit_hipMemset3DAsync_SeekSetSlice") { * Memset3D selected portion of 3d array */ TEST_CASE("Unit_hipMemset3D_SeekSetArrayPortion") { + CHECK_IMAGE_SUPPORT + seekAndSet3DArrayPortion(0); } @@ -517,5 +531,7 @@ TEST_CASE("Unit_hipMemset3D_SeekSetArrayPortion") { * Memset3DAsync selected portion of 3d array */ TEST_CASE("Unit_hipMemset3DAsync_SeekSetArrayPortion") { + CHECK_IMAGE_SUPPORT + seekAndSet3DArrayPortion(1); } diff --git a/catch/unit/memory/hipMemset3DRegressMultiThread.cc b/catch/unit/memory/hipMemset3DRegressMultiThread.cc index 2f3c31933b..a30af0cea1 100644 --- a/catch/unit/memory/hipMemset3DRegressMultiThread.cc +++ b/catch/unit/memory/hipMemset3DRegressMultiThread.cc @@ -188,6 +188,8 @@ bool loopRegression(bool bAsync) { * on different gpus. */ TEST_CASE("Unit_hipMemset3D_RegressInLoop") { + CHECK_IMAGE_SUPPORT + bool TestPassed = false; TestPassed = loopRegression(0); @@ -199,6 +201,8 @@ TEST_CASE("Unit_hipMemset3D_RegressInLoop") { * on different gpus. */ TEST_CASE("Unit_hipMemset3DAsync_RegressInLoop") { + CHECK_IMAGE_SUPPORT + bool TestPassed = false; TestPassed = loopRegression(1); @@ -209,6 +213,8 @@ TEST_CASE("Unit_hipMemset3DAsync_RegressInLoop") { * Async commands queued concurrently and executed */ TEST_CASE("Unit_hipMemset3DAsync_ConcurrencyMthread") { + CHECK_IMAGE_SUPPORT + char *A_h; constexpr int memsetval = 1, testval = 2; constexpr size_t numH = 256, numW = 100, depth = 10; diff --git a/catch/unit/memory/hipMemsetFunctional.cc b/catch/unit/memory/hipMemsetFunctional.cc index 2f2b478ae3..1694d530ed 100644 --- a/catch/unit/memory/hipMemsetFunctional.cc +++ b/catch/unit/memory/hipMemsetFunctional.cc @@ -281,6 +281,8 @@ void checkMemset2D(T value, size_t width, size_t height, bool async = false, siz } TEST_CASE("Unit_hipMemsetFunctional_ZeroValue_2D") { + CHECK_IMAGE_SUPPORT + constexpr size_t width{128}; constexpr size_t height{128}; constexpr char memsetVal = 0; @@ -289,12 +291,16 @@ TEST_CASE("Unit_hipMemsetFunctional_ZeroValue_2D") { } TEST_CASE("Unit_hipMemsetFunctional_SmallSize_2D") { + CHECK_IMAGE_SUPPORT + constexpr char memsetVal = 0x42; SECTION("hipMemset2D - Small Size") { checkMemset2D(memsetVal, 1, 1, false); } SECTION("hipMemset2DAsync - Small Size") { checkMemset2D(memsetVal, 1, 1, true); } } TEST_CASE("Unit_hipMemsetFunctional_ZeroSize_2D") { + CHECK_IMAGE_SUPPORT + size_t pitch{0}; size_t width{10}; size_t height{10}; @@ -375,6 +381,8 @@ void partialMemsetTest2D(T valA, T valB, size_t width, size_t height, size_t wid } TEST_CASE("Unit_hipMemsetFunctional_PartialSet_2D") { + CHECK_IMAGE_SUPPORT + for (auto widthOffset = 8; widthOffset <= 128; widthOffset *= 2) { for (auto heightOffset = 8; heightOffset <= 128; heightOffset *= 2) { SECTION("hipMemset2D - Partial Set") { @@ -487,12 +495,20 @@ void check_memset_3D(std::string sectionStr, size_t width, size_t height, size_t } TEST_CASE("Unit_hipMemsetFunctional_ZeroValue_3D") { + CHECK_IMAGE_SUPPORT + check_memset_3D("Zero Value", 128, 128, 10, 0); } -TEST_CASE("Unit_hipMemsetFunctional_SmallSize_3D") { check_memset_3D("Small Size", 1, 1, 1, 0x42); } +TEST_CASE("Unit_hipMemsetFunctional_SmallSize_3D") { + CHECK_IMAGE_SUPPORT + + check_memset_3D("Small Size", 1, 1, 1, 0x42); +} TEST_CASE("Unit_hipMemsetFunctional_ZeroSize_3D") { + CHECK_IMAGE_SUPPORT + constexpr size_t elementSize = sizeof(char); check_memset_3D("Zero Width", 0, FULL_DIM, FULL_DIM, 0x23); check_memset_3D("Zero Height", FULL_DIM * elementSize, 0, FULL_DIM, 0x23); @@ -543,6 +559,8 @@ void partialMemsetTest3D(T valA, T valB, size_t width, size_t height, size_t dep } TEST_CASE("Unit_hipMemsetFunctional_PartialSet_3D") { + CHECK_IMAGE_SUPPORT + for (auto widthOffset = 8; widthOffset <= 128; widthOffset *= 2) { for (auto heightOffset = 8; heightOffset <= 128; heightOffset *= 2) { for (auto depthOffset = 2; depthOffset <= 5; depthOffset++) { diff --git a/catch/unit/memory/hipMemsetNegative.cc b/catch/unit/memory/hipMemsetNegative.cc index 929ff2e3c6..4af79a66f2 100644 --- a/catch/unit/memory/hipMemsetNegative.cc +++ b/catch/unit/memory/hipMemsetNegative.cc @@ -91,6 +91,8 @@ TEST_CASE("Unit_hipMemset_Negative_OutOfBoundsPtr") { } TEST_CASE("Unit_hipMemset2D_Negative_InvalidPtr") { + CHECK_IMAGE_SUPPORT + void* dst; SECTION("Uninitialized Dst") {} SECTION("Nullptr as Dst") { dst = nullptr; } @@ -109,6 +111,8 @@ TEST_CASE("Unit_hipMemset2D_Negative_InvalidPtr") { } TEST_CASE("Unit_hipMemset2D_Negative_InvalidSizes") { + CHECK_IMAGE_SUPPORT + void* dst; size_t realPitch; HIP_CHECK(hipMallocPitch(&dst, &realPitch, width, height)); @@ -133,6 +137,8 @@ TEST_CASE("Unit_hipMemset2D_Negative_InvalidSizes") { } TEST_CASE("Unit_hipMemset2D_Negative_OutOfBoundsPtr") { + CHECK_IMAGE_SUPPORT + void* dst; size_t realPitch; @@ -144,6 +150,8 @@ TEST_CASE("Unit_hipMemset2D_Negative_OutOfBoundsPtr") { TEST_CASE("Unit_hipMemset3D_Negative_InvalidPtr") { + CHECK_IMAGE_SUPPORT + hipPitchedPtr pitchedDevPtr; SECTION("Uninitialized PitchedDevPtr") {} @@ -153,6 +161,8 @@ TEST_CASE("Unit_hipMemset3D_Negative_InvalidPtr") { } TEST_CASE("Unit_hipMemset3D_Negative_ModifiedPtr") { + CHECK_IMAGE_SUPPORT + hipPitchedPtr pitchedDevPtr; HIP_CHECK(hipMalloc3D(&pitchedDevPtr, validExtent)); @@ -174,6 +184,8 @@ TEST_CASE("Unit_hipMemset3D_Negative_ModifiedPtr") { } TEST_CASE("Unit_hipMemset3D_Negative_InvalidSizes") { + CHECK_IMAGE_SUPPORT + hipPitchedPtr pitchedDevPtr; HIP_CHECK(hipMalloc3D(&pitchedDevPtr, validExtent)); hipExtent invalidExtent{validExtent}; @@ -200,6 +212,8 @@ TEST_CASE("Unit_hipMemset3D_Negative_InvalidSizes") { } TEST_CASE("Unit_hipMemset3D_Negative_OutOfBounds") { + CHECK_IMAGE_SUPPORT + hipPitchedPtr pitchedDevPtr; HIP_CHECK(hipMalloc3D(&pitchedDevPtr, validExtent)); diff --git a/catch/unit/memory/hipPointerGetAttribute.cc b/catch/unit/memory/hipPointerGetAttribute.cc index b0e1e7a5f8..63de44ef8e 100644 --- a/catch/unit/memory/hipPointerGetAttribute.cc +++ b/catch/unit/memory/hipPointerGetAttribute.cc @@ -59,6 +59,8 @@ static __global__ void var_update(int* data) { /* Allocate memory using different Allocation APIs and check whether correct memory type and device oridinal are returned */ TEST_CASE("Unit_hipPointerGetAttribute_MemoryTypes") { + CHECK_IMAGE_SUPPORT + HIP_CHECK(hipSetDevice(0)); size_t pitch_A; size_t width{NUM_W * sizeof(char)}; diff --git a/catch/unit/streamperthread/hipStreamPerThrdCompilerOptn.cc b/catch/unit/streamperthread/hipStreamPerThrdCompilerOptn.cc index 15e15a38bf..ed7604363c 100644 --- a/catch/unit/streamperthread/hipStreamPerThrdCompilerOptn.cc +++ b/catch/unit/streamperthread/hipStreamPerThrdCompilerOptn.cc @@ -713,6 +713,8 @@ void DefaultPT2_hipMemcpy3D() { TEST_CASE("Unit_hipStrmPerThrdDefault") { + CHECK_IMAGE_SUPPORT + SECTION("Testing hipMemset/Memcpy() and their async version") { REQUIRE(DefaultPT2_Memcpy_MemSet(1, 0)); REQUIRE(DefaultPT2_Memcpy_MemSet(1, 1));