Revert "Optimize Level Zero indirect allocations handling."

This reverts commit 3ecbc55ba9.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-01-20 11:04:44 +01:00
committed by Compute-Runtime-Automation
parent c79b8f0e90
commit 6082865eb4
9 changed files with 75 additions and 188 deletions

View File

@@ -138,13 +138,16 @@ NEO::PreemptionMode CommandList::obtainFunctionPreemptionMode(Kernel *kernel) {
void CommandList::makeResidentAndMigrate(bool performMigration) {
for (auto alloc : commandContainer.getResidencyContainer()) {
csr->makeResident(*alloc);
if (csr->getResidencyAllocations().end() ==
std::find(csr->getResidencyAllocations().begin(), csr->getResidencyAllocations().end(), 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()));
}
}
}
}

View File

@@ -173,14 +173,13 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
UnifiedMemoryControls unifiedMemoryControls = commandList->getUnifiedMemoryControls();
auto svmAllocsManager = device->getDriverHandle()->getSvmAllocsManager();
svmAllocsManager->makeInternalAllocationsResidentAndMigrateIfNeeded(neoDevice->getRootDeviceIndex(),
unifiedMemoryControls.generateMask(),
*csr, performMigration);
spaceForResidency += svmAllocsManager->getNumAllocs();
svmAllocsManager->addInternalAllocationsToResidencyContainer(neoDevice->getRootDeviceIndex(),
commandList->commandContainer.getResidencyContainer(),
unifiedMemoryControls.generateMask());
}
totalCmdBuffers += commandList->commandContainer.getCmdBufferAllocations().size();
spaceForResidency += commandList->commandContainer.getResidencyContainer().size();
auto commandListPreemption = commandList->getCommandListPreemptionMode();
if (statePreemption != commandListPreemption) {
if (preemptionCmdSyncProgramming) {

View File

@@ -747,7 +747,7 @@ HWTEST2_F(CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenWalkerP
}
using CommandQueueIndirectAllocations = Test<ModuleFixture>;
HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAreMadeResident) {
HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) {
const ze_command_queue_desc_t desc = {};
MockCsrHw2<FamilyType> csr(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
@@ -786,21 +786,19 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL
nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto &residencyContainer = csr.rememberedResidencies;
auto itorEvent = std::find(std::begin(residencyContainer),
std::end(residencyContainer),
auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()),
std::end(commandList->commandContainer.getResidencyContainer()),
gpuAlloc);
EXPECT_EQ(itorEvent, std::end(residencyContainer));
EXPECT_EQ(itorEvent, std::end(commandList->commandContainer.getResidencyContainer()));
auto commandListHandle = commandList->toHandle();
result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
itorEvent = std::find(std::begin(residencyContainer),
std::end(residencyContainer),
itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()),
std::end(commandList->commandContainer.getResidencyContainer()),
gpuAlloc);
EXPECT_NE(itorEvent, std::end(residencyContainer));
EXPECT_NE(itorEvent, std::end(commandList->commandContainer.getResidencyContainer()));
device->getDriverHandle()->getSvmAllocsManager()->freeSVMAlloc(deviceAlloc);
commandQueue->destroy();