mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 08:37:12 +08:00
Prepare mechanism for returning GPU execution error on OCL API
translate task count value to OCL error Related-To: NEO-7412 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ab6af4247e
commit
1c3d5c3892
@@ -60,6 +60,18 @@ CommandQueue *CommandQueue::create(Context *context,
|
||||
return funcCreate(context, device, properties, internalUsage);
|
||||
}
|
||||
|
||||
cl_int CommandQueue::getErrorCodeFromTaskCount(uint32_t taskCount) {
|
||||
switch (taskCount) {
|
||||
case CompletionStamp::gpuHang:
|
||||
case CompletionStamp::outOfDeviceMemory:
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
case CompletionStamp::outOfHostMemory:
|
||||
return CL_OUT_OF_HOST_MEMORY;
|
||||
default:
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_properties *properties, bool internalUsage)
|
||||
: context(context), device(device), isInternalUsage(internalUsage) {
|
||||
if (context) {
|
||||
|
||||
@@ -58,6 +58,8 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
bool internalUsage,
|
||||
cl_int &errcodeRet);
|
||||
|
||||
static cl_int getErrorCodeFromTaskCount(uint32_t taskCount);
|
||||
|
||||
CommandQueue() = delete;
|
||||
|
||||
CommandQueue(Context *context, ClDevice *device, const cl_queue_properties *properties, bool internalUsage);
|
||||
|
||||
@@ -335,8 +335,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
|
||||
this->latestSentEnqueueType = enqueueProperties.operation;
|
||||
}
|
||||
|
||||
if (completionStamp.taskCount == CompletionStamp::gpuHang) {
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
if (completionStamp.taskCount > CompletionStamp::notReady) {
|
||||
return CommandQueue::getErrorCodeFromTaskCount(completionStamp.taskCount);
|
||||
}
|
||||
|
||||
updateFromCompletionStamp(completionStamp, eventBuilder.getEvent());
|
||||
@@ -825,14 +825,14 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
if (enqueueProperties.blitPropertiesContainer->size() > 0) {
|
||||
auto bcsCsr = getBcsForAuxTranslation();
|
||||
const auto newTaskCount = bcsCsr->flushBcsTask(*enqueueProperties.blitPropertiesContainer, false, this->isProfilingEnabled(), getDevice());
|
||||
if (!newTaskCount) {
|
||||
if (newTaskCount > CompletionStamp::notReady) {
|
||||
CompletionStamp completionStamp{};
|
||||
completionStamp.taskCount = CompletionStamp::gpuHang;
|
||||
completionStamp.taskCount = newTaskCount;
|
||||
|
||||
return completionStamp;
|
||||
}
|
||||
|
||||
this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), *newTaskCount);
|
||||
this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), newTaskCount);
|
||||
dispatchFlags.implicitFlush = true;
|
||||
}
|
||||
|
||||
@@ -1063,14 +1063,14 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueCommandWithoutKernel(
|
||||
if (enqueueProperties.operation == EnqueueProperties::Operation::Blit) {
|
||||
UNRECOVERABLE_IF(!enqueueProperties.blitPropertiesContainer);
|
||||
const auto newTaskCount = bcsCsr->flushBcsTask(*enqueueProperties.blitPropertiesContainer, false, this->isProfilingEnabled(), getDevice());
|
||||
if (!newTaskCount) {
|
||||
if (newTaskCount > CompletionStamp::notReady) {
|
||||
CompletionStamp completionStamp{};
|
||||
completionStamp.taskCount = CompletionStamp::gpuHang;
|
||||
completionStamp.taskCount = newTaskCount;
|
||||
|
||||
return completionStamp;
|
||||
}
|
||||
|
||||
this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), *newTaskCount);
|
||||
this->updateBcsTaskCount(bcsCsr->getOsContext().getEngineType(), newTaskCount);
|
||||
}
|
||||
|
||||
return completionStamp;
|
||||
@@ -1276,8 +1276,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueBlit(const MultiDispatchInfo &multiDisp
|
||||
completionStamp = enqueueCommandWithoutKernel(nullptr, 0, gpgpuCommandStream, gpgpuCommandStreamStart, blocking,
|
||||
enqueueProperties, timestampPacketDependencies, eventsRequest,
|
||||
eventBuilder, taskLevel, csrDeps, &bcsCsr);
|
||||
if (completionStamp.taskCount == CompletionStamp::gpuHang) {
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
if (completionStamp.taskCount > CompletionStamp::notReady) {
|
||||
return CommandQueue::getErrorCodeFromTaskCount(completionStamp.taskCount);
|
||||
}
|
||||
|
||||
if (gpgpuSubmission) {
|
||||
|
||||
Reference in New Issue
Block a user