feature(sysman): reinitialize gfxPartition on reset

Related-To: NEO-13203

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-12-12 12:38:40 +00:00
committed by Compute-Runtime-Automation
parent 084ea8b687
commit 0589a70dc7
9 changed files with 106 additions and 1 deletions

View File

@@ -249,6 +249,7 @@ std::unique_ptr<Device> DeviceFactory::createDevice(ExecutionEnvironment &execut
return device;
}
executionEnvironment.memoryManager->reInitDeviceSpecificGfxPartition(rootDeviceIndex);
executionEnvironment.memoryManager->createDeviceSpecificMemResources(rootDeviceIndex);
executionEnvironment.memoryManager->reInitLatestContextId();
device = createRootDeviceFunc(executionEnvironment, rootDeviceIndex);

View File

@@ -2948,4 +2948,23 @@ void DrmMemoryManager::getExtraDeviceProperties(uint32_t rootDeviceIndex, uint32
getDrm(rootDeviceIndex).getIoctlHelper()->queryDeviceParams(moduleId, serverType);
}
bool DrmMemoryManager::reInitDeviceSpecificGfxPartition(uint32_t rootDeviceIndex) {
if (gfxPartitions.at(rootDeviceIndex) == nullptr) {
auto gpuAddressSpace = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->capabilityTable.gpuAddressSpace;
gfxPartitions.at(rootDeviceIndex) = std::make_unique<GfxPartition>(reservedCpuAddressRange);
uint64_t gfxTop{};
getDrm(rootDeviceIndex).queryGttSize(gfxTop, false);
if (getGfxPartition(rootDeviceIndex)->init(gpuAddressSpace, getSizeToReserve(), rootDeviceIndex, gfxPartitions.size(), heapAssigners[rootDeviceIndex]->apiAllowExternalHeapForSshAndDsh, DrmMemoryManager::getSystemSharedMemory(rootDeviceIndex), gfxTop)) {
return true;
}
}
return false;
}
void DrmMemoryManager::releaseDeviceSpecificGfxPartition(uint32_t rootDeviceIndex) {
gfxPartitions.at(rootDeviceIndex).reset();
}
} // namespace NEO

View File

@@ -100,6 +100,8 @@ class DrmMemoryManager : public MemoryManager {
DrmAllocation *createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, void *mappedPtr, bool reuseSharedAllocation);
void releaseDeviceSpecificMemResources(uint32_t rootDeviceIndex) override;
void createDeviceSpecificMemResources(uint32_t rootDeviceIndex) override;
void releaseDeviceSpecificGfxPartition(uint32_t rootDeviceIndex) override;
bool reInitDeviceSpecificGfxPartition(uint32_t rootDeviceIndex) override;
bool allowIndirectAllocationsAsPack(uint32_t rootDeviceIndex) override;
Drm &getDrm(uint32_t rootDeviceIndex) const;
size_t getSizeOfChunk(size_t allocSize);