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

@@ -5,6 +5,7 @@
*
*/
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/hw_helper.h"
#include "core/os_interface/aub_memory_operations_handler.h"
#include "runtime/aub/aub_center.h"
@@ -20,7 +21,7 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get();
}
executionEnvironment.rootDeviceEnvironments.resize(numRootDevices);
executionEnvironment.prepareRootDeviceEnvironments(numRootDevices);
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
auto hwInfoConst = *platformDevices;
@@ -39,12 +40,14 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu
numDevices = numRootDevices;
DeviceFactory::numDevices = numDevices;
auto csr = DebugManager.flags.SetCommandStreamReceiver.get();
if (csr > 0) {
auto csrType = DebugManager.flags.SetCommandStreamReceiver.get();
if (csrType > 0) {
auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily);
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo);
executionEnvironment.initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csr));
auto aubCenter = executionEnvironment.rootDeviceEnvironments[0].aubCenter.get();
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csrType));
}
auto aubCenter = executionEnvironment.rootDeviceEnvironments[0]->aubCenter.get();
executionEnvironment.memoryOperationsInterface = std::make_unique<AubMemoryOperationsHandler>(aubCenter->getAubManager());
}
return true;

View File

@@ -26,7 +26,7 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get();
}
executionEnvironment.rootDeviceEnvironments.resize(numRootDevices);
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numRootDevices));
Drm *drm = Drm::create(devNum);
if (!drm) {

View File

@@ -593,7 +593,7 @@ MemoryManager::AllocationStatus DrmMemoryManager::populateOsHandles(OsHandleStor
return AllocationStatus::Success;
}
void DrmMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage) {
void DrmMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) {
for (unsigned int i = 0; i < maxFragmentsCount; i++) {
if (handleStorage.fragmentStorageData[i].freeTheFragment) {
if (handleStorage.fragmentStorageData[i].osHandleStorage->bo) {

View File

@@ -41,7 +41,7 @@ class DrmMemoryManager : public MemoryManager {
uint64_t getLocalMemorySize() override;
AllocationStatus populateOsHandles(OsHandleStorage &handleStorage) override;
void cleanOsHandles(OsHandleStorage &handleStorage) override;
void cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override;
// drm/i915 ioctl wrappers
MOCKABLE_VIRTUAL uint32_t unreference(BufferObject *bo, bool synchronousDestroy);

View File

@@ -28,7 +28,7 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get();
}
executionEnvironment.rootDeviceEnvironments.resize(numRootDevices);
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numRootDevices));
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
std::unique_ptr<Wddm> wddm(Wddm::createWddm());

View File

@@ -428,7 +428,7 @@ MemoryManager::AllocationStatus WddmMemoryManager::populateOsHandles(OsHandleSto
return AllocationStatus::Success;
}
void WddmMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage) {
void WddmMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) {
D3DKMT_HANDLE handles[maxFragmentsCount] = {0};
auto allocationCount = 0;

View File

@@ -43,7 +43,7 @@ class WddmMemoryManager : public MemoryManager {
void removeAllocationFromHostPtrManager(GraphicsAllocation *memory) override;
AllocationStatus populateOsHandles(OsHandleStorage &handleStorage) override;
void cleanOsHandles(OsHandleStorage &handleStorage) override;
void cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override;
void obtainGpuAddressFromFragments(WddmAllocation *allocation, OsHandleStorage &handleStorage);