SWDEV-1 - Merge github PRs to amd-staging

Change-Id: I2944a63ddc2eec8dc1403d9790ffffbaec343385
This commit is contained in:
Rakesh Roy
2024-03-04 11:51:34 +05:30
366 changed files with 55399 additions and 2073 deletions
+9 -4
View File
@@ -1,14 +1,19 @@
# Common Tests - Test independent of all platforms
set(TEST_SRC
warp_shfl_xor.cc
warp_shfl.cc
warp_shfl_up.cc
warp_shfl_down.cc
warp_ballot.cc
warp_any.cc
warp_all.cc
)
if(HIP_PLATFORM MATCHES "amd")
set(TEST_SRC ${TEST_SRC}
warp_shfl.cc
warp_shfl_xor.cc
warp_shfl_up.cc
warp_shfl_down.cc
)
endif()
hip_add_exe_to_target(NAME WarpTest
TEST_SRC ${TEST_SRC}
TEST_TARGET_NAME build_tests)
+1
View File
@@ -21,6 +21,7 @@ THE SOFTWARE.
#include <hip_test_common.hh>
#include <hip/hip_cooperative_groups.h>
#include <hip/hip_fp16.h>
static __device__ bool deactivate_thread(const uint64_t* const active_masks) {
const auto warp =
+3 -7
View File
@@ -100,7 +100,7 @@ template <typename T> class WarpShfl : public WarpShflTest<WarpShfl<T>, T> {
* - Device supports warp shuffle
*/
TEMPLATE_TEST_CASE("Unit_Warp_Shfl_Positive_Basic", "", int, unsigned int, long, unsigned long,
long long, unsigned long long, float, double) {
long long, unsigned long long, float, double, __half, __half2) {
int device;
hipDeviceProp_t device_properties;
HIP_CHECK(hipGetDevice(&device));
@@ -111,11 +111,7 @@ TEMPLATE_TEST_CASE("Unit_Warp_Shfl_Positive_Basic", "", int, unsigned int, long,
return;
}
SECTION("Shfl with specified active mask and input values") {
WarpShfl<TestType>().run(false);
}
SECTION("Shfl with specified active mask and input values") { WarpShfl<TestType>().run(false); }
SECTION("Shfl with random active mask and input values") {
WarpShfl<TestType>().run(true);
}
SECTION("Shfl with random active mask and input values") { WarpShfl<TestType>().run(true); }
}
+19
View File
@@ -25,6 +25,15 @@ THE SOFTWARE.
#include <resource_guards.hh>
#include <utils.hh>
static bool operator==(__half x, __half y) {
// __heq doesn't have a __host__ version
return static_cast<__half_raw>(x).x == static_cast<__half_raw>(y).x;
}
static bool operator!=(__half x, __half y) { return static_cast<__half_raw>(x).x != static_cast<__half_raw>(y).x; }
static bool operator==(__half2 x, __half2 y) { return __hbeq2(x, y); }
static bool operator!=(__half2 x, __half2 y) { return !(__hbeq2(x, y)); }
template <typename Derived, typename T> class WarpShflTest {
public:
WarpShflTest() : warp_size_{get_warp_size()} {}
@@ -82,6 +91,16 @@ template <typename Derived, typename T> class WarpShflTest {
return static_cast<T>(
GenerateRandomReal(std::numeric_limits<T>().min(), std::numeric_limits<T>().max()));
});
} else if constexpr (std::is_same_v<__half, T>) {
std::generate_n(input, grid_.thread_count_, [] {
return __float2half(GenerateRandomReal(std::numeric_limits<float>().min(),
std::numeric_limits<float>().max()));
});
} else if constexpr (std::is_same_v<__half2, T>) {
std::generate_n(input, grid_.thread_count_, [] {
return __float2half2_rn(GenerateRandomReal(std::numeric_limits<float>().min(),
std::numeric_limits<float>().max()));
});
} else {
std::generate_n(input, grid_.thread_count_, [] {
return static_cast<T>(GenerateRandomInteger(std::numeric_limits<T>().min(),
+1 -1
View File
@@ -100,7 +100,7 @@ template <typename T> class WarpShflDown : public WarpShflTest<WarpShflDown<T>,
* - Device supports warp shuffle
*/
TEMPLATE_TEST_CASE("Unit_Warp_Shfl_Down_Positive_Basic", "", int, unsigned int, long, unsigned long,
long long, unsigned long long, float, double) {
long long, unsigned long long, float, double, __half, __half2) {
int device;
hipDeviceProp_t device_properties;
HIP_CHECK(hipGetDevice(&device));
+1 -1
View File
@@ -99,7 +99,7 @@ template <typename T> class WarpShflUp : public WarpShflTest<WarpShflUp<T>, T> {
* - Device supports warp shuffle
*/
TEMPLATE_TEST_CASE("Unit_Warp_Shfl_Up_Positive_Basic", "", int, unsigned int, long, unsigned long,
long long, unsigned long long, float, double) {
long long, unsigned long long, float, double, __half, __half2) {
int device;
hipDeviceProp_t device_properties;
HIP_CHECK(hipGetDevice(&device));
+1 -1
View File
@@ -97,7 +97,7 @@ template <typename T> class WarpShflXOR : public WarpShflTest<WarpShflXOR<T>, T>
* - Device supports warp shuffle
*/
TEMPLATE_TEST_CASE("Unit_Warp_Shfl_XOR_Positive_Basic", "", int, unsigned int, long, unsigned long,
long long, unsigned long long, float, double) {
long long, unsigned long long, float, double, __half, __half2) {
int device;
hipDeviceProp_t device_properties;
HIP_CHECK(hipGetDevice(&device));