SWDEV-465162 - Support ignored error

Modified
TestContext::finalizeResults()

Added
HIP_CHECK_IGNORED_RETURN()
HIP_CHECK_ERRORS()

to supported ignored error such as hipErrorNotSupported.

Enable all mipmap tests in catch2 memory folder for linux.
The issues in the following tickets should be fixed.
SWDEV-465162, SWDEV-465163, SWDEV-465165, SWDEV-465166,
SWDEV-465168, SWDEV-465171, SWDEV-465172

Change-Id: I1146d6184582a7111a5af25b52f9e12c6a160e49
This commit is contained in:
taosang2
2024-06-11 14:09:37 -04:00
کامیت شده توسط Rakesh Roy
والد bcd3665ea9
کامیت de9581efb6
5فایلهای تغییر یافته به همراه54 افزوده شده و 41 حذف شده
@@ -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",
@@ -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
@@ -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) \
{ \
@@ -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);
@@ -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<size_t>::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<float>();
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<float>();
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);
}