CapabilityTable adjustments part 2
- Move Windows HardwareInfo configuration from DeviceFactory to HwInfoConfig - Add ULTs for HwInfoConfig on Windows Change-Id: I9b84bbe60ca9f2ad4ddc3119bc8cb88331a7d154
This commit is contained in:
parent
820dc3da0d
commit
f4af035ab7
|
@ -40,10 +40,10 @@ HardwareInfo *DeviceFactory::hwInfos = nullptr;
|
|||
|
||||
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
||||
std::vector<HardwareInfo> tHwInfos;
|
||||
int retVal;
|
||||
unsigned int devNum = 0;
|
||||
Drm *drm = nullptr;
|
||||
std::unique_ptr<OSInterface> osInterface = std::unique_ptr<OSInterface>(new OSInterface());
|
||||
|
||||
while ((drm = Drm::create(devNum)) != nullptr) {
|
||||
const HardwareInfo *pCurrDevice = platformDevices[devNum];
|
||||
|
||||
|
@ -53,8 +53,7 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
|||
osInterface.get()->get()->setDrm(drm);
|
||||
|
||||
HwInfoConfig *hwConfig = HwInfoConfig::get(pCurrDevice->pPlatform->eProductFamily);
|
||||
retVal = hwConfig->configureHwInfo(pCurrDevice, &tmpHwInfo, osInterface.get());
|
||||
if (retVal != 0) {
|
||||
if (hwConfig->configureHwInfo(pCurrDevice, &tmpHwInfo, osInterface.get())) {
|
||||
return false;
|
||||
}
|
||||
tHwInfos.push_back(tmpHwInfo);
|
||||
|
|
|
@ -22,13 +22,10 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
@ -40,39 +37,16 @@ HardwareInfo *DeviceFactory::hwInfos = nullptr;
|
|||
|
||||
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
||||
HardwareInfo *tempHwInfos = new HardwareInfo[1];
|
||||
unsigned int devNum = 0;
|
||||
constexpr unsigned int devNum = 0;
|
||||
numDevices = 0;
|
||||
|
||||
if (Wddm::enumAdapters(devNum, tempHwInfos[devNum])) {
|
||||
// Overwrite dynamic parameters
|
||||
tempHwInfos[devNum].capabilityTable.ftrSvm = tempHwInfos[devNum].pSkuTable->ftrSVM;
|
||||
std::unique_ptr<OSInterface> osInterface = std::unique_ptr<OSInterface>(new OSInterface());
|
||||
|
||||
HwHelper &hwHelper = HwHelper::get(tempHwInfos[devNum].pPlatform->eRenderCoreFamily);
|
||||
|
||||
hwHelper.adjustDefaultEngineType(&tempHwInfos[devNum]);
|
||||
tempHwInfos[devNum].capabilityTable.defaultEngineType = DebugManager.flags.NodeOrdinal.get() == -1
|
||||
? tempHwInfos[devNum].capabilityTable.defaultEngineType
|
||||
: static_cast<EngineType>(DebugManager.flags.NodeOrdinal.get());
|
||||
|
||||
hwHelper.setCapabilityCoherencyFlag(&tempHwInfos[devNum], tempHwInfos[devNum].capabilityTable.ftrSupportsCoherency);
|
||||
|
||||
hwHelper.setupPreemptionRegisters(&tempHwInfos[devNum], !!tempHwInfos[devNum].pWaTable->waEnablePreemptionGranularityControlByUMD);
|
||||
PreemptionHelper::adjustDefaultPreemptionMode(tempHwInfos[devNum].capabilityTable,
|
||||
static_cast<bool>(tempHwInfos[devNum].pSkuTable->ftrGpGpuMidThreadLevelPreempt),
|
||||
static_cast<bool>(tempHwInfos[devNum].pSkuTable->ftrGpGpuThreadGroupLevelPreempt),
|
||||
static_cast<bool>(tempHwInfos[devNum].pSkuTable->ftrGpGpuMidBatchPreempt));
|
||||
tempHwInfos->capabilityTable.requiredPreemptionSurfaceSize = tempHwInfos->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte;
|
||||
|
||||
// Instrumentation
|
||||
tempHwInfos[devNum].capabilityTable.instrumentationEnabled &= haveInstrumentation;
|
||||
|
||||
auto &kmdNotifyProperties = tempHwInfos[devNum].capabilityTable.kmdNotifyProperties;
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get(), kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleep.get(), kmdNotifyProperties.enableQuickKmdSleep);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.get(), kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||
HwInfoConfig *hwConfig = HwInfoConfig::get(tempHwInfos->pPlatform->eProductFamily);
|
||||
if (hwConfig->configureHwInfo(tempHwInfos, tempHwInfos, osInterface.get())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
numDevices = 1;
|
||||
*pHWInfos = tempHwInfos;
|
||||
|
@ -80,11 +54,11 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
|||
DeviceFactory::hwInfos = tempHwInfos;
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
delete[] tempHwInfos;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeviceFactory::releaseDevices() {
|
||||
|
|
|
@ -20,16 +20,55 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/gen_common/hw_cmds.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
#include "runtime/instrumentation/instrumentation.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
HwInfoConfig *hwInfoConfigFactory[IGFX_MAX_PRODUCT] = {};
|
||||
|
||||
int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface) {
|
||||
return 0;
|
||||
HwHelper &hwHelper = HwHelper::get(outHwInfo->pPlatform->eRenderCoreFamily);
|
||||
|
||||
outHwInfo->capabilityTable.ftrSvm = outHwInfo->pSkuTable->ftrSVM;
|
||||
|
||||
hwHelper.adjustDefaultEngineType(outHwInfo);
|
||||
const auto nodeOrdinal = DebugManager.flags.NodeOrdinal.get();
|
||||
outHwInfo->capabilityTable.defaultEngineType = nodeOrdinal == -1
|
||||
? outHwInfo->capabilityTable.defaultEngineType
|
||||
: static_cast<EngineType>(nodeOrdinal);
|
||||
|
||||
hwHelper.setCapabilityCoherencyFlag(outHwInfo, outHwInfo->capabilityTable.ftrSupportsCoherency);
|
||||
|
||||
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;
|
||||
|
||||
outHwInfo->capabilityTable.instrumentationEnabled &= haveInstrumentation;
|
||||
|
||||
auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties;
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get(), kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleep.get(), kmdNotifyProperties.enableQuickKmdSleep);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.get(), kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||
|
||||
// Product specific config
|
||||
int ret = configureHardwareCustom(outHwInfo, osIface);
|
||||
if (ret != 0) {
|
||||
memset(outHwInfo, 0, sizeof(HardwareInfo));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "os_interface.h"
|
||||
|
||||
#include "runtime/os_interface/windows/wddm.h"
|
||||
#include "runtime/os_interface/windows/sys_calls.h"
|
||||
#include "os_interface.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include "profileapi.h"
|
||||
#include "runtime/os_interface/windows/windows_wrapper.h"
|
||||
|
||||
#include <d3dkmthk.h>
|
||||
#include "profileapi.h"
|
||||
#include "umKmInc/sharedata.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class Wddm;
|
||||
|
|
|
@ -25,6 +25,8 @@ set(IGDRCL_SRCS_tests_os_interface_windows
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/device_os_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kmdaf_listener.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_win.h
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hw_info_config_tests.h"
|
||||
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm.h"
|
||||
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/libult/mock_gfx_family.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <>
|
||||
int HwInfoConfigHw<IGFX_UNKNOWN>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HwInfoConfigTestWindows::SetUp() {
|
||||
HwInfoConfigTest::SetUp();
|
||||
|
||||
osInterface = std::make_unique<OSInterface>();
|
||||
Wddm::enumAdapters(0, outHwInfo);
|
||||
}
|
||||
|
||||
void HwInfoConfigTestWindows::TearDown() {
|
||||
ReleaseOutHwInfoStructs();
|
||||
|
||||
HwInfoConfigTest::TearDown();
|
||||
}
|
||||
|
||||
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenReturnSuccess) {
|
||||
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenSetFtrSvmCorrectly) {
|
||||
auto ftrSvm = outHwInfo.pSkuTable->ftrSVM;
|
||||
|
||||
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
|
||||
ASSERT_EQ(0, ret);
|
||||
|
||||
EXPECT_EQ(outHwInfo.capabilityTable.ftrSvm, ftrSvm);
|
||||
}
|
||||
|
||||
TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabledWhenConfiguringHwInfoThenOverrideItUsingHaveInstrumentation) {
|
||||
int ret;
|
||||
|
||||
outHwInfo.capabilityTable.instrumentationEnabled = false;
|
||||
ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
|
||||
ASSERT_EQ(0, ret);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.instrumentationEnabled);
|
||||
|
||||
outHwInfo.capabilityTable.instrumentationEnabled = true;
|
||||
ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
|
||||
ASSERT_EQ(0, ret);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled == haveInstrumentation);
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
|
||||
#include "unit_tests/os_interface/hw_info_config_tests.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
|
||||
};
|
||||
|
||||
struct HwInfoConfigTestWindows : public HwInfoConfigTest {
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
std::unique_ptr<OSInterface> osInterface;
|
||||
DummyHwConfig hwConfig;
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
Loading…
Reference in New Issue