mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Optimize mergeWithResidencyContainer method
Related-To: NEO-5007 Change-Id: I7145371c719ceeebf529fdf94a512a8398156591 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0f020b6da7
commit
71f99f4174
@@ -84,18 +84,16 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::isResident(Device *device
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrmMemoryOperationsHandlerBind::mergeWithResidencyContainer(OsContext *osContext, ResidencyContainer &residencyContainer) {
|
void DrmMemoryOperationsHandlerBind::mergeWithResidencyContainer(OsContext *osContext, ResidencyContainer &residencyContainer) {
|
||||||
|
if (DebugManager.flags.BindAllAllocations.get()) {
|
||||||
|
this->makeResidentWithinOsContext(osContext, ArrayRef<GraphicsAllocation *>(residencyContainer));
|
||||||
|
residencyContainer.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
for (auto gfxAllocation = residencyContainer.begin(); gfxAllocation != residencyContainer.end();) {
|
for (auto gfxAllocation = residencyContainer.begin(); gfxAllocation != residencyContainer.end();) {
|
||||||
if ((*gfxAllocation)->isAlwaysResident(osContext->getContextId())) {
|
if ((*gfxAllocation)->isAlwaysResident(osContext->getContextId())) {
|
||||||
gfxAllocation = residencyContainer.erase(gfxAllocation);
|
gfxAllocation = residencyContainer.erase(gfxAllocation);
|
||||||
} else if (DebugManager.flags.BindAllAllocations.get()) {
|
|
||||||
auto drmAllocation = static_cast<DrmAllocation *>(*gfxAllocation);
|
|
||||||
auto &drmContextIds = static_cast<const OsContextLinux *>(osContext)->getDrmContextIds();
|
|
||||||
for (uint32_t drmIterator = 0u; drmIterator < drmContextIds.size(); drmIterator++) {
|
|
||||||
drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, true);
|
|
||||||
}
|
|
||||||
drmAllocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, osContext->getContextId());
|
|
||||||
gfxAllocation = residencyContainer.erase(gfxAllocation);
|
|
||||||
} else {
|
} else {
|
||||||
gfxAllocation++;
|
gfxAllocation++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user