Introduce debug regkey to enable kmd migration for buffers

The new regkey is aimed to test cross-tile migration for buffers,
esp. first touch policy on h/w with support for page faults.

Related-To: NEO-6977

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2022-06-27 09:38:48 +00:00
committed by Compute-Runtime-Automation
parent 8ea5bbd3b5
commit 9bf32b73ec
4 changed files with 42 additions and 1 deletions

View File

@@ -4046,6 +4046,43 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsUnSupportedWhenCallingBindBoOnBuffe
EXPECT_FALSE(bo.isExplicitResidencyRequired());
}
TEST_F(DrmMemoryManagerTest, givenPageFaultIsSupportedAndKmdMigrationEnabledForBuffersWhenCallingBindBoOnBufferAllocationThenAllocationShouldPageFaultAndExplicitResidencyIsNotRequired) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableRecoverablePageFaults.set(true);
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
EXPECT_FALSE(drm.pageFaultSupported);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized();
uint32_t vmHandleId = 0;
MockBufferObject bo(&drm, 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
for (auto useKmdMigrationForBuffer : {-1, 0, 1}) {
DebugManager.flags.UseKmdMigrationForBuffers.set(useKmdMigrationForBuffer);
std::vector<BufferObject *> bufferObjects;
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
if (useKmdMigrationForBuffer > 0) {
EXPECT_TRUE(allocation.shouldAllocationPageFault(&drm));
EXPECT_FALSE(bo.isExplicitResidencyRequired());
} else {
EXPECT_FALSE(allocation.shouldAllocationPageFault(&drm));
EXPECT_TRUE(bo.isExplicitResidencyRequired());
}
}
}
TEST_F(DrmMemoryManagerTest, givenPageFaultIsSupportedWhenCallingBindBoOnAllocationThatShouldPageFaultThenExplicitResidencyIsNotRequired) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);