Retry in loop when exec or bind fails with ENXIO

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2022-09-08 15:53:38 +00:00
committed by Compute-Runtime-Automation
parent 8682b588bd
commit ec13b185a3
4 changed files with 233 additions and 36 deletions

View File

@@ -147,24 +147,26 @@ int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bo
int ret = ioctlHelper->execBuffer(&execbuf, completionGpuAddress, completionValue);
if (ret != 0) {
int err = this->drm->getErrno();
if (err == EOPNOTSUPP) {
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err));
return err;
}
do {
int err = this->drm->getErrno();
if (err == EOPNOTSUPP) {
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err));
return err;
}
evictUnusedAllocations(false, true);
ret = ioctlHelper->execBuffer(&execbuf, completionGpuAddress, completionValue);
}
evictUnusedAllocations(false, true);
ret = ioctlHelper->execBuffer(&execbuf, completionGpuAddress, completionValue);
if (ret != 0) {
const auto status = evictUnusedAllocations(true, true);
if (status == MemoryOperationsStatus::GPU_HANG_DETECTED_DURING_OPERATION) {
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "Error! GPU hang detected in BufferObject::exec(). Returning %d\n", gpuHangDetected);
return gpuHangDetected;
}
if (ret != 0) {
const auto status = evictUnusedAllocations(true, true);
if (status == MemoryOperationsStatus::GPU_HANG_DETECTED_DURING_OPERATION) {
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "Error! GPU hang detected in BufferObject::exec(). Returning %d\n", gpuHangDetected);
return gpuHangDetected;
}
ret = ioctlHelper->execBuffer(&execbuf, completionGpuAddress, completionValue);
ret = ioctlHelper->execBuffer(&execbuf, completionGpuAddress, completionValue);
}
} while (ret != 0 && this->drm->getErrno() == ENXIO);
}
if (ret == 0) {