mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Framework for adding custom device names
- Add new macro to define custom name - Add handling for custom name - Remove gen from generic name Resolves: NEO-5251 Signed-off-by: Adam Cetnerowski <adam.cetnerowski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
8a4bf3782a
commit
154f7e87be
@ -24,9 +24,11 @@
|
||||
|
||||
namespace NEO {
|
||||
const DeviceDescriptor deviceDescriptorTable[] = {
|
||||
#define DEVICE(devId, gt, gtType) {devId, >::hwInfo, >::setupHardwareInfo, gtType},
|
||||
#define NAMEDDEVICE(devId, gt, gtType, devName) {devId, >::hwInfo, >::setupHardwareInfo, gtType, devName},
|
||||
#define DEVICE(devId, gt, gtType) {devId, >::hwInfo, >::setupHardwareInfo, gtType, ""},
|
||||
#include "devices.inl"
|
||||
#undef DEVICE
|
||||
#undef NAMEDDEVICE
|
||||
{0, nullptr, nullptr, GTTYPE_UNDEFINED}};
|
||||
|
||||
Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
@ -52,11 +54,13 @@ Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &
|
||||
}
|
||||
|
||||
const DeviceDescriptor *device = nullptr;
|
||||
const char *devName = "";
|
||||
GTTYPE eGtType = GTTYPE_UNDEFINED;
|
||||
for (auto &d : deviceDescriptorTable) {
|
||||
if (drmObject->deviceId == d.deviceId) {
|
||||
device = &d;
|
||||
eGtType = d.eGtType;
|
||||
devName = d.devName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -67,6 +71,7 @@ Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &
|
||||
}
|
||||
drmObject->setGtType(eGtType);
|
||||
rootDeviceEnvironment.setHwInfo(device->pHwInfo);
|
||||
rootDeviceEnvironment.getMutableHardwareInfo()->capabilityTable.deviceName = devName;
|
||||
} else {
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"FATAL: Unknown device: deviceId: %04x, revisionId: %04x\n", drmObject->deviceId, drmObject->revisionId);
|
||||
|
@ -66,6 +66,7 @@ const RuntimeCapabilityTable EHL::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -67,6 +67,7 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
@ -78,7 +79,7 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
|
||||
true, // supportsIndependentForwardProgress
|
||||
true, // hostPtrTrackingEnabled
|
||||
true, // levelZeroSupported
|
||||
true // isIntegratedDevice
|
||||
true, // isIntegratedDevice
|
||||
};
|
||||
|
||||
WorkaroundTable ICLLP::workaroundTable = {};
|
||||
|
@ -66,6 +66,7 @@ const RuntimeCapabilityTable LKF::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -68,6 +68,7 @@ const RuntimeCapabilityTable ADLS::capabilityTable{
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
true, // ftr64KBpages
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -72,6 +72,7 @@ const RuntimeCapabilityTable DG1::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
true, // supportCacheFlushAfterWalker
|
||||
|
@ -64,6 +64,7 @@ const RuntimeCapabilityTable RKL::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -68,6 +68,7 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
true, // ftr64KBpages
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -71,6 +71,7 @@ const RuntimeCapabilityTable BDW::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"core", // platformType
|
||||
"", // deviceName
|
||||
false, // sourceLevelDebuggerSupported
|
||||
false, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -68,6 +68,7 @@ const RuntimeCapabilityTable BXT::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
false, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -63,6 +63,7 @@ const RuntimeCapabilityTable CFL::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"core", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -63,6 +63,7 @@ const RuntimeCapabilityTable GLK::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
false, // forceStatelessCompilationFor32Bit
|
||||
"lp", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -63,6 +63,7 @@ const RuntimeCapabilityTable KBL::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"core", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
|
@ -71,6 +71,7 @@ const RuntimeCapabilityTable SKL::capabilityTable{
|
||||
true, // instrumentationEnabled
|
||||
true, // forceStatelessCompilationFor32Bit
|
||||
"core", // platformType
|
||||
"", // deviceName
|
||||
true, // sourceLevelDebuggerSupported
|
||||
true, // supportsVme
|
||||
false, // supportCacheFlushAfterWalker
|
||||
@ -84,6 +85,7 @@ const RuntimeCapabilityTable SKL::capabilityTable{
|
||||
true, // levelZeroSupported
|
||||
true // isIntegratedDevice
|
||||
};
|
||||
|
||||
WorkaroundTable SKL::workaroundTable = {};
|
||||
FeatureTable SKL::featureTable = {};
|
||||
void SKL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) {
|
||||
|
@ -13,18 +13,9 @@ set(IGDRCL_SRCS_tests_device
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_size_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_device_name_tests.cpp
|
||||
)
|
||||
|
||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||
list(APPEND IGDRCL_SRCS_tests_device
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_device_name_tests_dg1.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND IGDRCL_SRCS_tests_device
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/get_device_name_tests.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND IGDRCL_SRCS_tests_device
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_win_timers_tests.cpp
|
||||
|
@ -23,8 +23,7 @@ using DeviceNameTest = ::testing::Test;
|
||||
TEST_F(DeviceNameTest, WhenCallingGetClDeviceNameThenReturnDeviceNameWithDeviceIdAppendedAtTheEnd) {
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
|
||||
std::string deviceName = "Intel(R) Graphics ";
|
||||
deviceName += familyName[defaultHwInfo->platform.eRenderCoreFamily];
|
||||
std::string deviceName = "Intel(R) Graphics";
|
||||
EXPECT_STREQ(deviceName.c_str(), clDevice->device.getDeviceName(*defaultHwInfo.get()).c_str());
|
||||
|
||||
std::stringstream clDeviceName;
|
||||
@ -32,3 +31,13 @@ TEST_F(DeviceNameTest, WhenCallingGetClDeviceNameThenReturnDeviceNameWithDeviceI
|
||||
clDeviceName << " [0x" << std::hex << std::setw(4) << std::setfill('0') << defaultHwInfo->platform.usDeviceID << "]";
|
||||
EXPECT_STREQ(clDeviceName.str().c_str(), clDevice->getClDeviceName(*defaultHwInfo.get()).c_str());
|
||||
}
|
||||
|
||||
TEST_F(DeviceNameTest, GivenDeviceWithNameWhenCallingGetClDeviceNameThenReturnCustomDeviceName) {
|
||||
HardwareInfo localHwInfo = *defaultHwInfo;
|
||||
localHwInfo.capabilityTable.deviceName = "Custom Device";
|
||||
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
|
||||
std::string deviceName = "Custom Device";
|
||||
EXPECT_STREQ(deviceName.c_str(), clDevice->device.getDeviceName(localHwInfo).c_str());
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/helpers/default_hw_info.h"
|
||||
#include "shared/test/unit_test/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace NEO {
|
||||
extern const char *familyName[];
|
||||
} // namespace NEO
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using DeviceNameTest = ::testing::Test;
|
||||
|
||||
TEST_F(DeviceNameTest, WhenCallingGetClDeviceNameThenReturnDeviceNameWithDeviceIdAppendedAtTheEnd) {
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
|
||||
std::string deviceName = "Intel(R) Graphics";
|
||||
if (defaultHwInfo->platform.eProductFamily < PRODUCT_FAMILY::IGFX_DG1) {
|
||||
deviceName += std::string(" ") + familyName[defaultHwInfo->platform.eRenderCoreFamily];
|
||||
}
|
||||
EXPECT_STREQ(deviceName.c_str(), clDevice->device.getDeviceName(*defaultHwInfo.get()).c_str());
|
||||
|
||||
std::stringstream clDeviceName;
|
||||
clDeviceName << deviceName;
|
||||
clDeviceName << " [0x" << std::hex << std::setw(4) << std::setfill('0') << defaultHwInfo->platform.usDeviceID << "]";
|
||||
EXPECT_STREQ(clDeviceName.str().c_str(), clDevice->getClDeviceName(*defaultHwInfo.get()).c_str());
|
||||
}
|
@ -15,17 +15,8 @@ set(NEO_CORE_DEVICE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/root_device.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_get_device_name.cpp
|
||||
)
|
||||
|
||||
if(SUPPORT_DG1 AND "${BRANCH_TYPE}" STREQUAL "")
|
||||
list(APPEND NEO_CORE_DEVICE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_get_device_name_dg1.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND NEO_CORE_DEVICE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/device_get_device_name.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_DEVICE ${NEO_CORE_DEVICE})
|
||||
add_subdirectories()
|
||||
|
@ -11,8 +11,6 @@
|
||||
namespace NEO {
|
||||
|
||||
const std::string Device::getDeviceName(const HardwareInfo &hwInfo) const {
|
||||
std::string deviceName = "Intel(R) Graphics ";
|
||||
deviceName += familyName[hwInfo.platform.eRenderCoreFamily];
|
||||
return deviceName;
|
||||
return std::string(hwInfo.capabilityTable.deviceName).empty() ? "Intel(R) Graphics" : hwInfo.capabilityTable.deviceName;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
const std::string Device::getDeviceName(const HardwareInfo &hwInfo) const {
|
||||
std::string deviceName = "Intel(R) Graphics";
|
||||
if (hwInfo.platform.eProductFamily < PRODUCT_FAMILY::IGFX_DG1) {
|
||||
deviceName += std::string(" ") + familyName[hwInfo.platform.eRenderCoreFamily];
|
||||
}
|
||||
return deviceName;
|
||||
}
|
||||
} // namespace NEO
|
@ -51,6 +51,7 @@ struct RuntimeCapabilityTable {
|
||||
bool instrumentationEnabled;
|
||||
bool forceStatelessCompilationFor32Bit;
|
||||
const char *platformType;
|
||||
const char *deviceName;
|
||||
bool debuggerSupported;
|
||||
bool supportsVme;
|
||||
bool supportCacheFlushAfterWalker;
|
||||
@ -82,7 +83,7 @@ struct HardwareInfo {
|
||||
WorkaroundTable workaroundTable = {};
|
||||
alignas(4) GT_SYSTEM_INFO gtSystemInfo = {};
|
||||
|
||||
RuntimeCapabilityTable capabilityTable = {};
|
||||
alignas(8) RuntimeCapabilityTable capabilityTable = {};
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY product>
|
||||
|
@ -43,6 +43,7 @@ struct DeviceDescriptor { // NOLINT(clang-analyzer-optin.performance.Padding)
|
||||
const HardwareInfo *pHwInfo;
|
||||
void (*setupHardwareInfo)(HardwareInfo *, bool);
|
||||
GTTYPE eGtType;
|
||||
const char *devName;
|
||||
};
|
||||
|
||||
extern const DeviceDescriptor deviceDescriptorTable[];
|
||||
|
Reference in New Issue
Block a user