mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Allow to use upper case in ProductFamilyOverride flag
Change-Id: I2342a7f9e63d75e10f67fa968313d4c9a3f4b29e Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
8dc4783434
commit
2d485d6bd7
@@ -460,7 +460,7 @@ CIF::RAII::UPtr_t<IGC::IgcOclTranslationCtxTagOCL> CompilerInterface::createIgcT
|
||||
const HardwareInfo *hwInfo = &device.getHardwareInfo();
|
||||
auto productFamily = DebugManager.flags.ForceCompilerUsePlatform.get();
|
||||
if (productFamily != "unk") {
|
||||
getHwInfoForPlatformString(productFamily.c_str(), hwInfo);
|
||||
getHwInfoForPlatformString(productFamily, hwInfo);
|
||||
}
|
||||
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, hwInfo->platform);
|
||||
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, hwInfo->gtSystemInfo);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace NEO {
|
||||
HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable,
|
||||
const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable)
|
||||
@@ -29,12 +31,14 @@ const char *getPlatformType(const HardwareInfo &hwInfo) {
|
||||
return "lp";
|
||||
}
|
||||
|
||||
bool getHwInfoForPlatformString(const char *str, const HardwareInfo *&hwInfoIn) {
|
||||
bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwInfoIn) {
|
||||
std::transform(platform.begin(), platform.end(), platform.begin(), ::tolower);
|
||||
|
||||
bool ret = false;
|
||||
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
||||
if (hardwarePrefix[j] == nullptr)
|
||||
continue;
|
||||
if (strcmp(hardwarePrefix[j], str) == 0) {
|
||||
if (hardwarePrefix[j] == platform) {
|
||||
hwInfoIn = hardwareInfoTable[j];
|
||||
ret = true;
|
||||
break;
|
||||
|
||||
@@ -100,6 +100,6 @@ struct EnableGfxFamilyHw {
|
||||
};
|
||||
|
||||
const char *getPlatformType(const HardwareInfo &hwInfo);
|
||||
bool getHwInfoForPlatformString(const char *str, const HardwareInfo *&hwInfoIn);
|
||||
bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwInfoIn);
|
||||
aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo);
|
||||
} // namespace NEO
|
||||
|
||||
@@ -19,7 +19,7 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu
|
||||
}
|
||||
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
|
||||
auto hwInfoConst = *platformDevices;
|
||||
getHwInfoForPlatformString(productFamily.c_str(), hwInfoConst);
|
||||
getHwInfoForPlatformString(productFamily, hwInfoConst);
|
||||
numDevices = 0;
|
||||
std::string hwInfoConfig;
|
||||
DebugManager.getHardwareInfoOverride(hwInfoConfig);
|
||||
|
||||
@@ -109,6 +109,36 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(GetDevicesTest, givenUpperCaseProductFamilyOverrideFlagSetWhenCreatingDevicesThenFindExpectedPlatform) {
|
||||
std::string hwPrefix;
|
||||
std::string hwPrefixUpperCase;
|
||||
PRODUCT_FAMILY productFamily;
|
||||
|
||||
for (int productFamilyIndex = 0; productFamilyIndex < IGFX_MAX_PRODUCT; productFamilyIndex++) {
|
||||
if (hardwarePrefix[productFamilyIndex]) {
|
||||
hwPrefix = hardwarePrefix[productFamilyIndex];
|
||||
productFamily = static_cast<PRODUCT_FAMILY>(productFamilyIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_NE(0u, hwPrefix.length());
|
||||
hwPrefixUpperCase.resize(hwPrefix.length());
|
||||
std::transform(hwPrefix.begin(), hwPrefix.end(), hwPrefixUpperCase.begin(), ::toupper);
|
||||
EXPECT_NE(hwPrefix, hwPrefixUpperCase);
|
||||
|
||||
DebugManager.flags.ProductFamilyOverride.set(hwPrefixUpperCase);
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB);
|
||||
|
||||
ExecutionEnvironment *exeEnv = platformImpl->peekExecutionEnvironment();
|
||||
bool ret = getDevices(numDevices, *exeEnv);
|
||||
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_EQ(productFamily, exeEnv->getHardwareInfo()->platform.eProductFamily);
|
||||
|
||||
DeviceFactory::releaseDevices();
|
||||
}
|
||||
|
||||
HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToValidTypeThenTheFunctionReturnsTheExpectedValueOfHardwareInfo) {
|
||||
uint32_t expectedDevices = 1;
|
||||
DebugManager.flags.CreateMultipleDevices.set(expectedDevices);
|
||||
|
||||
Reference in New Issue
Block a user