SWDEV-323848 - Fix for p2p failed tests (#2537)
Added peer check for the p2p related testcases Change-Id: I9131b284baf33bef18eceaa7ed462d733f91be92
This commit is contained in:
committed by
GitHub
parent
b73f77a75a
commit
d2a764dd1c
@@ -481,58 +481,64 @@ template <typename T>
|
||||
void Memcpy3DAsync<T>::D2D_SameDeviceMem_StreamDiffDevice() {
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
// Allocating the Memory
|
||||
AllocateMemory();
|
||||
HIP_CHECK(hipSetDevice(1));
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
int peerAccess = 0;
|
||||
HIP_CHECK(hipDeviceCanAccessPeer(&peerAccess, 0, 1));
|
||||
if (peerAccess) {
|
||||
AllocateMemory();
|
||||
HIP_CHECK(hipSetDevice(1));
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
|
||||
// Host to Device
|
||||
myparms.srcPtr = make_hipPitchedPtr(hData, width * sizeof(T), width, height);
|
||||
myparms.dstArray = arr;
|
||||
// Host to Device
|
||||
myparms.srcPtr = make_hipPitchedPtr(hData, width * sizeof(T), width, height);
|
||||
myparms.dstArray = arr;
|
||||
#ifdef __HIP_PLATFORM_NVCC__
|
||||
myparms.kind = cudaMemcpyHostToDevice;
|
||||
myparms.kind = cudaMemcpyHostToDevice;
|
||||
#else
|
||||
myparms.kind = hipMemcpyHostToDevice;
|
||||
myparms.kind = hipMemcpyHostToDevice;
|
||||
#endif
|
||||
REQUIRE(hipMemcpy3DAsync(&myparms, stream) == hipSuccess);
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
REQUIRE(hipMemcpy3DAsync(&myparms, stream) == hipSuccess);
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
|
||||
// Array to Array
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
myparms.srcArray = arr;
|
||||
myparms.dstArray = arr1;
|
||||
// Array to Array
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
myparms.srcArray = arr;
|
||||
myparms.dstArray = arr1;
|
||||
#ifdef __HIP_PLATFORM_NVCC__
|
||||
myparms.kind = cudaMemcpyDeviceToDevice;
|
||||
myparms.kind = cudaMemcpyDeviceToDevice;
|
||||
#else
|
||||
myparms.kind = hipMemcpyDeviceToDevice;
|
||||
myparms.kind = hipMemcpyDeviceToDevice;
|
||||
#endif
|
||||
REQUIRE(hipMemcpy3DAsync(&myparms, stream) == hipSuccess);
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
T *hOutputData = reinterpret_cast<T*>(malloc(size));
|
||||
memset(hOutputData, 0, size);
|
||||
REQUIRE(hipMemcpy3DAsync(&myparms, stream) == hipSuccess);
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
T *hOutputData = reinterpret_cast<T*>(malloc(size));
|
||||
memset(hOutputData, 0, size);
|
||||
|
||||
// Device to host
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
myparms.dstPtr = make_hipPitchedPtr(hOutputData,
|
||||
width * sizeof(T), width, height);
|
||||
myparms.srcArray = arr1;
|
||||
// Device to host
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
myparms.dstPtr = make_hipPitchedPtr(hOutputData,
|
||||
width * sizeof(T), width, height);
|
||||
myparms.srcArray = arr1;
|
||||
#ifdef __HIP_PLATFORM_NVCC__
|
||||
myparms.kind = cudaMemcpyDeviceToHost;
|
||||
myparms.kind = cudaMemcpyDeviceToHost;
|
||||
#else
|
||||
myparms.kind = hipMemcpyDeviceToHost;
|
||||
myparms.kind = hipMemcpyDeviceToHost;
|
||||
#endif
|
||||
REQUIRE(hipMemcpy3DAsync(&myparms, stream) == hipSuccess);
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
REQUIRE(hipMemcpy3DAsync(&myparms, stream) == hipSuccess);
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
|
||||
// Validating the result
|
||||
HipTest::checkArray(hData, hOutputData, width, height, depth);
|
||||
// Validating the result
|
||||
HipTest::checkArray(hData, hOutputData, width, height, depth);
|
||||
|
||||
// Deallocating the memory
|
||||
free(hOutputData);
|
||||
DeAllocateMemory();
|
||||
// Deallocating the memory
|
||||
free(hOutputData);
|
||||
DeAllocateMemory();
|
||||
} else {
|
||||
SUCCEED("Skipped the test as there is no peer access");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -630,7 +636,7 @@ void Memcpy3DAsync<T>::simple_Memcpy3DAsync() {
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
SetDefaultData();
|
||||
myparms.dstPtr = make_hipPitchedPtr(hOutputData,
|
||||
width * sizeof(T), width, height);
|
||||
width * sizeof(T), width, height);
|
||||
myparms.srcArray = arr1;
|
||||
#ifdef __HIP_PLATFORM_NVCC__
|
||||
myparms.kind = cudaMemcpyDeviceToHost;
|
||||
|
||||
Reference in New Issue
Block a user