Move initialization of AubCenter to RootDeviceEnvironment

make RootDeviceEnvironments vector of unique_ptr

Related-To: NEO-3857

Change-Id: I23998502198307c8535cdd5c9c4af5223a5d69a5
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-11-15 09:59:48 +01:00
committed by sys_ocldev
parent 8cc6a65e69
commit 3e1b15c31d
61 changed files with 355 additions and 178 deletions

View File

@@ -7,6 +7,7 @@
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/aligned_memory.h"
#include "core/helpers/basic_math.h"
#include "core/helpers/ptr_math.h"
@@ -218,8 +219,10 @@ void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllo
releaseReservedCpuAddressRange(gfxAllocation->getReservedAddressPtr(), gfxAllocation->getReservedAddressSize());
}
if (executionEnvironment.rootDeviceEnvironments.size() > 0) {
auto aubCenter = executionEnvironment.rootDeviceEnvironments[0].aubCenter.get();
auto rootDeviceIndex = gfxAllocation->getRootDeviceIndex();
if (executionEnvironment.rootDeviceEnvironments.size() > rootDeviceIndex) {
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
if (aubCenter && aubCenter->getAubManager() && DebugManager.flags.EnableFreeMemory.get()) {
aubCenter->getAubManager()->freeMemory(gfxAllocation->getGpuAddress(), gfxAllocation->getUnderlyingBufferSize());
}
@@ -260,10 +263,10 @@ MemoryManager::AllocationStatus OsAgnosticMemoryManager::populateOsHandles(OsHan
}
return AllocationStatus::Success;
}
void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage) {
void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) {
for (unsigned int i = 0; i < maxFragmentsCount; i++) {
if (handleStorage.fragmentStorageData[i].freeTheFragment) {
auto aubCenter = executionEnvironment.rootDeviceEnvironments[0].aubCenter.get();
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
if (aubCenter && aubCenter->getAubManager() && DebugManager.flags.EnableFreeMemory.get()) {
aubCenter->getAubManager()->freeMemory((uint64_t)handleStorage.fragmentStorageData[i].cpuPtr, handleStorage.fragmentStorageData[i].fragmentSize);
}