Get CL Device Name with device ID appended at the end
Related-To: NEO-4744 Change-Id: I8a9a791a634f9c0c444695036d96e3c959c90de0 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
parent
324150dd37
commit
eb8f5fa301
|
@ -393,9 +393,8 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
|
|||
}
|
||||
|
||||
memset(pDeviceProperties->name, 0, ZE_MAX_DEVICE_NAME);
|
||||
std::string name = "Intel(R) ";
|
||||
name += NEO::familyName[hardwareInfo.platform.eRenderCoreFamily];
|
||||
name += '\0';
|
||||
|
||||
std::string name = getNEODevice()->getDeviceName(hardwareInfo);
|
||||
memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length());
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
|
|
@ -130,6 +130,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
|||
void initializeOpenclCAllVersions();
|
||||
void initializeOsSpecificCaps();
|
||||
void setupFp64Flags();
|
||||
const std::string getClDeviceName(const HardwareInfo &hwInfo) const;
|
||||
|
||||
Device &device;
|
||||
std::vector<std::unique_ptr<ClDevice>> subDevices;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/device/device_info.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
|
@ -71,10 +72,7 @@ void ClDevice::initializeCaps() {
|
|||
|
||||
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
||||
|
||||
// Add our graphics family name to the device name
|
||||
name += "Intel(R) ";
|
||||
name += familyName[hwInfo.platform.eRenderCoreFamily];
|
||||
name += " HD Graphics NEO";
|
||||
name = getClDeviceName(hwInfo);
|
||||
|
||||
if (driverInfo) {
|
||||
name.assign(driverInfo.get()->getDeviceName(name).c_str());
|
||||
|
@ -434,4 +432,13 @@ void ClDevice::initializeOpenclCAllVersions() {
|
|||
}
|
||||
}
|
||||
|
||||
const std::string ClDevice::getClDeviceName(const HardwareInfo &hwInfo) const {
|
||||
std::stringstream deviceName;
|
||||
|
||||
deviceName << device.getDeviceName(hwInfo);
|
||||
deviceName << " [0x" << std::hex << hwInfo.platform.usDeviceID << "]";
|
||||
|
||||
return deviceName.str();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -15,6 +15,16 @@ set(IGDRCL_SRCS_tests_device
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device_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
|
||||
|
|
|
@ -119,9 +119,9 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
|
|||
EXPECT_NE(nullptr, caps.builtInKernels);
|
||||
|
||||
std::string strDriverName = caps.name;
|
||||
std::string strFamilyName = familyName[device->getRenderCoreFamily()];
|
||||
std::string strDeviceName = device->getClDeviceName(*defaultHwInfo.get());
|
||||
|
||||
EXPECT_NE(std::string::npos, strDriverName.find(strFamilyName));
|
||||
EXPECT_NE(std::string::npos, strDriverName.find(strDeviceName));
|
||||
|
||||
EXPECT_NE(nullptr, caps.name);
|
||||
EXPECT_NE(nullptr, caps.vendor);
|
||||
|
@ -1246,9 +1246,7 @@ TEST_F(DeviceGetCapsTest, givenSystemWithNoDriverInfoWhenGettingNameAndVersionTh
|
|||
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
|
||||
std::string tempName = "Intel(R) ";
|
||||
tempName += familyName[defaultHwInfo->platform.eRenderCoreFamily];
|
||||
tempName += " HD Graphics NEO";
|
||||
std::string tempName = device->getClDeviceName(*defaultHwInfo.get());
|
||||
|
||||
#define QTR(a) #a
|
||||
#define TOSTR(b) QTR(b)
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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 ";
|
||||
deviceName += 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 << defaultHwInfo->platform.usDeviceID << "]";
|
||||
EXPECT_STREQ(clDeviceName.str().c_str(), clDevice->getClDeviceName(*defaultHwInfo.get()).c_str());
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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 << defaultHwInfo->platform.usDeviceID << "]";
|
||||
EXPECT_STREQ(clDeviceName.str().c_str(), clDevice->getClDeviceName(*defaultHwInfo.get()).c_str());
|
||||
}
|
|
@ -32,6 +32,7 @@ class MockClDevice : public ClDevice {
|
|||
using ClDevice::deviceInfo;
|
||||
using ClDevice::driverInfo;
|
||||
using ClDevice::enabledClVersion;
|
||||
using ClDevice::getClDeviceName;
|
||||
using ClDevice::initializeCaps;
|
||||
using ClDevice::name;
|
||||
using ClDevice::ocl21FeaturesEnabled;
|
||||
|
|
|
@ -17,5 +17,15 @@ set(NEO_CORE_DEVICE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.h
|
||||
)
|
||||
|
||||
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()
|
||||
|
|
|
@ -66,6 +66,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||
Debugger *getDebugger() { return getRootDeviceEnvironment().debugger.get(); }
|
||||
NEO::SourceLevelDebugger *getSourceLevelDebugger();
|
||||
const std::vector<EngineControl> &getEngines() const;
|
||||
const std::string getDeviceName(const HardwareInfo &hwInfo) const;
|
||||
|
||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||
const RootDeviceEnvironment &getRootDeviceEnvironment() const { return *executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]; }
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* 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 ";
|
||||
deviceName += familyName[hwInfo.platform.eRenderCoreFamily];
|
||||
return deviceName;
|
||||
}
|
||||
} // namespace NEO
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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
|
Loading…
Reference in New Issue