SWDEV-461794 Fix Unit_hipMemcpyAsync_Positive_Synchronization_Behavior

- Fixed wrong assumptions in the test:
   - Pinned Host memory to Pinned Host memory is async (before:sync)
   - Pinned Host memory to Device is async (before:sync)

Change-Id: Ib826e177854cbcdad04181e245382cf0bec02c46


[ROCm/hip-tests commit: 12a5d4c24c]
This commit is contained in:
Marko Arandjelovic
2024-05-14 16:48:57 +02:00
committed by Rakesh Roy
orang tua fb7d2b3d06
melakukan 5153e57122
5 mengubah file dengan 43 tambahan dan 16 penghapusan
@@ -38,9 +38,14 @@ TEST_CASE("Unit_hipMemcpyAsync_Positive_Synchronization_Behavior") {
using namespace std::placeholders;
HIP_CHECK(hipDeviceSynchronize());
SECTION("Host memory to device memory") {
MemcpyHtoDSyncBehavior(std::bind(hipMemcpyAsync, _1, _2, _3, hipMemcpyHostToDevice, nullptr),
true);
SECTION("Host pageable memory to device memory") {
MemcpyHPageabletoDSyncBehavior(
std::bind(hipMemcpyAsync, _1, _2, _3, hipMemcpyHostToDevice, nullptr), true);
}
SECTION("Host pinned memory to device memory") {
MemcpyHPinnedtoDSyncBehavior(
std::bind(hipMemcpyAsync, _1, _2, _3, hipMemcpyHostToDevice, nullptr), false);
}
SECTION("Device memory to pageable host memory") {
@@ -66,6 +71,9 @@ TEST_CASE("Unit_hipMemcpyAsync_Positive_Synchronization_Behavior") {
SECTION("Host memory to host memory") {
MemcpyHtoHSyncBehavior(std::bind(hipMemcpyAsync, _1, _2, _3, hipMemcpyHostToHost, nullptr),
true);
MemcpyHPinnedtoHPinnedSyncBehavior(
std::bind(hipMemcpyAsync, _1, _2, _3, hipMemcpyHostToHost, nullptr), false);
}
}
@@ -98,7 +98,7 @@ TEST_CASE("Unit_hipMemcpyHtoDAsync_Positive_Synchronization_Behavior") {
"Nvidia");
return;
#endif
MemcpyHtoDSyncBehavior(
MemcpyHPinnedtoDSyncBehavior(
[](void* dst, void* src, size_t count) {
return hipMemcpyHtoDAsync(reinterpret_cast<hipDeviceptr_t>(dst), src, count, nullptr);
},
@@ -38,7 +38,7 @@ TEST_CASE("Unit_hipMemcpy_Positive_Synchronization_Behavior") {
// For transfers from pinned host memory to device memory, the function is synchronous with
// respect to the host
SECTION("Host memory to device memory") {
MemcpyHtoDSyncBehavior(std::bind(hipMemcpy, _1, _2, _3, hipMemcpyHostToDevice), true);
MemcpyHPageabletoDSyncBehavior(std::bind(hipMemcpy, _1, _2, _3, hipMemcpyHostToDevice), true);
}
// For transfers from device to either pageable or pinned host memory, the function returns only
@@ -65,6 +65,8 @@ TEST_CASE("Unit_hipMemcpy_Positive_Synchronization_Behavior") {
// respect to the host
SECTION("Host memory to host memory") {
MemcpyHtoHSyncBehavior(std::bind(hipMemcpy, _1, _2, _3, hipMemcpyHostToHost), true);
MemcpyHPinnedtoHPinnedSyncBehavior(
std::bind(hipMemcpyAsync, _1, _2, _3, hipMemcpyHostToHost, nullptr), true);
}
}
@@ -60,7 +60,7 @@ TEST_CASE("Unit_hipMemcpyHtoD_Positive_Basic") {
}
TEST_CASE("Unit_hipMemcpyHtoD_Positive_Synchronization_Behavior") {
MemcpyHtoDSyncBehavior(
MemcpyHPageabletoDSyncBehavior(
[](void* dst, void* src, size_t count) {
return hipMemcpyHtoD(reinterpret_cast<hipDeviceptr_t>(dst), src, count);
},
@@ -116,4 +116,4 @@ TEST_CASE("Unit_hipMemcpyDtoD_Negative_Parameters") {
reinterpret_cast<hipDeviceptr_t>(src), count);
},
dst_alloc.ptr(), src_alloc.ptr(), kPageSize);
}
}