EXSWHTEC-282 - Implement Unit Tests for channel descriptor create function (#215)

- Implement basic test cases for channel descriptor API
- Fix indentation
- Refactor channel descriptor tests
- Extend the list of FormatNone types
- Implement unit test for 16-Bit Floating-Point channel descriptor
- Regroup vector types and basic types within test cases
- Add builtin types to the size/kind calculation
- Uncomment mistakenly commented tests
- Remove cout from channel_descriptor_common.hh
- Exclude 16-bit floating point tests from NVIDIA build due to the build error for hipCreateChannelDescHalf* functions
- Add doxygen comments and disable tests due to defects
- Fix errors in doxygen comments
- Rename group for channel descriptor
- Modify Copyright header comment
- Apply clang-format
- Use std::is_same_v<> instead of std::is_same<>::value to enhance readability
- Disable failed tests on external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/215
Этот коммит содержится в:
milos-mozetic
2023-07-09 05:38:20 +02:00
коммит произвёл GitHub
родитель ee95b284c3
Коммит 262dc3d072
10 изменённых файлов: 505 добавлений и 6 удалений
+2 -1
Просмотреть файл
@@ -2160,7 +2160,8 @@ PREDEFINED = TEMPLATE_TEST_CASE(x)=x() \
__linux__ \
HT_AMD \
HT_NVIDIA \
__HIP_PLATFORM_NVCC__
__HIP_PLATFORM_NVCC__ \
__GNUC__
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
+12 -1
Просмотреть файл
@@ -46,6 +46,7 @@
"Unit_hipGraphAddMemcpyNode1D_Negative_Basic",
"intermittent issue: corrupted double-linked list",
"Unit_hipGraphRetainUserObject_Functional_2",
"Unit_ChannelDescriptor_Positive_16BitFloatingPoint",
"intermittent issue: failure expected but sucess returned",
"Unit_hipMemAdvise_NegtveTsts",
"Note: Following four tests disabled due to defect - EXSWHTEC-203",
@@ -98,6 +99,16 @@
"Unit_hipStreamValue_Write - TestParams<uint32_t, PtrType::HostPtr>",
"Unit_hipMemcpyParam2DAsync_multiDevice-StreamOnDiffDevice",
"=== Below tests fail in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/96 ===",
"Unit_hipHostGetDevicePointer_Negative"
"Unit_hipHostGetDevicePointer_Negative",
"=== Below tests fail in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/215 ===",
"Unit_ChannelDescriptor_Positive_Basic_1D - long",
"Unit_ChannelDescriptor_Positive_Basic_1D - unsigned long",
"Unit_ChannelDescriptor_Positive_Basic_1D - ulong1",
"Unit_ChannelDescriptor_Positive_Basic_1D - signed long",
"Unit_ChannelDescriptor_Positive_Basic_1D - long1",
"Unit_ChannelDescriptor_Positive_Basic_2D - ulong2",
"Unit_ChannelDescriptor_Positive_Basic_2D - long2",
"Unit_ChannelDescriptor_Positive_Basic_4D - ulong4",
"Unit_ChannelDescriptor_Positive_Basic_4D - long4"
]
}
+14 -1
Просмотреть файл
@@ -150,6 +150,7 @@
"Unit_hipStreamQuery_WithFinishedWork",
"Unit_hipLaunchHostFunc_Graph",
"Unit_hipLaunchHostFunc_KernelHost",
"Unit_ChannelDescriptor_Positive_16BitFloatingPoint",
"Unit_hipStreamSetCaptureDependencies_Positive_Functional",
"Note: Following four tests disabled due to defect - EXSWHTEC-203",
"Unit_hipGraphAddMemsetNode_Positive_Basic - uint16_t",
@@ -186,6 +187,18 @@
"Note: UUID returned empty on some windows nodes",
"Unit_hipDeviceGetUuid_Positive",
"=== Below tests fail in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/96 ===",
"Unit_hipHostGetDevicePointer_Negative"
"Unit_hipHostGetDevicePointer_Negative",
"=== Below tests fail in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/215 ===",
"Unit_ChannelDescriptor_Positive_Basic_1D - long",
"Unit_ChannelDescriptor_Positive_Basic_1D - unsigned long",
"Unit_ChannelDescriptor_Positive_Basic_1D - ulong1",
"Unit_ChannelDescriptor_Positive_Basic_1D - signed long",
"Unit_ChannelDescriptor_Positive_Basic_1D - long1",
"Unit_ChannelDescriptor_Positive_Basic_2D - ulong2",
"Unit_ChannelDescriptor_Positive_Basic_2D - long2",
"Unit_ChannelDescriptor_Positive_Basic_3D - ulong3",
"Unit_ChannelDescriptor_Positive_Basic_3D - long3",
"Unit_ChannelDescriptor_Positive_Basic_4D - ulong4",
"Unit_ChannelDescriptor_Positive_Basic_4D - long4"
]
}
+13 -1
Просмотреть файл
@@ -6,6 +6,18 @@
"Unit_hipFuncSetAttribute_Positive_MaxDynamicSharedMemorySize_Not_Supported",
"Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout_Not_Supported",
"=== Below test fails in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/85 ===",
"Unit_hipFuncSetAttribute_Negative_Parameters"
"Unit_hipFuncSetAttribute_Negative_Parameters",
"=== Below test fails in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/215 ===",
"Unit_ChannelDescriptor_Positive_Basic_1D - long",
"Unit_ChannelDescriptor_Positive_Basic_1D - unsigned long",
"Unit_ChannelDescriptor_Positive_Basic_1D - ulong1",
"Unit_ChannelDescriptor_Positive_Basic_1D - signed long",
"Unit_ChannelDescriptor_Positive_Basic_1D - long1",
"Unit_ChannelDescriptor_Positive_Basic_2D - ulong2",
"Unit_ChannelDescriptor_Positive_Basic_2D - long2",
"Unit_ChannelDescriptor_Positive_Basic_3D - ulong3",
"Unit_ChannelDescriptor_Positive_Basic_3D - long3",
"Unit_ChannelDescriptor_Positive_Basic_4D - ulong4",
"Unit_ChannelDescriptor_Positive_Basic_4D - long4"
]
}
+13 -1
Просмотреть файл
@@ -4,6 +4,18 @@
"Unit_hipFuncSetCacheConfig_Negative_Not_Supported",
"Unit_hipFuncSetSharedMemConfig_Negative_Not_Supported",
"Unit_hipFuncSetAttribute_Positive_MaxDynamicSharedMemorySize_Not_Supported",
"Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout_Not_Supported"
"Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout_Not_Supported",
"=== Below test fails in external CI for PR https://github.com/ROCm-Developer-Tools/hip-tests/pull/215 ===",
"Unit_ChannelDescriptor_Positive_Basic_1D - long",
"Unit_ChannelDescriptor_Positive_Basic_1D - unsigned long",
"Unit_ChannelDescriptor_Positive_Basic_1D - ulong1",
"Unit_ChannelDescriptor_Positive_Basic_1D - signed long",
"Unit_ChannelDescriptor_Positive_Basic_1D - long1",
"Unit_ChannelDescriptor_Positive_Basic_2D - ulong2",
"Unit_ChannelDescriptor_Positive_Basic_2D - long2",
"Unit_ChannelDescriptor_Positive_Basic_3D - ulong3",
"Unit_ChannelDescriptor_Positive_Basic_3D - long3",
"Unit_ChannelDescriptor_Positive_Basic_4D - ulong4",
"Unit_ChannelDescriptor_Positive_Basic_4D - long4"
]
}
+7
Просмотреть файл
@@ -72,6 +72,13 @@ THE SOFTWARE.
* @}
*/
/**
* @defgroup DeviceLanguageTest Device Language
* @{
* This section describes tests for the Device Language API.
* @}
*/
/**
* @defgroup ExecutionTest Execution Control
* @{
+2 -1
Просмотреть файл
@@ -39,6 +39,8 @@ add_subdirectory(context)
add_subdirectory(dynamicLoading)
add_subdirectory(g++)
add_subdirectory(module)
add_subdirectory(channelDescriptor)
add_subdirectory(executionControl)
if(HIP_PLATFORM STREQUAL "amd")
add_subdirectory(callback)
@@ -46,4 +48,3 @@ add_subdirectory(callback)
# Vulkan interop APIs currently undefined for Nvidia
add_subdirectory(vulkan_interop)
endif()
add_subdirectory(executionControl)
+27
Просмотреть файл
@@ -0,0 +1,27 @@
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
set(TEST_SRC
channel_descriptor.cc
)
hip_add_exe_to_target(NAME ChannelDescriptorTest
TEST_SRC ${TEST_SRC}
TEST_TARGET_NAME build_tests)
+194
Просмотреть файл
@@ -0,0 +1,194 @@
/*
Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "channel_descriptor_common.hh"
/**
* @addtogroup hipCreateChannelDesc hipCreateChannelDesc
* @{
* @ingroup DeviceLanguageTest
* `hipCreateChannelDesc<T>()` -
* Creates a dedicated channel descriptor based on passed built-in or vector type T.
*/
/**
* Test Description
* ------------------------
* - Validates that 1D channel descriptor is created as expected.
* - Compares channel descriptor with the manually created one.
* - Takes into consideration following 1D built-in and vector types:
* -# char (signed and unsigned)
* -# short (signed and unsigned)
* -# int (signed and unsigned)
* -# float
* -# long (signed and unsigned)
* Test source
* ------------------------
* - unit/channelDescriptor/channel_descriptor.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEMPLATE_TEST_CASE("Unit_ChannelDescriptor_Positive_Basic_1D", "", char, unsigned char, uchar1,
signed char, char1, unsigned short, ushort1, short, signed short, short1, int,
unsigned int, uint1, signed int, int1, float, float1, long, unsigned long,
ulong1, signed long, long1) {
ChannelDescriptorTest1D<TestType> channel_desc_test;
channel_desc_test.Run();
}
/**
* Test Description
* ------------------------
* - Validates that 2D channel descriptor is created as expected.
* - Compares channel descriptor with the manually created one.
* - Takes into consideration following 2D built-in and vector types:
* -# char (signed and unsigned)
* -# short (signed and unsigned)
* -# int (signed and unsigned)
* -# float
* -# long (signed and unsigned)
* Test source
* ------------------------
* - unit/channelDescriptor/channel_descriptor.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEMPLATE_TEST_CASE("Unit_ChannelDescriptor_Positive_Basic_2D", "", uchar2, char2, ushort2, short2,
uint2, int2, float2, ulong2, long2) {
ChannelDescriptorTest2D<TestType> channel_desc_test;
channel_desc_test.Run();
}
#ifndef __GNUC__
/**
* Test Description
* ------------------------
* - Validates that 3D channel descriptor is created as expected.
* - Compares channel descriptor with the manually created one.
* - Takes into consideration following 3D built-in and vector types:
* -# char (signed and unsigned)
* -# short (signed and unsigned)
* -# int (signed and unsigned)
* -# float
* -# long (signed and unsigned)
* Test source
* ------------------------
* - unit/channelDescriptor/channel_descriptor.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
* - Available for non-GNUC compilers.
*/
TEMPLATE_TEST_CASE("Unit_ChannelDescriptor_Positive_Basic_3D", "", uchar3, char3, ushort3, short3,
uint3, int3, float3, ulong3, long3) {
ChannelDescriptorTest3D<TestType> channel_desc_test;
channel_desc_test.Run();
}
#endif
/**
* Test Description
* ------------------------
* - Validates that 4D channel descriptor is created as expected.
* - Compares channel descriptor with the manually created one.
* - Takes into consideration following 4D built-in and vector types:
* -# char (signed and unsigned)
* -# short (signed and unsigned)
* -# int (signed and unsigned)
* -# float
* -# long (signed and unsigned)
* Test source
* ------------------------
* - unit/channelDescriptor/channel_descriptor.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEMPLATE_TEST_CASE("Unit_ChannelDescriptor_Positive_Basic_4D", "", uchar4, char4, ushort4, short4,
uint4, int4, float4, ulong4, long4) {
ChannelDescriptorTest4D<TestType> channel_desc_test;
channel_desc_test.Run();
}
/**
* Test Description
* ------------------------
* - Validates that an empty channel descriptor is created as expected.
* - Compares channel descriptor with the manually created one.
* - Takes into consideration all dimensions of the following built-in and vector types:
* -# long long (signed and unsigned)
* -# double
* Test source
* ------------------------
* - unit/channelDescriptor/channel_descriptor.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEMPLATE_TEST_CASE("Unit_ChannelDescriptor_Positive_FormatNone", "", long long, signed long long,
unsigned long long, longlong1, longlong2, longlong3, longlong4, ulonglong1,
ulonglong2, ulonglong3, ulonglong4, double1, double2, double3, double4) {
ChannelDescriptorTestNone<TestType> channel_desc_test;
channel_desc_test.Run();
}
#if HT_AMD
/**
* Test Description
* ------------------------
* - Validates that the channel descriptor is created as expected.
* - Compares channel descriptor with the manually created one.
* - Takes into consideration 16-bit floating-point type.
* -# Creates 1D channel descriptor.
* -# Creates 2D channel descriptor.
* Test source
* ------------------------
* - unit/channelDescriptor/channel_descriptor.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_ChannelDescriptor_Positive_16BitFloatingPoint") {
int size = static_cast<int>(sizeof(unsigned short) * 8);
hipChannelFormatKind kind = hipChannelFormatKindFloat;
hipChannelFormatDesc channel_desc{};
hipChannelFormatDesc referent_channel_desc{};
SECTION("hipCreateChannelDescHalf") {
referent_channel_desc = {size, 0, 0, 0, kind};
channel_desc = hipCreateChannelDescHalf();
}
SECTION("hipCreateChannelDescHalf1") {
referent_channel_desc = {size, 0, 0, 0, kind};
channel_desc = hipCreateChannelDescHalf1();
}
SECTION("hipCreateChannelDescHalf2") {
referent_channel_desc = {size, size, 0, 0, kind};
channel_desc = hipCreateChannelDescHalf2();
}
REQUIRE(channel_desc.x == referent_channel_desc.x);
REQUIRE(channel_desc.y == referent_channel_desc.y);
REQUIRE(channel_desc.z == referent_channel_desc.z);
REQUIRE(channel_desc.w == referent_channel_desc.w);
REQUIRE(channel_desc.f == referent_channel_desc.f);
}
#endif
+221
Просмотреть файл
@@ -0,0 +1,221 @@
/*
Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <hip_test_common.hh>
enum class ChannelDimension { OneDim, TwoDim, ThreeDim, FourDim };
template <typename T> class ChannelDescriptorTestShell {
protected:
int size;
hipChannelFormatKind kind;
ChannelDimension dimension;
virtual void SetSizeAndKind() = 0;
public:
void Run() {
hipChannelFormatDesc channel_desc{};
SetSizeAndKind();
hipChannelFormatDesc referent_channel_desc{0, 0, 0, 0, kind};
switch (dimension) {
case ChannelDimension::FourDim:
referent_channel_desc.w = size;
case ChannelDimension::ThreeDim:
referent_channel_desc.z = size;
case ChannelDimension::TwoDim:
referent_channel_desc.y = size;
default:
referent_channel_desc.x = size;
}
channel_desc = hipCreateChannelDesc<T>();
REQUIRE(channel_desc.x == referent_channel_desc.x);
REQUIRE(channel_desc.y == referent_channel_desc.y);
REQUIRE(channel_desc.z == referent_channel_desc.z);
REQUIRE(channel_desc.w == referent_channel_desc.w);
REQUIRE(channel_desc.f == referent_channel_desc.f);
}
ChannelDescriptorTestShell(const ChannelDimension dimension)
: size(0), kind(hipChannelFormatKindNone), dimension(dimension) {}
ChannelDescriptorTestShell(const ChannelDescriptorTestShell&) = delete;
ChannelDescriptorTestShell(ChannelDescriptorTestShell&&) = delete;
};
template <typename T> class ChannelDescriptorTest1D : public ChannelDescriptorTestShell<T> {
public:
ChannelDescriptorTest1D() : ChannelDescriptorTestShell<T>(ChannelDimension::OneDim) {}
protected:
void SetSizeAndKind() {
if (std::is_same_v<char, T>) {
this->size = static_cast<int>(sizeof(char) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<unsigned char, T> || std::is_same_v<uchar1, T>) {
this->size = static_cast<int>(sizeof(unsigned char) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<signed char, T> || std::is_same_v<char1, T>) {
this->size = static_cast<int>(sizeof(signed char) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<unsigned short, T> || std::is_same_v<ushort1, T>) {
this->size = static_cast<int>(sizeof(unsigned short) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<short, T> || std::is_same_v<signed short, T> ||
std::is_same_v<short1, T>) {
this->size = static_cast<int>(sizeof(signed short) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<unsigned int, T> || std::is_same_v<uint1, T>) {
this->size = static_cast<int>(sizeof(unsigned int) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<int, T> || std::is_same_v<signed int, T> || std::is_same_v<int1, T>) {
this->size = static_cast<int>(sizeof(signed int) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<float, T> || std::is_same_v<float1, T>) {
this->size = static_cast<int>(sizeof(float) * 8);
this->kind = hipChannelFormatKindFloat;
} else if (std::is_same_v<unsigned long, T> || std::is_same_v<ulong1, T>) {
this->size = static_cast<int>(sizeof(unsigned long) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<long, T> || std::is_same_v<signed long, T> ||
std::is_same_v<long1, T>) {
this->size = static_cast<int>(sizeof(signed long) * 8);
this->kind = hipChannelFormatKindSigned;
}
}
};
template <typename T> class ChannelDescriptorTest2D : public ChannelDescriptorTestShell<T> {
public:
ChannelDescriptorTest2D() : ChannelDescriptorTestShell<T>(ChannelDimension::TwoDim) {}
protected:
void SetSizeAndKind() {
if (std::is_same_v<uchar2, T>) {
this->size = static_cast<int>(sizeof(unsigned char) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<char2, T>) {
this->size = static_cast<int>(sizeof(signed char) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<ushort2, T>) {
this->size = static_cast<int>(sizeof(unsigned short) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<short2, T>) {
this->size = static_cast<int>(sizeof(signed short) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<uint2, T>) {
this->size = static_cast<int>(sizeof(unsigned int) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<int2, T>) {
this->size = static_cast<int>(sizeof(signed int) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<float2, T>) {
this->size = static_cast<int>(sizeof(float) * 8);
this->kind = hipChannelFormatKindFloat;
} else if (std::is_same_v<ulong2, T>) {
this->size = static_cast<int>(sizeof(unsigned long) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<long2, T>) {
this->size = static_cast<int>(sizeof(signed long) * 8);
this->kind = hipChannelFormatKindSigned;
}
}
};
#ifndef __GNUC__
template <typename T> class ChannelDescriptorTest3D : public ChannelDescriptorTestShell<T> {
public:
ChannelDescriptorTest3D() : ChannelDescriptorTestShell<T>(ChannelDimension::ThreeDim) {}
protected:
void SetSizeAndKind() {
if (std::is_same_v<uchar3, T>) {
this->size = static_cast<int>(sizeof(unsigned char) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<char3, T>) {
this->size = static_cast<int>(sizeof(signed char) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<ushort3, T>) {
this->size = static_cast<int>(sizeof(unsigned short) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<short3, T>) {
this->size = static_cast<int>(sizeof(signed short) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<uint3, T>) {
this->size = static_cast<int>(sizeof(unsigned int) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<int3, T>) {
this->size = static_cast<int>(sizeof(signed int) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<float3, T>) {
this->size = static_cast<int>(sizeof(float) * 8);
this->kind = hipChannelFormatKindFloat;
} else if (std::is_same_v<ulong3, T>) {
this->size = static_cast<int>(sizeof(unsigned long) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<long3, T>) {
this->size = static_cast<int>(sizeof(signed long) * 8);
this->kind = hipChannelFormatKindSigned;
}
}
};
#endif
template <typename T> class ChannelDescriptorTest4D : public ChannelDescriptorTestShell<T> {
public:
ChannelDescriptorTest4D() : ChannelDescriptorTestShell<T>(ChannelDimension::FourDim) {}
protected:
void SetSizeAndKind() {
if (std::is_same_v<uchar4, T>) {
this->size = static_cast<int>(sizeof(unsigned char) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<char4, T>) {
this->size = static_cast<int>(sizeof(signed char) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<ushort4, T>) {
this->size = static_cast<int>(sizeof(unsigned short) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<short4, T>) {
this->size = static_cast<int>(sizeof(signed short) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<uint4, T>) {
this->size = static_cast<int>(sizeof(unsigned int) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<int4, T>) {
this->size = static_cast<int>(sizeof(signed int) * 8);
this->kind = hipChannelFormatKindSigned;
} else if (std::is_same_v<float4, T>) {
this->size = static_cast<int>(sizeof(float) * 8);
this->kind = hipChannelFormatKindFloat;
} else if (std::is_same_v<ulong4, T>) {
this->size = static_cast<int>(sizeof(unsigned long) * 8);
this->kind = hipChannelFormatKindUnsigned;
} else if (std::is_same_v<long4, T>) {
this->size = static_cast<int>(sizeof(signed long) * 8);
this->kind = hipChannelFormatKindSigned;
}
}
};
template <typename T> class ChannelDescriptorTestNone : public ChannelDescriptorTestShell<T> {
public:
ChannelDescriptorTestNone() : ChannelDescriptorTestShell<T>(ChannelDimension::OneDim) {}
protected:
void SetSizeAndKind() {}
};