fix: Append device id to ambigous device names
Related-To: NEO-7537 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
e8b0024b5c
commit
91a9b925f7
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -136,7 +136,7 @@ void LinuxGlobalOperationsImp::getBrandName(char (&brandName)[ZES_STRING_PROPERT
|
|||
|
||||
void LinuxGlobalOperationsImp::getModelName(char (&modelName)[ZES_STRING_PROPERTY_SIZE]) {
|
||||
NEO::Device *neoDevice = pDevice->getNEODevice();
|
||||
std::string deviceModelName = neoDevice->getDeviceName(neoDevice->getHardwareInfo());
|
||||
std::string deviceModelName = neoDevice->getDeviceName();
|
||||
std::strncpy(modelName, deviceModelName.c_str(), ZES_STRING_PROPERTY_SIZE);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class SysmanGlobalOperationsFixture : public SysmanDeviceFixture {
|
|||
pGlobalOperationsImp = static_cast<L0::GlobalOperationsImp *>(pSysmanDeviceImp->pGlobalOperations);
|
||||
pOsGlobalOperationsPrev = pGlobalOperationsImp->pOsGlobalOperations;
|
||||
pGlobalOperationsImp->pOsGlobalOperations = nullptr;
|
||||
expectedModelName = neoDevice->getDeviceName(neoDevice->getHardwareInfo());
|
||||
expectedModelName = neoDevice->getDeviceName();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
|
|
@ -139,7 +139,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
|||
void initializeOpenclCAllVersions();
|
||||
void initializeOsSpecificCaps();
|
||||
void setupFp64Flags();
|
||||
const std::string getClDeviceName(const HardwareInfo &hwInfo) const;
|
||||
const std::string getClDeviceName() const;
|
||||
|
||||
Device &device;
|
||||
ClDevice &rootClDevice;
|
||||
|
|
|
@ -79,7 +79,7 @@ void ClDevice::initializeCaps() {
|
|||
if (DebugManager.flags.OverrideDeviceName.get() != "unk") {
|
||||
name.assign(DebugManager.flags.OverrideDeviceName.get().c_str());
|
||||
} else {
|
||||
name = getClDeviceName(hwInfo);
|
||||
name = getClDeviceName();
|
||||
if (driverInfo) {
|
||||
name.assign(driverInfo->getDeviceName(name).c_str());
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ void ClDevice::initializeOpenclCAllVersions() {
|
|||
}
|
||||
}
|
||||
|
||||
const std::string ClDevice::getClDeviceName(const HardwareInfo &hwInfo) const {
|
||||
const std::string ClDevice::getClDeviceName() const {
|
||||
return this->getDevice().getDeviceInfo().name;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
|
|||
EXPECT_NE(nullptr, caps.builtInKernels);
|
||||
|
||||
std::string strDriverName = caps.name;
|
||||
std::string strDeviceName = device->getClDeviceName(*defaultHwInfo.get());
|
||||
std::string strDeviceName = device->getClDeviceName();
|
||||
|
||||
EXPECT_NE(std::string::npos, strDriverName.find(strDeviceName));
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ TEST_F(DeviceGetCapsTest, givenSystemWithNoDriverInfoWhenGettingNameAndVersionTh
|
|||
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
|
||||
std::string tempName = device->getClDeviceName(*defaultHwInfo.get());
|
||||
std::string tempName = device->getClDeviceName();
|
||||
|
||||
#define QTR(a) #a
|
||||
#define TOSTR(b) QTR(b)
|
||||
|
|
|
@ -16,21 +16,18 @@ using namespace NEO;
|
|||
|
||||
using DeviceNameTest = ::testing::Test;
|
||||
|
||||
TEST_F(DeviceNameTest, WhenCallingGetClDeviceNameThenReturnDeviceNameWithoutDeviceIdAppendedAtTheEnd) {
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
TEST_F(DeviceNameTest, WhenCallingGetClDeviceNameThenReturnDeviceNameFromBaseDevice) {
|
||||
{
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
|
||||
std::string deviceName = "Intel(R) Graphics";
|
||||
EXPECT_STREQ(deviceName.c_str(), clDevice->device.getDeviceName(*defaultHwInfo.get()).c_str());
|
||||
EXPECT_STREQ(clDevice->device.getDeviceName().c_str(), clDevice->getClDeviceName().c_str());
|
||||
}
|
||||
|
||||
EXPECT_STREQ(deviceName.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());
|
||||
{
|
||||
HardwareInfo localHwInfo = *defaultHwInfo;
|
||||
localHwInfo.capabilityTable.deviceName = "Custom Device";
|
||||
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
EXPECT_STREQ(clDevice->device.getDeviceName().c_str(), clDevice->getClDeviceName().c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||
NEO::SourceLevelDebugger *getSourceLevelDebugger();
|
||||
DebuggerL0 *getL0Debugger();
|
||||
const EnginesT &getAllEngines() const;
|
||||
const std::string getDeviceName(const HardwareInfo &hwInfo) const;
|
||||
const std::string getDeviceName() const;
|
||||
|
||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||
const RootDeviceEnvironment &getRootDeviceEnvironment() const;
|
||||
|
|
|
@ -184,7 +184,7 @@ void Device::initializeCaps() {
|
|||
this->preemptionMode = PreemptionMode::Disabled;
|
||||
}
|
||||
|
||||
deviceInfo.name = this->getDeviceName(hwInfo);
|
||||
deviceInfo.name = this->getDeviceName();
|
||||
|
||||
size_t maxParameterSizeFromIgc = getMaxParameterSizeFromIGC();
|
||||
if (maxParameterSizeFromIgc > 0) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -8,11 +8,23 @@
|
|||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
const std::string Device::getDeviceName(const HardwareInfo &hwInfo) const {
|
||||
return std::string(hwInfo.capabilityTable.deviceName).empty() ? "Intel(R) Graphics" : hwInfo.capabilityTable.deviceName;
|
||||
const std::string Device::getDeviceName() const {
|
||||
auto &hwInfo = this->getHardwareInfo();
|
||||
std::string deviceName = hwInfo.capabilityTable.deviceName;
|
||||
if (!deviceName.empty()) {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
std::stringstream deviceNameDefault;
|
||||
deviceNameDefault << "Intel(R) Graphics";
|
||||
deviceNameDefault << " [0x" << std::hex << std::setw(4) << std::setfill('0') << hwInfo.platform.usDeviceID << "]";
|
||||
|
||||
return deviceNameDefault.str();
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -55,6 +55,25 @@ TEST(Device, givenNoDebuggerWhenGettingDebuggerThenNullptrIsReturned) {
|
|||
EXPECT_EQ(nullptr, device->getSourceLevelDebugger());
|
||||
}
|
||||
|
||||
TEST(Device, givenDeviceWithBrandingStringNameWhenGettingDeviceNameThenBrandingStringIsReturned) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfo.capabilityTable.deviceName = "Custom Device";
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
||||
|
||||
EXPECT_STREQ("Custom Device", device->getDeviceName().c_str());
|
||||
}
|
||||
|
||||
TEST(Device, givenDeviceWithoutBrandingStringNameWhenGettingDeviceNameThenGenericNameWithHexadecimalDeviceIdIsReturned) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfo.capabilityTable.deviceName = "";
|
||||
hwInfo.platform.usDeviceID = 0x1AB;
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
||||
|
||||
EXPECT_STREQ("Intel(R) Graphics [0x01ab]", device->getDeviceName().c_str());
|
||||
}
|
||||
|
||||
using DeviceTest = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(DeviceTest, whenInitializeRayTracingIsCalledAndRtBackedBufferIsNullptrThenMemoryBackedBufferIsCreated) {
|
||||
|
|
Loading…
Reference in New Issue