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);
|
memset(pDeviceProperties->name, 0, ZE_MAX_DEVICE_NAME);
|
||||||
std::string name = "Intel(R) ";
|
|
||||||
name += NEO::familyName[hardwareInfo.platform.eRenderCoreFamily];
|
std::string name = getNEODevice()->getDeviceName(hardwareInfo);
|
||||||
name += '\0';
|
|
||||||
memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length());
|
memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length());
|
||||||
|
|
||||||
return ZE_RESULT_SUCCESS;
|
return ZE_RESULT_SUCCESS;
|
||||||
|
|
|
@ -130,6 +130,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
||||||
void initializeOpenclCAllVersions();
|
void initializeOpenclCAllVersions();
|
||||||
void initializeOsSpecificCaps();
|
void initializeOsSpecificCaps();
|
||||||
void setupFp64Flags();
|
void setupFp64Flags();
|
||||||
|
const std::string getClDeviceName(const HardwareInfo &hwInfo) const;
|
||||||
|
|
||||||
Device &device;
|
Device &device;
|
||||||
std::vector<std::unique_ptr<ClDevice>> subDevices;
|
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/device/device_info.h"
|
||||||
#include "shared/source/helpers/basic_math.h"
|
#include "shared/source/helpers/basic_math.h"
|
||||||
#include "shared/source/helpers/hw_helper.h"
|
#include "shared/source/helpers/hw_helper.h"
|
||||||
|
@ -71,10 +72,7 @@ void ClDevice::initializeCaps() {
|
||||||
|
|
||||||
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
||||||
|
|
||||||
// Add our graphics family name to the device name
|
name = getClDeviceName(hwInfo);
|
||||||
name += "Intel(R) ";
|
|
||||||
name += familyName[hwInfo.platform.eRenderCoreFamily];
|
|
||||||
name += " HD Graphics NEO";
|
|
||||||
|
|
||||||
if (driverInfo) {
|
if (driverInfo) {
|
||||||
name.assign(driverInfo.get()->getDeviceName(name).c_str());
|
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
|
} // namespace NEO
|
||||||
|
|
|
@ -15,6 +15,16 @@ set(IGDRCL_SRCS_tests_device
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device_tests.cpp
|
${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)
|
if(WIN32)
|
||||||
list(APPEND IGDRCL_SRCS_tests_device
|
list(APPEND IGDRCL_SRCS_tests_device
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/device_win_timers_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/device_win_timers_tests.cpp
|
||||||
|
|
|
@ -119,9 +119,9 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
|
||||||
EXPECT_NE(nullptr, caps.builtInKernels);
|
EXPECT_NE(nullptr, caps.builtInKernels);
|
||||||
|
|
||||||
std::string strDriverName = caps.name;
|
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.name);
|
||||||
EXPECT_NE(nullptr, caps.vendor);
|
EXPECT_NE(nullptr, caps.vendor);
|
||||||
|
@ -1246,9 +1246,7 @@ TEST_F(DeviceGetCapsTest, givenSystemWithNoDriverInfoWhenGettingNameAndVersionTh
|
||||||
|
|
||||||
const auto &caps = device->getDeviceInfo();
|
const auto &caps = device->getDeviceInfo();
|
||||||
|
|
||||||
std::string tempName = "Intel(R) ";
|
std::string tempName = device->getClDeviceName(*defaultHwInfo.get());
|
||||||
tempName += familyName[defaultHwInfo->platform.eRenderCoreFamily];
|
|
||||||
tempName += " HD Graphics NEO";
|
|
||||||
|
|
||||||
#define QTR(a) #a
|
#define QTR(a) #a
|
||||||
#define TOSTR(b) QTR(b)
|
#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::deviceInfo;
|
||||||
using ClDevice::driverInfo;
|
using ClDevice::driverInfo;
|
||||||
using ClDevice::enabledClVersion;
|
using ClDevice::enabledClVersion;
|
||||||
|
using ClDevice::getClDeviceName;
|
||||||
using ClDevice::initializeCaps;
|
using ClDevice::initializeCaps;
|
||||||
using ClDevice::name;
|
using ClDevice::name;
|
||||||
using ClDevice::ocl21FeaturesEnabled;
|
using ClDevice::ocl21FeaturesEnabled;
|
||||||
|
|
|
@ -17,5 +17,15 @@ set(NEO_CORE_DEVICE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.h
|
${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})
|
set_property(GLOBAL PROPERTY NEO_CORE_DEVICE ${NEO_CORE_DEVICE})
|
||||||
add_subdirectories()
|
add_subdirectories()
|
||||||
|
|
|
@ -66,6 +66,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||||
Debugger *getDebugger() { return getRootDeviceEnvironment().debugger.get(); }
|
Debugger *getDebugger() { return getRootDeviceEnvironment().debugger.get(); }
|
||||||
NEO::SourceLevelDebugger *getSourceLevelDebugger();
|
NEO::SourceLevelDebugger *getSourceLevelDebugger();
|
||||||
const std::vector<EngineControl> &getEngines() const;
|
const std::vector<EngineControl> &getEngines() const;
|
||||||
|
const std::string getDeviceName(const HardwareInfo &hwInfo) const;
|
||||||
|
|
||||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||||
const RootDeviceEnvironment &getRootDeviceEnvironment() const { return *executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]; }
|
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