fix: wrong return value of zeCommandQueueExecuteCommandLists when OOM

zeCommandQueueExecuteCommandLists return ZE_RESULT_ERROR_UNKNOWN when OOM
in some scenario of direct submission.

Related-To: NEO-7840

Signed-off-by: Pan Zhenjie <zhenjie.pan@intel.com>
This commit is contained in:
Zhenjie Pan
2023-03-24 09:01:23 +00:00
committed by Compute-Runtime-Automation
parent d77f2989c7
commit 1ce269a9dd
7 changed files with 68 additions and 18 deletions

View File

@@ -86,6 +86,7 @@ class DirectSubmissionHw {
bool startRingBuffer();
MOCKABLE_VIRTUAL bool dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp);
uint32_t getDispatchErrorCode();
static std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> create(const DirectSubmissionInputParams &inputParams);
@@ -219,6 +220,7 @@ class DirectSubmissionHw {
uint32_t currentRelaxedOrderingQueueSize = 0;
DirectSubmissionSfenceMode sfenceMode = DirectSubmissionSfenceMode::BeforeAndAfterSemaphore;
volatile uint32_t reserved = 0u;
uint32_t dispatchErrorCode = 0;
bool ringStart = false;
bool disableCpuCacheFlush = true;

View File

@@ -1151,4 +1151,9 @@ size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeSystemMemoryFenceAddres
return EncodeMemoryFence<GfxFamily>::getSystemMemoryFenceSize();
}
template <typename GfxFamily, typename Dispatcher>
uint32_t DirectSubmissionHw<GfxFamily, Dispatcher>::getDispatchErrorCode() {
return dispatchErrorCode;
}
} // namespace NEO

View File

@@ -120,7 +120,7 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, siz
auto currentBase = this->ringCommandStream.getGraphicsAllocation()->getGpuAddress();
auto offset = ptrDiff(gpuAddress, currentBase);
bool ret = false;
bool ret = true;
uint32_t drmContextId = 0u;
TaskCountType completionValue = 0u;
@@ -132,18 +132,22 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, siz
for (auto drmIterator = 0u; drmIterator < osContextLinux->getDeviceBitfield().size(); drmIterator++) {
if (osContextLinux->getDeviceBitfield().test(drmIterator)) {
ret |= !!bb->exec(static_cast<uint32_t>(size),
offset,
execFlags,
false,
&this->osContext,
drmIterator,
drmContextIds[drmContextId],
nullptr,
0,
&execObject,
completionFenceGpuAddress,
completionValue);
uint32_t errorCode = bb->exec(static_cast<uint32_t>(size),
offset,
execFlags,
false,
&this->osContext,
drmIterator,
drmContextIds[drmContextId],
nullptr,
0,
&execObject,
completionFenceGpuAddress,
completionValue);
if (errorCode != 0) {
this->dispatchErrorCode = errorCode;
ret = false;
}
drmContextId++;
if (completionFenceGpuAddress) {
completionFenceGpuAddress += this->postSyncOffset;
@@ -151,7 +155,7 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, siz
}
}
return !ret;
return ret;
}
template <typename GfxFamily, typename Dispatcher>