mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 21:42:53 +08:00
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:
committed by
Compute-Runtime-Automation
parent
e8b0024b5c
commit
91a9b925f7
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user