mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
Add debug variable to override device name
This commit introduces debug variable to override device name reported by CL_DEVICE_NAME property in OpenCL and ze_device_properties_t.name in level_zero Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e7e1e64cca
commit
d9858bf206
@@ -656,7 +656,9 @@ 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 = getNEODevice()->getDeviceInfo().name;
|
std::string name = getNEODevice()->getDeviceInfo().name;
|
||||||
if (driverInfo) {
|
if (NEO::DebugManager.flags.OverrideDeviceName.get() != "unk") {
|
||||||
|
name.assign(NEO::DebugManager.flags.OverrideDeviceName.get().c_str());
|
||||||
|
} else if (driverInfo) {
|
||||||
name.assign(driverInfo->getDeviceName(name).c_str());
|
name.assign(driverInfo->getDeviceName(name).c_str());
|
||||||
}
|
}
|
||||||
memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length());
|
memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length());
|
||||||
|
|||||||
@@ -1016,6 +1016,20 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDriverInfoIsNotEmptyThenDev
|
|||||||
EXPECT_STRNE(deviceProperties.name, name.c_str());
|
EXPECT_STRNE(deviceProperties.name, name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDebugVariableOverrideDeviceNameIsSpecifiedThenDeviceNameIsTakenFromDebugVariable) {
|
||||||
|
DebugManagerStateRestore restore;
|
||||||
|
const std::string testDeviceName = "test device name";
|
||||||
|
DebugManager.flags.OverrideDeviceName.set(testDeviceName);
|
||||||
|
|
||||||
|
auto deviceImp = static_cast<DeviceImp *>(device);
|
||||||
|
ze_device_properties_t deviceProperties{};
|
||||||
|
auto name = device->getNEODevice()->getDeviceInfo().name;
|
||||||
|
deviceImp->driverInfo.reset();
|
||||||
|
deviceImp->getProperties(&deviceProperties);
|
||||||
|
EXPECT_STRNE(deviceProperties.name, name.c_str());
|
||||||
|
EXPECT_STREQ(deviceProperties.name, testDeviceName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DeviceTest, WhenGettingDevicePropertiesThenSubslicesPerSliceIsBasedOnSubslicesSupported) {
|
TEST_F(DeviceTest, WhenGettingDevicePropertiesThenSubslicesPerSliceIsBasedOnSubslicesSupported) {
|
||||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||||
deviceProperties.type = ZE_DEVICE_TYPE_GPU;
|
deviceProperties.type = ZE_DEVICE_TYPE_GPU;
|
||||||
|
|||||||
@@ -75,10 +75,16 @@ void ClDevice::initializeCaps() {
|
|||||||
|
|
||||||
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
||||||
|
|
||||||
name = getClDeviceName(hwInfo);
|
if (DebugManager.flags.OverrideDeviceName.get() != "unk") {
|
||||||
|
name.assign(DebugManager.flags.OverrideDeviceName.get().c_str());
|
||||||
|
} else {
|
||||||
|
name = getClDeviceName(hwInfo);
|
||||||
|
if (driverInfo) {
|
||||||
|
name.assign(driverInfo->getDeviceName(name).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (driverInfo) {
|
if (driverInfo) {
|
||||||
name.assign(driverInfo->getDeviceName(name).c_str());
|
|
||||||
driverVersion.assign(driverInfo->getVersion(driverVersion).c_str());
|
driverVersion.assign(driverInfo->getVersion(driverVersion).c_str());
|
||||||
sharingFactory.verifyExtensionSupport(driverInfo.get());
|
sharingFactory.verifyExtensionSupport(driverInfo.get());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1139,6 +1139,25 @@ TEST_F(DeviceGetCapsTest, givenSystemWithDriverInfoWhenGettingNameAndVersionThen
|
|||||||
EXPECT_STREQ(testVersion.c_str(), caps.driverVersion);
|
EXPECT_STREQ(testVersion.c_str(), caps.driverVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DeviceGetCapsTest, givenSystemWithDriverInfoWhenDebugVariableOverrideDeviceNameIsSpecifiedThenDeviceNameIsTakenFromDebugVariable) {
|
||||||
|
DebugManagerStateRestore restore;
|
||||||
|
const std::string testDeviceName = "testDeviceName";
|
||||||
|
const std::string debugDeviceName = "debugDeviceName";
|
||||||
|
DebugManager.flags.OverrideDeviceName.set(debugDeviceName);
|
||||||
|
|
||||||
|
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||||
|
DriverInfoMock *driverInfoMock = new DriverInfoMock();
|
||||||
|
driverInfoMock->setDeviceName(testDeviceName);
|
||||||
|
|
||||||
|
device->driverInfo.reset(driverInfoMock);
|
||||||
|
device->initializeCaps();
|
||||||
|
|
||||||
|
const auto &caps = device->getDeviceInfo();
|
||||||
|
|
||||||
|
EXPECT_STRNE(testDeviceName.c_str(), caps.name);
|
||||||
|
EXPECT_STREQ(debugDeviceName.c_str(), caps.name);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DeviceGetCapsTest, givenNoPciBusInfoThenPciBusInfoExtensionNotAvailable) {
|
TEST_F(DeviceGetCapsTest, givenNoPciBusInfoThenPciBusInfoExtensionNotAvailable) {
|
||||||
const PhysicalDevicePciBusInfo pciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue);
|
const PhysicalDevicePciBusInfo pciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue);
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, UseContextEndOffsetForEventCompletion, -1, "Use
|
|||||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceWddmLowPriorityContextValue, -1, "Force scheduling priority value during Wddm low priority context creation. -1 - default.")
|
DECLARE_DEBUG_VARIABLE(int32_t, ForceWddmLowPriorityContextValue, -1, "Force scheduling priority value during Wddm low priority context creation. -1 - default.")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, FailBuildProgramWithStatefulAccess, -1, "-1: default, 0: disable, 1: enable, Fail build program/module creation whenever stateful access is discovered (except built in kernels).")
|
DECLARE_DEBUG_VARIABLE(int32_t, FailBuildProgramWithStatefulAccess, -1, "-1: default, 0: disable, 1: enable, Fail build program/module creation whenever stateful access is discovered (except built in kernels).")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, DisableScratchPages, false, "Disable scratch pages during VM creations")
|
DECLARE_DEBUG_VARIABLE(bool, DisableScratchPages, false, "Disable scratch pages during VM creations")
|
||||||
|
DECLARE_DEBUG_VARIABLE(std::string, OverrideDeviceName, std::string("unk"), "Device name to override")
|
||||||
/*LOGGING FLAGS*/
|
/*LOGGING FLAGS*/
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")
|
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, PrintOsContextInitializations, false, "print initialized OsContexts to standard output")
|
DECLARE_DEBUG_VARIABLE(bool, PrintOsContextInitializations, false, "print initialized OsContexts to standard output")
|
||||||
|
|||||||
@@ -423,4 +423,5 @@ EnableTimestampWaitForEvents = -1
|
|||||||
ForceWddmLowPriorityContextValue = -1
|
ForceWddmLowPriorityContextValue = -1
|
||||||
EnableDebuggerMmapMemoryAccess = 0
|
EnableDebuggerMmapMemoryAccess = 0
|
||||||
FailBuildProgramWithStatefulAccess = -1
|
FailBuildProgramWithStatefulAccess = -1
|
||||||
ForceUncachedGmmUsageType = 0
|
ForceUncachedGmmUsageType = 0
|
||||||
|
OverrideDeviceName = unk
|
||||||
|
|||||||
Reference in New Issue
Block a user