From 3a030d9b8b89000fae2e190faf2e8f1b89bbc353 Mon Sep 17 00:00:00 2001 From: Dominik Dabek Date: Wed, 26 Jan 2022 16:12:53 +0000 Subject: [PATCH] Optimize Level Zero indirect allocations handling. Remove find in cmdlist makeResidentAndMigrate, not needed, CSR resolves duplicates at makeResident calls Co-authored-by: Michal Mrozek Signed-off-by: Dominik Dabek --- level_zero/core/source/cmdlist/cmdlist.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist.cpp b/level_zero/core/source/cmdlist/cmdlist.cpp index ec51632cbf..2eeb943934 100644 --- a/level_zero/core/source/cmdlist/cmdlist.cpp +++ b/level_zero/core/source/cmdlist/cmdlist.cpp @@ -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(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(alloc->getGpuAddress())); } } }