SWDEV-460387 - Use traditional malloc instead of alloc guard

The LinearGuard does not seem to play well with the catch macros.
The entry to device pointers seem to be lost from memory map.

Change-Id: Ib8549052f18bcc847dea25cf268e2bcb59e24b25
This commit is contained in:
Jatin Chaudhary
2024-07-09 17:45:06 +00:00
committad av Rakesh Roy
förälder 3e0b749b76
incheckning 8ed0c39549
3 ändrade filer med 24 tillägg och 18 borttagningar
-3
Visa fil
@@ -1457,9 +1457,6 @@
"Unit_Warp_Ballot_Positive_Basic",
"Unit_Warp_Vote_Any_Positive_Basic",
"Unit_Warp_Vote_All_Positive_Basic",
"=== Below Tests fail in stress test 06/11/24 ===",
"Unit_hipGraphExecMemcpyNodeSetParams_Negative_Changing_Memcpy_Direction",
"Unit_hipGraphExecMemcpyNodeSetParams1D_Negative_Changing_Memcpy_Direction",
#endif
#if defined gfx1030
"=== SWDEV-445961: These tests hang in PSDB stress test on 09/02/2024 ===",
@@ -229,15 +229,15 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Negative_Parameters") {
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Negative_Changing_Memcpy_Direction") {
LinearAllocGuard<int> host(LinearAllocs::hipHostMalloc, sizeof(int));
LinearAllocGuard<int> dev(LinearAllocs::hipMalloc, sizeof(int));
int *host, *dev;
HIP_CHECK(hipHostMalloc(&host, sizeof(int)));
HIP_CHECK(hipMalloc(&dev, sizeof(int)));
const auto [dir, src, dst] =
GENERATE_REF(std::make_tuple(hipMemcpyHostToHost, host.ptr(), host.ptr()),
std::make_tuple(hipMemcpyHostToDevice, host.ptr(), dev.ptr()),
std::make_tuple(hipMemcpyDeviceToHost, dev.ptr(), host.ptr()),
std::make_tuple(hipMemcpyDeviceToDevice, dev.ptr(), dev.ptr()));
GENERATE_REF(std::make_tuple(hipMemcpyHostToHost, host, host),
std::make_tuple(hipMemcpyHostToDevice, host, dev),
std::make_tuple(hipMemcpyDeviceToHost, dev, host),
std::make_tuple(hipMemcpyDeviceToDevice, dev, dev));
hipGraph_t graph = nullptr;
HIP_CHECK(hipGraphCreate(&graph, 0));
@@ -264,6 +264,8 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams_Negative_Changing_Memcpy_Directi
HIP_CHECK_ERROR(hipGraphExecMemcpyNodeSetParams(graph_exec, node, &params), hipErrorInvalidValue);
HIP_CHECK(hipGraphExecDestroy(graph_exec));
HIP_CHECK(hipGraphDestroy(graph));
HIP_CHECK(hipHostFree(host));
HIP_CHECK(hipFree(dev));
}
/**
@@ -218,16 +218,17 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams1D_Negative_Parameters") {
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams1D_Negative_Changing_Memcpy_Direction") {
LinearAllocGuard<int> host1(LinearAllocs::hipHostMalloc, sizeof(int));
LinearAllocGuard<int> host2(LinearAllocs::hipHostMalloc, sizeof(int));
LinearAllocGuard<int> dev1(LinearAllocs::hipMalloc, sizeof(int));
LinearAllocGuard<int> dev2(LinearAllocs::hipMalloc, sizeof(int));
int *host1, *host2, *dev1, *dev2;
HIP_CHECK(hipHostMalloc(&host1, sizeof(int)));
HIP_CHECK(hipHostMalloc(&host2, sizeof(int)));
HIP_CHECK(hipMalloc(&dev1, sizeof(int)));
HIP_CHECK(hipMalloc(&dev2, sizeof(int)));
const auto [dir, src, dst] =
GENERATE_REF(std::make_tuple(hipMemcpyHostToHost, host1.ptr(), host2.ptr()),
std::make_tuple(hipMemcpyHostToDevice, host1.ptr(), dev1.ptr()),
std::make_tuple(hipMemcpyDeviceToHost, dev1.ptr(), host1.ptr()),
std::make_tuple(hipMemcpyDeviceToDevice, dev1.ptr(), dev2.ptr()));
GENERATE_REF(std::make_tuple(hipMemcpyHostToHost, host1, host2),
std::make_tuple(hipMemcpyHostToDevice, host1, dev1),
std::make_tuple(hipMemcpyDeviceToHost, dev1, host1),
std::make_tuple(hipMemcpyDeviceToDevice, dev1, dev2));
hipGraph_t graph = nullptr;
HIP_CHECK(hipGraphCreate(&graph, 0));
@@ -252,9 +253,15 @@ TEST_CASE("Unit_hipGraphExecMemcpyNodeSetParams1D_Negative_Changing_Memcpy_Direc
HIP_CHECK(hipGraphExecDestroy(graph_exec));
HIP_CHECK(hipGraphDestroy(graph));
HIP_CHECK(hipHostFree(host1));
HIP_CHECK(hipHostFree(host2));
HIP_CHECK(hipFree(dev1));
HIP_CHECK(hipFree(dev2));
}
/**
* End doxygen group GraphTest.
* @}
*/