fix: Release temporary allocations from bcs split

Related-To: NEO-7933

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2023-04-27 14:11:10 +00:00
committed by Compute-Runtime-Automation
parent 464c67789f
commit 48114e5423
11 changed files with 109 additions and 71 deletions

View File

@@ -12,7 +12,7 @@
#include "shared/source/sku_info/sku_info_base.h"
#include "level_zero/core/source/cmdlist/cmdlist_hw_immediate.h"
#include "level_zero/core/source/cmdqueue/cmdqueue.h"
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
#include "level_zero/core/source/context/context.h"
#include "level_zero/core/source/event/event.h"
@@ -118,6 +118,10 @@ struct BcsSplit {
totalSize -= localSize;
engineCount--;
if (hSignalEvent) {
Event::fromHandle(hSignalEvent)->appendAdditionalCsr(static_cast<CommandQueueImp *>(cmdQsForSplit[i])->getCsr());
}
}
cmdList->addEventsToCmdList(static_cast<uint32_t>(cmdQsForSplit.size()), eventHandles.data(), hasRelaxedOrderingDependencies, false);

View File

@@ -384,7 +384,8 @@ void Event::resetPackets(bool resetAllPackets) {
cpuStartTimestamp = 0;
gpuStartTimestamp = 0;
gpuEndTimestamp = 0;
this->csr = this->device->getNEODevice()->getDefaultEngine().commandStreamReceiver;
this->csrs.clear();
this->csrs.push_back(this->device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
}
void Event::setIsCompleted() {

View File

@@ -135,7 +135,15 @@ struct Event : _ze_event_handle_t {
return isTimestampEvent || usingContextEndOffset;
}
void setCsr(NEO::CommandStreamReceiver *csr) {
this->csr = csr;
this->csrs[0] = csr;
}
void appendAdditionalCsr(NEO::CommandStreamReceiver *additonalCsr) {
for (const auto &csr : csrs) {
if (csr == additonalCsr) {
return;
}
}
csrs.push_back(additonalCsr);
}
void increaseKernelCount();
@@ -226,7 +234,7 @@ struct Event : _ze_event_handle_t {
// Metric streamer instance associated with the event.
MetricStreamer *metricStreamer = nullptr;
NEO::CommandStreamReceiver *csr = nullptr;
StackVec<NEO::CommandStreamReceiver *, 1> csrs;
void *hostAddress = nullptr;
Device *device = nullptr;
EventPool *eventPool = nullptr;

View File

@@ -42,7 +42,7 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
event->hostAddress = reinterpret_cast<void *>(baseHostAddr + event->eventPoolOffset);
event->signalScope = desc->signal;
event->waitScope = desc->wait;
event->csr = csr;
event->csrs.push_back(csr);
event->maxKernelCount = eventPool->getMaxKernelCount();
event->maxPacketCount = eventPool->getEventMaxPackets();
event->isFromIpcPool = eventPool->getImportedIpcPool();
@@ -167,10 +167,14 @@ ze_result_t EventImp<TagSizeT>::queryStatusEventPackets() {
}
}
if (this->downloadAllocationRequired) {
this->csr->downloadAllocations();
for (auto &csr : csrs) {
csr->downloadAllocations();
}
}
this->setIsCompleted();
this->csr->getInternalAllocationStorage()->cleanAllocationList(this->csr->peekTaskCount(), NEO::AllocationUsage::TEMPORARY_ALLOCATION);
for (auto &csr : csrs) {
csr->getInternalAllocationStorage()->cleanAllocationList(csr->peekTaskCount(), NEO::AllocationUsage::TEMPORARY_ALLOCATION);
}
return ZE_RESULT_SUCCESS;
}
@@ -180,7 +184,9 @@ ze_result_t EventImp<TagSizeT>::queryStatus() {
hostEventSetValue(metricStreamer->getNotificationState());
}
if (this->downloadAllocationRequired) {
this->csr->downloadAllocation(this->getAllocation(this->device));
for (auto &csr : csrs) {
csr->downloadAllocation(this->getAllocation(this->device));
}
}
if (!this->isFromIpcPool && isAlreadyCompleted()) {
@@ -292,7 +298,7 @@ ze_result_t EventImp<TagSizeT>::hostSynchronize(uint64_t timeout) {
ze_result_t ret = ZE_RESULT_NOT_READY;
if (this->csr->getType() == NEO::CommandStreamReceiverType::CSR_AUB) {
if (this->csrs[0]->getType() == NEO::CommandStreamReceiverType::CSR_AUB) {
return ZE_RESULT_SUCCESS;
}
@@ -320,7 +326,7 @@ ze_result_t EventImp<TagSizeT>::hostSynchronize(uint64_t timeout) {
if (elapsedTimeSinceGpuHangCheck.count() >= this->gpuHangCheckPeriod.count()) {
lastHangCheckTime = currentTime;
if (this->csr->isGpuHangDetected()) {
if (this->csrs[0]->isGpuHangDetected()) {
if (device->getNEODevice()->getRootDeviceEnvironment().assertHandler.get()) {
device->getNEODevice()->getRootDeviceEnvironment().assertHandler->printAssertAndAbort();
}