SWDEV-428198 - Improve vector operator test

Add back hipVectorTypesDeviceTest.cc
Rename hipVectorTypes.cc as hipVectorTypesHost.cc
Fix some bugs in compiling.
Related to SWDEV-426270 as well.

Change-Id: I95af838136b114d776423442253e8c742a8d69e5
Este commit está contenido en:
Tao Sang
2023-11-01 16:12:33 -04:00
cometido por Rakesh Roy
padre 5d4c30ff25
commit d26d5cf992
Se han modificado 3 ficheros con 10 adiciones y 13 borrados
+2 -1
Ver fichero
@@ -78,7 +78,8 @@ set(AMD_TEST_SRC
hipMathFunctions.cc
hmax_hmin.cc
hipBfloat16.cc
hipVectorTypes.cc
hipVectorTypesHost.cc
hipVectorTypesDevice.cc
hipTestHalf.cc
hipComplex.cc
hipTestFMA.cc
@@ -30,12 +30,12 @@ using namespace std;
template <class T> __device__ typename std::add_rvalue_reference<T>::type _declval() noexcept;
template <typename V, Enable_if_t<!is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
template <typename V, enable_if_t<!is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
__device__ constexpr bool integer_unary_tests(const V&, const V&) {
return true;
}
template <typename V, Enable_if_t<is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
template <typename V, enable_if_t<is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
__device__ bool integer_unary_tests(V& f1, V& f2) {
f1 %= f2;
if (f1 != V{0}) return false;
@@ -57,12 +57,12 @@ __device__ bool integer_unary_tests(V& f1, V& f2) {
return true;
}
template <typename V, Enable_if_t<!is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
template <typename V, enable_if_t<!is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
__device__ constexpr bool integer_binary_tests(const V&, const V&, const V&) {
return true;
}
template <typename V, Enable_if_t<is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
template <typename V, enable_if_t<is_integral<decltype(_declval<V>().x)>{}>* = nullptr>
__device__ bool integer_binary_tests(V& f1, V& f2, V& f3) {
f3 = f1 % f2;
if (f3 != V{0}) return false;
@@ -145,7 +145,7 @@ template <typename V> __device__ bool TestVectorType() {
return true;
}
template <typename... Ts, Enable_if_t<sizeof...(Ts) == 0>* = nullptr>
template <typename... Ts, enable_if_t<sizeof...(Ts) == 0>* = nullptr>
__device__ bool TestVectorTypes() {
return true;
}
@@ -230,7 +230,7 @@ template <typename V> bool run_CheckSharedVectorType() {
return passed;
}
template <typename... Ts, Enable_if_t<sizeof...(Ts) == 0>* = nullptr>
template <typename... Ts, enable_if_t<sizeof...(Ts) == 0>* = nullptr>
bool run_CheckSharedVectorTypes() {
return true;
}
@@ -239,7 +239,7 @@ template <typename V, typename... Vs> bool run_CheckSharedVectorTypes() {
return run_CheckSharedVectorType<V>() && run_CheckSharedVectorTypes<Vs...>();
}
TEST_CASE("Unit_vectorTypes_CompileTest") {
TEST_CASE("Unit_hipVectorTypes_test_on_device") {
static_assert(sizeof(float1) == 4, "");
static_assert(sizeof(float2) >= 8, "");
static_assert(sizeof(float3) >= 12, "");
@@ -267,7 +267,3 @@ TEST_CASE("Unit_vectorTypes_CompileTest") {
HIP_CHECK(hipFree(ptr));
REQUIRE(passed == true);
}
//Test to check __half2_raw can be initialized without designator
TEST_CASE("Unit_half2_raw_def") {
constexpr __half2_raw inf = {0x7C00,0x7C00};
}
@@ -192,7 +192,7 @@ bool CheckVectorTypes() {
float1, float2, float3, float4,
double1, double2, double3, double4>();
}
TEST_CASE("Unit_TestVectorTypes") {
TEST_CASE("Unit_hipVectorTypes_test_on_host") {
REQUIRE(sizeof(float1) == 4);
REQUIRE(sizeof(float2) >= 8);
REQUIRE(sizeof(float3) == 12);