SWDEV-432490 - fix __HIP_NO_IMAGE_SUPPORT logic

1.Skip texture/image tests when __HIP_NO_IMAGE_SUPPORT is set to prevent inevitable silent failure
2.Simplify __HIP_NO_IMAGE_SUPPORT macros

Change-Id: I54ef12a239298c534a213edf39c05c2dad06a7f4
This commit is contained in:
Todd tiantuo Li
2024-01-26 03:44:44 -08:00
committato da Rakesh Roy
parent 42d383619c
commit 0ee0e4ab4a
26 ha cambiato i file con 305 aggiunte e 39 eliminazioni
+41 -1
Vedi File
@@ -75,6 +75,11 @@ static void ArrayCreate_DiffSizes(int gpu) {
TEST_CASE("Unit_hipArrayCreate_DiffSizes") {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
ArrayCreate_DiffSizes(0);
HIP_CHECK_THREAD_FINALIZE();
}
@@ -87,6 +92,11 @@ and verifies the hipArrayCreate API with small and big chunks data
TEST_CASE("Unit_hipArrayCreate_MultiThread") {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
std::vector<std::thread> threadlist;
int devCnt = 0;
@@ -188,7 +198,7 @@ void testArrayAsTexture(hipArray_t array, const size_t width, const size_t heigh
std::fill(std::begin(hostData), std::end(hostData), 0);
HIP_CHECK(hipMemcpy(hostData.data(), device_data, size, hipMemcpyDeviceToHost));
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
#if !__HIP_NO_IMAGE_SUPPORT
checkDataIsAscending(hostData);
#endif
@@ -203,6 +213,11 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, sho
char4, float, float2, float4) {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
using vec_info = vector_info<TestType>;
DriverContext ctx;
@@ -228,6 +243,11 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_maxTexture", "", uint, int, int4, ushort
uchar2, char4, float, float2, float4) {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
using vec_info = vector_info<TestType>;
DriverContext ctx;
@@ -288,6 +308,11 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_maxTexture", "", uint, int, int4, ushort
TEST_CASE("Unit_hipArrayCreate_ZeroWidth") {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
DriverContext ctx;
HIP_ARRAY_DESCRIPTOR desc;
desc.Format = driverFormats[0];
@@ -304,6 +329,11 @@ TEST_CASE("Unit_hipArrayCreate_ZeroWidth") {
TEST_CASE("Unit_hipArrayCreate_Nullptr") {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
DriverContext ctx;
SECTION("Null array") {
HIP_ARRAY_DESCRIPTOR desc;
@@ -324,6 +354,11 @@ TEST_CASE("Unit_hipArrayCreate_Nullptr") {
TEST_CASE("Unit_hipArrayCreate_BadNumberChannelElement") {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
DriverContext ctx;
HIP_ARRAY_DESCRIPTOR desc;
desc.Format = GENERATE(from_range(std::begin(driverFormats), std::end(driverFormats)));
@@ -342,6 +377,11 @@ TEST_CASE("Unit_hipArrayCreate_BadNumberChannelElement") {
TEST_CASE("Unit_hipArrayCreate_BadChannelFormat") {
CHECK_IMAGE_SUPPORT
#if __HIP_NO_IMAGE_SUPPORT
HipTest::HIP_SKIP_TEST("__HIP_NO_IMAGE_SUPPORT is set");
return;
#endif
DriverContext ctx;
HIP_ARRAY_DESCRIPTOR desc;