fix: Add shared VA surface to ulls light residency

Resolves: GSD-11126

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-05-14 07:21:35 +00:00
committed by Compute-Runtime-Automation
parent 8b711eaee1
commit cca51ce3e5
2 changed files with 30 additions and 0 deletions

View File

@@ -1333,6 +1333,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(c
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(reinterpret_cast<void *>(bo->peekAddress())));
auto drmAllocation = new DrmAllocation(properties.rootDeviceIndex, 1u /*num gmms*/, properties.allocationType, bo, reinterpret_cast<void *>(bo->peekAddress()), bo->peekSize(),
osHandleData.handle, memoryPool, canonizedGpuAddress);
this->makeAllocationResident(drmAllocation);
if (requireSpecificBitness && this->force32bitAllocations) {
drmAllocation->set32BitAllocation(true);

View File

@@ -1149,6 +1149,35 @@ HWTEST_TEMPLATED_F(DrmMemoryManagerTest, GivenAllocationWhenClosingSharedHandleT
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
HWTEST_TEMPLATED_F(DrmMemoryManagerTest, givenUllsLightWhenCreateGraphicsAllocationFromSharedHandleThenAddToResidencyContainer) {
mock->ioctlExpected.total = -1;
this->dontTestIoctlInTearDown = true;
osHandle handle = 1u;
this->mock->outputHandle = 2u;
size_t size = 4096u;
AllocationProperties properties(rootDeviceIndex, false, size, AllocationType::sharedBuffer, false, {});
TestedDrmMemoryManager::OsHandleData osHandleData{handle};
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false, true, false, *executionEnvironment);
memoryManager->allRegisteredEngines[this->device->getRootDeviceIndex()] = EngineControlContainer{this->device->allEngines};
for (auto &engine : memoryManager->getRegisteredEngines(this->device->getRootDeviceIndex())) {
engine.osContext->incRefInternal();
engine.osContext->setDirectSubmissionActive();
}
auto drmMemoryOperationsHandler = static_cast<DrmMemoryOperationsHandler *>(executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface.get());
EXPECT_FALSE(drmMemoryOperationsHandler->obtainAndResetNewResourcesSinceLastRingSubmit());
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
EXPECT_EQ(handle, graphicsAllocation->peekSharedHandle());
EXPECT_EQ(drmMemoryOperationsHandler->isResident(this->device, *graphicsAllocation), MemoryOperationsStatus::success);
EXPECT_TRUE(drmMemoryOperationsHandler->obtainAndResetNewResourcesSinceLastRingSubmit());
memoryManager->closeSharedHandle(graphicsAllocation);
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
HWTEST_TEMPLATED_F(DrmMemoryManagerTest, GivenAllocationWhenClosingInternalHandleThenSucceeds) {
mock->ioctlExpected.primeFdToHandle = 1;
mock->ioctlExpected.gemWait = 1;