SWDEV-332522 - ipcEvents Avoid deadlock b/w streamWait & Event

Using device write to set 0 to signal while streamWaitEvent is checking
the signal.
Use app in SWDEV-314307 to verify this fix
Requires vdi #668012 change to work

Change-Id: Ie329a29cfaeb5d144b92cda36773646f913ca73d
Этот коммит содержится в:
Ajay
2022-04-20 16:53:22 +00:00
коммит произвёл Ajay GunaShekar
родитель f1fb612774
Коммит 1abd0d6ecf
4 изменённых файлов: 48 добавлений и 30 удалений
+18 -10
Просмотреть файл
@@ -997,11 +997,9 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) {
HIP_RETURN(hipSuccess);
}
hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) {
HIP_INIT_API(hipHostRegister, hostPtr, sizeBytes, flags);
CHECK_STREAM_CAPTURE_SUPPORTED();
hipError_t ihipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) {
if (hostPtr == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
return hipErrorInvalidValue;
} else {
amd::Memory* mem = new (*hip::host_device->asContext()) amd::Buffer(*hip::host_device->asContext(),
CL_MEM_USE_HOST_PTR | CL_MEM_SVM_ATOMICS, sizeBytes);
@@ -1012,7 +1010,7 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags)
if (!mem->create(hostPtr, sysMemAlloc, skipAlloc, forceAlloc)) {
mem->release();
LogPrintfError("Cannot create memory for size: %u with flags: %d \n", sizeBytes, flags);
HIP_RETURN(hipErrorOutOfMemory);
return hipErrorOutOfMemory;
}
for (const auto& device : g_devices) {
@@ -1029,14 +1027,17 @@ hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags)
if (mem != nullptr) {
mem->getUserData().deviceId = hip::getCurrentDevice()->deviceId();
}
HIP_RETURN(hipSuccess);
return hipSuccess;
}
}
hipError_t hipHostUnregister(void* hostPtr) {
HIP_INIT_API(hipHostUnregister, hostPtr);
hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) {
HIP_INIT_API(hipHostRegister, hostPtr, sizeBytes, flags);
CHECK_STREAM_CAPTURE_SUPPORTED();
HIP_RETURN(ihipHostRegister(hostPtr, sizeBytes,flags));
}
hipError_t ihipHostUnregister(void* hostPtr) {
size_t offset = 0;
amd::Memory* mem = getMemoryObject(hostPtr, offset);
@@ -1056,11 +1057,18 @@ hipError_t hipHostUnregister(void* hostPtr) {
}
amd::MemObjMap::RemoveMemObj(hostPtr);
mem->release();
HIP_RETURN(hipSuccess);
return hipSuccess;
}
LogPrintfError("Cannot unregister host_ptr: 0x%x \n", hostPtr);
HIP_RETURN(hipErrorHostMemoryNotRegistered);
return hipErrorHostMemoryNotRegistered;
}
hipError_t hipHostUnregister(void* hostPtr) {
HIP_INIT_API(hipHostUnregister, hostPtr);
CHECK_STREAM_CAPTURE_SUPPORTED();
HIP_RETURN(ihipHostUnregister(hostPtr));
}
// Deprecated function: