Move HardwareInfo ownership to ExecutionEnvironment [1/n]

Change-Id: I5e5b4cc45947a8841282c7d431fb69d9c397a2d4
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-05-06 12:33:44 +02:00
committed by sys_ocldev
parent b2aee82f41
commit bb80d327c7
233 changed files with 1786 additions and 2298 deletions

View File

@@ -21,35 +21,31 @@ namespace NEO {
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
size_t DeviceFactory::numDevices = 0;
HardwareInfo *DeviceFactory::hwInfo = nullptr;
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
numDevices = 0;
auto hardwareInfo = std::make_unique<HardwareInfo>();
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
if (!wddm->enumAdapters(*hardwareInfo)) {
return false;
}
auto totalDeviceCount = DeviceHelper::getDevicesCount(hardwareInfo.get());
auto totalDeviceCount = DeviceHelper::getDevicesCount(hardwareInfo);
executionEnvironment.osInterface.reset(new OSInterface());
executionEnvironment.osInterface->get()->setWddm(wddm.release());
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform->eProductFamily);
if (hwConfig->configureHwInfo(hardwareInfo.get(), hardwareInfo.get(), nullptr)) {
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform.eProductFamily);
if (hwConfig->configureHwInfo(hardwareInfo, hardwareInfo, nullptr)) {
return false;
}
*pHWInfos = hardwareInfo.release();
numDevices = totalDeviceCount;
DeviceFactory::numDevices = numDevices;
DeviceFactory::hwInfo = *pHWInfos;
executionEnvironment.setHwInfo(*pHWInfos);
executionEnvironment.initGmm();
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(**pHWInfos);
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo);
bool success = executionEnvironment.osInterface->get()->getWddm()->init(preemptionMode);
DEBUG_BREAK_IF(!success);
@@ -57,14 +53,6 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, Exec
}
void DeviceFactory::releaseDevices() {
if (DeviceFactory::numDevices > 0) {
delete hwInfo->pPlatform;
delete hwInfo->pSkuTable;
delete hwInfo->pWaTable;
delete hwInfo->pSysInfo;
delete hwInfo;
}
DeviceFactory::hwInfo = nullptr;
DeviceFactory::numDevices = 0;
}

View File

@@ -21,21 +21,21 @@ namespace NEO {
HwInfoConfig *hwInfoConfigFactory[IGFX_MAX_PRODUCT] = {};
int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface) {
HwHelper &hwHelper = HwHelper::get(outHwInfo->pPlatform->eRenderCoreFamily);
HwHelper &hwHelper = HwHelper::get(outHwInfo->pPlatform.eRenderCoreFamily);
outHwInfo->capabilityTable.ftrSvm = outHwInfo->pSkuTable->ftrSVM;
outHwInfo->capabilityTable.ftrSvm = outHwInfo->pSkuTable.ftrSVM;
hwHelper.adjustDefaultEngineType(outHwInfo);
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
hwHelper.setCapabilityCoherencyFlag(outHwInfo, outHwInfo->capabilityTable.ftrSupportsCoherency);
hwHelper.setupPreemptionRegisters(outHwInfo, outHwInfo->pWaTable->waEnablePreemptionGranularityControlByUMD);
hwHelper.setupPreemptionRegisters(outHwInfo, outHwInfo->pWaTable.waEnablePreemptionGranularityControlByUMD);
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,
static_cast<bool>(outHwInfo->pSkuTable->ftrGpGpuMidThreadLevelPreempt),
static_cast<bool>(outHwInfo->pSkuTable->ftrGpGpuThreadGroupLevelPreempt),
static_cast<bool>(outHwInfo->pSkuTable->ftrGpGpuMidBatchPreempt));
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte;
static_cast<bool>(outHwInfo->pSkuTable.ftrGpGpuMidThreadLevelPreempt),
static_cast<bool>(outHwInfo->pSkuTable.ftrGpGpuThreadGroupLevelPreempt),
static_cast<bool>(outHwInfo->pSkuTable.ftrGpGpuMidBatchPreempt));
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo.CsrSizeInMb * MemoryConstants::megaByte;
outHwInfo->capabilityTable.instrumentationEnabled &= haveInstrumentation;

View File

@@ -74,10 +74,10 @@ bool Wddm::enumAdapters(HardwareInfo &outHardwareInfo) {
return false;
}
outHardwareInfo.pPlatform = new PLATFORM(*gfxPlatform);
outHardwareInfo.pSkuTable = new FeatureTable(*featureTable);
outHardwareInfo.pWaTable = new WorkaroundTable(*waTable);
outHardwareInfo.pSysInfo = new GT_SYSTEM_INFO(*gtSystemInfo);
outHardwareInfo.pPlatform = *gfxPlatform;
outHardwareInfo.pSkuTable = *featureTable;
outHardwareInfo.pWaTable = *waTable;
outHardwareInfo.pSysInfo = *gtSystemInfo;
outHardwareInfo.capabilityTable = hardwareInfoTable[productFamily]->capabilityTable;
outHardwareInfo.capabilityTable.maxRenderFrequency = maxRenderFrequency;