Add memory prefetch for kmd migrated shared allocations

This feature is disabled by default, controlled with the knob
AppendMemoryPrefetchForKmdMigratedSharedAllocations

Related-To: NEO-6740

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2022-03-02 13:38:28 +00:00
committed by Compute-Runtime-Automation
parent 10e7b9d5be
commit c0b7f05897
16 changed files with 244 additions and 0 deletions

View File

@@ -252,6 +252,24 @@ TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseWithDevicePre
EXPECT_EQ(2u, drm->ioctlCallsCount);
}
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemPrefetchSucceedsThenReturnTrue) {
MockBufferObject bo(drm.get(), 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
drm->ioctlRetVal = 0;
EXPECT_TRUE(allocation.setMemPrefetch(drm.get()));
}
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemPrefetchFailsThenReturnFalse) {
MockBufferObject bo(drm.get(), 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
drm->ioctlRetVal = EINVAL;
EXPECT_FALSE(allocation.setMemPrefetch(drm.get()));
}
TEST_F(IoctlHelperPrelimFixture, givenVariousDirectSubmissionFlagSettingWhenCreateDrmContextIsCalledThenCorrectFlagsArePassedToIoctl) {
DebugManagerStateRestore stateRestore;
uint32_t vmId = 0u;

View File

@@ -169,6 +169,15 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenSetVmBoAdviseThenReturnTrue) {
EXPECT_TRUE(ioctlHelper->setVmBoAdvise(drm.get(), 0, 0, nullptr));
}
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenSetVmPrefetchThenReturnTrue) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto ioctlHelper = drm->getIoctlHelper();
EXPECT_TRUE(ioctlHelper->setVmPrefetch(drm.get(), 0, 0, 0));
}
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenDirectSubmissionEnabledThenNoFlagsAdded) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.DirectSubmissionDrmContext.set(1);