SWDEV-294591 - Fix hipEventIpc failure on NV

make hipIpcOpenEventHandle has the same behavour of cudaIpcOpenEventHandle.

Change-Id: I3fe6dbc35a7b14ba9119df297b7885df83d28149


[ROCm/clr commit: c87a352288]
이 커밋은 다음에 포함됨:
Tao Sang 작성하고 Tao Sang가 2021-07-28 20:34:11 -04:00를 커밋함
1 부모 9b27759df1
커밋 eac431380a
2 파일이 변경됨
+11

검색과 일치하는 파일 없음

+10
파일 보기
@@ -21,6 +21,9 @@
#include <hip/hip_runtime.h>
#include "hip_event.hpp"
#if !defined(_MSC_VER)
#include <unistd.h>
#endif
void ipcEventCallback(hipStream_t stream, hipError_t status, void* user_data)
{
@@ -413,6 +416,8 @@ hipError_t hipIpcGetEventHandle(hipIpcEventHandle_t* handle, hipEvent_t event) {
if (!createIpcEventShmemIfNeeded(e->ipc_evt_)) {
HIP_RETURN(hipErrorInvalidConfiguration);
}
e->ipc_evt_.ipc_shmem_->owners_device_id = e->deviceId();
e->ipc_evt_.ipc_shmem_->owners_process_id = getpid();
ihipIpcEventHandle_t* iHandle = reinterpret_cast<ihipIpcEventHandle_t*>(handle);
memset(iHandle->shmem_name, 0, HIP_IPC_HANDLE_SIZE);
e->ipc_evt_.ipc_name_.copy(iHandle->shmem_name, std::string::npos);
@@ -443,6 +448,11 @@ hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle)
HIP_RETURN(hipErrorInvalidValue);
}
if (getpid() == ipc_evt.ipc_shmem_->owners_process_id.load()) {
// If this is in the same process, return error.
HIP_RETURN(hipErrorInvalidContext);
}
ipc_evt.ipc_shmem_->owners += 1;
e->setDeviceId(ipc_evt.ipc_shmem_->owners_device_id.load());
+1
파일 보기
@@ -58,6 +58,7 @@ public:
typedef struct ihipIpcEventShmem_s {
std::atomic<int> owners;
std::atomic<int> owners_device_id;
std::atomic<int> owners_process_id;
std::atomic<int> read_index;
std::atomic<int> write_index;
std::atomic<int> signal[IPC_SIGNALS_PER_EVENT];