Optimize Level Zero indirect allocations handling.

Remove find in cmdlist makeResidentAndMigrate,
not needed, CSR resolves duplicates at makeResident calls

Co-authored-by: Michal Mrozek <michal.mrozek@intel.com>

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2022-01-26 16:12:53 +00:00
committed by Compute-Runtime-Automation
parent 3d9548cee9
commit 3a030d9b8b

View File

@@ -138,16 +138,13 @@ NEO::PreemptionMode CommandList::obtainFunctionPreemptionMode(Kernel *kernel) {
void CommandList::makeResidentAndMigrate(bool performMigration) {
for (auto alloc : commandContainer.getResidencyContainer()) {
if (csr->getResidencyAllocations().end() ==
std::find(csr->getResidencyAllocations().begin(), csr->getResidencyAllocations().end(), alloc)) {
csr->makeResident(*alloc);
csr->makeResident(*alloc);
if (performMigration &&
(alloc->getAllocationType() == NEO::GraphicsAllocation::AllocationType::SVM_GPU ||
alloc->getAllocationType() == NEO::GraphicsAllocation::AllocationType::SVM_CPU)) {
auto pageFaultManager = device->getDriverHandle()->getMemoryManager()->getPageFaultManager();
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(alloc->getGpuAddress()));
}
if (performMigration &&
(alloc->getAllocationType() == NEO::GraphicsAllocation::AllocationType::SVM_GPU ||
alloc->getAllocationType() == NEO::GraphicsAllocation::AllocationType::SVM_CPU)) {
auto pageFaultManager = device->getDriverHandle()->getMemoryManager()->getPageFaultManager();
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(alloc->getGpuAddress()));
}
}
}