diff --git a/catch/hipTestMain/config/config_amd_linux b/catch/hipTestMain/config/config_amd_linux index 8ec062709f..a9b3731491 100644 --- a/catch/hipTestMain/config/config_amd_linux +++ b/catch/hipTestMain/config/config_amd_linux @@ -1284,28 +1284,6 @@ "Unit_atomicCAS_system_Positive_Host_And_Peer_GPUs - unsigned long long", "SWDEV-447384, SWDEV-447932: These tests fail in gfx1100, gfx1101 & gfx1102", "Unit_hipFreeAsync_Negative_Parameters", - "Unit_hipMallocMipmappedArray_DiffSizes", - "Unit_hipMallocMipmappedArray_MultiThread", - "Unit_hipMallocMipmappedArray_happy - char", - "Unit_hipMallocMipmappedArray_happy - uint2", - "Unit_hipMallocMipmappedArray_happy - int4", - "Unit_hipMallocMipmappedArray_happy - short4", - "Unit_hipMallocMipmappedArray_happy - float", - "Unit_hipMallocMipmappedArray_Negative_ZeroWidth", - "Unit_hipMallocMipmappedArray_Negative_ZeroHeight", - "Unit_hipMallocMipmappedArray_Negative_InvalidFlags", - "Unit_hipMallocMipmappedArray_Negative_InvalidFormat", - "Unit_hipMallocMipmappedArray_Negative_BadChannelLayout", - "Unit_hipMallocMipmappedArray_Negative_8BitFloat", - "Unit_hipMallocMipmappedArray_Negative_BadChannelSize", - "Unit_hipMallocMipmappedArray_Negative_NumericLimit", - "Unit_hipMallocMipmappedArray_Negative_NumLevels", - "Unit_hipGetMipmappedArrayLevel_Negative", - "Unit_hipFreeMipmappedArrayImplicitSyncArray - char", - "Unit_hipFreeMipmappedArrayImplicitSyncArray - float", - "Unit_hipFreeMipmappedArray_Negative_DoubleFree", - "Unit_hipFreeMipmappedArrayMultiTArray - char", - "Unit_hipFreeMipmappedArrayMultiTArray - int", "Unit_hipIpcGetMemHandle_Positive_Unique_Handles_Reused_Memory", "SWDEV-445928: These tests fail in PSDB stress test on 09/02/2024", "Unit_hipGraphAddNodeTypeMemset_Positive_Basic - uint8_t", diff --git a/catch/hipTestMain/hip_test_context.cc b/catch/hipTestMain/hip_test_context.cc index 390da25451..05d71fb1a6 100644 --- a/catch/hipTestMain/hip_test_context.cc +++ b/catch/hipTestMain/hip_test_context.cc @@ -324,7 +324,8 @@ void TestContext::finalizeResults() { INFO("HIP API Result check\n File:: " << i.file << "\n Line:: " << i.line << "\n API:: " << i.call << "\n Result:: " << i.result << "\n Result Str:: " << hipGetErrorString(i.result)); - REQUIRE(((i.result == hipSuccess) || (i.result == hipErrorPeerAccessAlreadyEnabled))); + REQUIRE(((i.result == hipSuccess) || (i.result == hipErrorPeerAccessAlreadyEnabled) || + (i.result == hipErrorNotSupported))); REQUIRE(i.conditionsResult); } hasErrorOccured_.store(false); // Clear the flag diff --git a/catch/include/hip_test_common.hh b/catch/include/hip_test_common.hh index 0d4fb0c504..eb7690efb8 100644 --- a/catch/include/hip_test_common.hh +++ b/catch/include/hip_test_common.hh @@ -49,6 +49,23 @@ THE SOFTWARE. } \ } +#define HIP_CHECK_IGNORED_RETURN(error, ignoredError) \ + { \ + hipError_t localError = error; \ + if ((localError == ignoredError)) { \ + INFO("Skipped: " << hipGetErrorString(localError) << "\n Code: " << localError \ + << "\n Str: " << #error << "\n In File: " << __FILE__ \ + << "\n At line: " << __LINE__); \ + return; \ + } \ + if ((localError != hipSuccess) && (localError != hipErrorPeerAccessAlreadyEnabled)) { \ + INFO("Error: " << hipGetErrorString(localError) << "\n Code: " << localError \ + << "\n Str: " << #error << "\n In File: " << __FILE__ \ + << "\n At line: " << __LINE__); \ + REQUIRE(false); \ + } \ + } + // Threaded HIP_CHECKs #define HIP_CHECK_THREAD(error) \ { \ @@ -90,6 +107,20 @@ THE SOFTWARE. REQUIRE(localError == expectedError); \ } +// Check that an expression, errorExpr, evaluates to the expected error_t, expectedError or +// expectedError1. +#define HIP_CHECK_ERRORS(errorExpr, expectedError, expectedError1) \ + { \ + hipError_t localError = errorExpr; \ + INFO("Matching Errors: " \ + << "\n Expected Error: " << hipGetErrorString(expectedError) \ + << "\n Expected Code: " << expectedError << " or " << expectedError << '\n' \ + << " Actual Error: " << hipGetErrorString(localError) \ + << "\n Actual Code: " << localError << "\nStr: " << #errorExpr \ + << "\n In File: " << __FILE__ << "\n At line: " << __LINE__); \ + REQUIRE((localError == expectedError || localError == expectedError1)); \ + } + // Not thread-safe #define HIPRTC_CHECK(error) \ { \ diff --git a/catch/unit/memory/hipFreeMipmappedArray.cc b/catch/unit/memory/hipFreeMipmappedArray.cc index 4fe2fb7436..e31467ed18 100644 --- a/catch/unit/memory/hipFreeMipmappedArray.cc +++ b/catch/unit/memory/hipFreeMipmappedArray.cc @@ -52,7 +52,8 @@ TEMPLATE_TEST_CASE("Unit_hipFreeMipmappedArrayImplicitSyncArray", "", char, floa const unsigned int numLevels = GENERATE(1, 5, 7); - HIP_CHECK(hipMallocMipmappedArray(&arrayPtr, &desc, extent, numLevels, flags)); + HIP_CHECK_IGNORED_RETURN(hipMallocMipmappedArray(&arrayPtr, &desc, extent, numLevels, flags), + hipErrorNotSupported); LaunchDelayKernel(std::chrono::milliseconds{50}, nullptr); // make sure device is busy @@ -82,7 +83,8 @@ TEST_CASE("Unit_hipFreeMipmappedArray_Negative_DoubleFree") { const unsigned int numLevels = GENERATE(1, 5, 7); - HIP_CHECK(hipMallocMipmappedArray(&arrayPtr, &desc, extent, numLevels, flags)); + HIP_CHECK_IGNORED_RETURN(hipMallocMipmappedArray(&arrayPtr, &desc, extent, numLevels, flags), + hipErrorNotSupported); HIP_CHECK(hipFreeMipmappedArray(arrayPtr)); HIP_CHECK_ERROR(hipFreeMipmappedArray(arrayPtr), hipErrorContextIsDestroyed); diff --git a/catch/unit/memory/hipMallocMipmappedArray.cc b/catch/unit/memory/hipMallocMipmappedArray.cc index 43da90a3ee..2c5164440a 100644 --- a/catch/unit/memory/hipMallocMipmappedArray.cc +++ b/catch/unit/memory/hipMallocMipmappedArray.cc @@ -153,8 +153,8 @@ TEMPLATE_TEST_CASE("Unit_hipMallocMipmappedArray_happy", "", char, uint2, int4, for (const auto extent : extents) { CAPTURE(flags, extent.width, extent.height, extent.depth); - - HIP_CHECK(hipMallocMipmappedArray(&array, &desc, extent, numLevels, flags)); + HIP_CHECK_IGNORED_RETURN(hipMallocMipmappedArray(&array, &desc, extent, numLevels, flags), + hipErrorNotSupported); hipArray_t hipArray = nullptr; HIP_CHECK(hipGetMipmappedArrayLevel(&hipArray, array, 0)); checkMipmappedArrayIsExpected(hipArray, desc, extent, flags); @@ -218,8 +218,8 @@ TEST_CASE("Unit_hipMallocMipmappedArray_Negative_ZeroWidth") { const auto flag = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); - HIP_CHECK_ERROR(hipMallocMipmappedArray(&array, &desc, make_hipExtent(0, s, s), numLevels, flag), - hipErrorInvalidValue); + HIP_CHECK_ERRORS(hipMallocMipmappedArray(&array, &desc, make_hipExtent(0, s, s), numLevels, flag), + hipErrorInvalidValue, hipErrorNotSupported); } // Zero height arrays are only allowed for 1D arrays and layered arrays @@ -235,9 +235,9 @@ TEST_CASE("Unit_hipMallocMipmappedArray_Negative_ZeroHeight") { if (std::find(std::begin(exceptions), std::end(exceptions), flag) == std::end(exceptions)) { // flag is not in list of exceptions - HIP_CHECK_ERROR( + HIP_CHECK_ERRORS( hipMallocMipmappedArray(&array, &desc, make_hipExtent(s, 0, s), numLevels, flag), - hipErrorInvalidValue); + hipErrorInvalidValue, hipErrorNotSupported); } } @@ -260,9 +260,9 @@ TEST_CASE("Unit_hipMallocMipmappedArray_Negative_InvalidFlags") { REQUIRE(std::find(std::begin(validFlags), std::end(validFlags), flag) == std::end(validFlags)); - HIP_CHECK_ERROR( + HIP_CHECK_ERRORS( hipMallocMipmappedArray(&array, &desc, makeMipmappedExtent(flag, s), numLevels, flag), - hipErrorInvalidValue); + hipErrorInvalidValue, hipErrorNotSupported); } void testInvalidDescriptionMipmapped(hipChannelFormatDesc desc) { @@ -277,9 +277,9 @@ void testInvalidDescriptionMipmapped(hipChannelFormatDesc desc) { #endif const auto flag = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); - HIP_CHECK_ERROR( + HIP_CHECK_ERRORS( hipMallocMipmappedArray(&array, &desc, makeMipmappedExtent(flag, s), numLevels, flag), - expectedError); + expectedError, hipErrorNotSupported); } TEST_CASE("Unit_hipMallocMipmappedArray_Negative_InvalidFormat") { @@ -360,9 +360,9 @@ TEST_CASE("Unit_hipMallocMipmappedArray_Negative_NumericLimit") { size_t size = std::numeric_limits::max(); const auto flag = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); - HIP_CHECK_ERROR( + HIP_CHECK_ERRORS( hipMallocMipmappedArray(&arrayPtr, &desc, makeMipmappedExtent(flag, size), numLevels, flag), - hipErrorInvalidValue); + hipErrorInvalidValue, hipErrorNotSupported); } // texture gather arrays are only allowed to be 2D @@ -391,9 +391,9 @@ TEST_CASE("Unit_hipMallocMipmappedArray_Negative_NumLevels") { hipChannelFormatDesc desc = hipCreateChannelDesc(); const auto flag = GENERATE(from_range(std::begin(validFlags), std::end(validFlags))); - HIP_CHECK_ERROR( + HIP_CHECK_ERRORS( hipMallocMipmappedArray(&array, &desc, makeMipmappedExtent(flag, size), numLevels, flag), - hipErrorInvalidValue); + hipErrorInvalidValue, hipErrorNotSupported); } TEST_CASE("Unit_hipGetMipmappedArrayLevel_Negative") { @@ -404,8 +404,9 @@ TEST_CASE("Unit_hipGetMipmappedArrayLevel_Negative") { hipChannelFormatDesc desc = hipCreateChannelDesc(); - HIP_CHECK( - hipMallocMipmappedArray(&array, &desc, make_hipExtent(s, s, s), numLevels, hipArrayDefault)); + HIP_CHECK_IGNORED_RETURN( + hipMallocMipmappedArray(&array, &desc, make_hipExtent(s, s, s), numLevels, hipArrayDefault), + hipErrorNotSupported); SECTION("Level is invalid") { HIP_CHECK_ERROR(hipGetMipmappedArrayLevel(&level_array, array, 3), hipErrorInvalidValue); }