diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 6acc77cfcd1b1..395b5c27a3d71 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -83,6 +83,7 @@ Device::Device(const HardwareInfo &hwInfo, osTime(nullptr), slmWindowStartAddress(nullptr) { memset(&deviceInfo, 0, sizeof(deviceInfo)); deviceExtensions.reserve(1000); + name.reserve(100); preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); engineType = DebugManager.flags.NodeOrdinal.get() == -1 ? hwInfo.capabilityTable.defaultEngineType diff --git a/runtime/device/device.h b/runtime/device/device.h index cde8378370eb1..86499affa30c1 100644 --- a/runtime/device/device.h +++ b/runtime/device/device.h @@ -134,6 +134,7 @@ class Device : public BaseObject<_cl_device_id> { MOCKABLE_VIRTUAL const WhitelistedRegisters &getWhitelistedRegisters() { return hwInfo.capabilityTable.whitelistedRegisters; } std::vector simultaneousInterops; std::string deviceExtensions; + std::string name; bool getEnabled64kbPages(); bool isSourceLevelDebuggerActive() const; SourceLevelDebugger *getSourceLevelDebugger() { return sourceLevelDebugger.get(); } diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 4b900622cd4a2..f035743067482 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -40,7 +40,6 @@ namespace OCLRT { extern const char *familyName[]; -static std::string name(128, '\0'); static std::string vendor = "Intel(R) Corporation"; static std::string profile = "FULL_PROFILE"; static std::string spirVersions = "1.2 "; @@ -99,17 +98,15 @@ void Device::initializeCaps() { if (is32bit) { addressing32bitAllowed = false; } - std::string tempName = "Intel(R) "; - tempName += familyName[hwInfo.pPlatform->eRenderCoreFamily]; - tempName += " HD Graphics NEO"; - - DEBUG_BREAK_IF(tempName.size() > name.size()); - name = tempName; driverVersion = TOSTR(NEO_DRIVER_VERSION); + name += "Intel(R) "; + name += familyName[hwInfo.pPlatform->eRenderCoreFamily]; + name += " HD Graphics NEO"; + if (driverInfo) { - name.assign(driverInfo.get()->getDeviceName(tempName).c_str()); + name.assign(driverInfo.get()->getDeviceName(name).c_str()); driverVersion.assign(driverInfo.get()->getVersion(driverVersion).c_str()); } diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index f052117e616ea..564168b9ba80a 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -84,6 +84,7 @@ TEST(Device_GetCaps, validate) { std::string strDriverName = caps.name; std::string strFamilyName = familyName[device->getRenderCoreFamily()]; + EXPECT_NE(std::string::npos, strDriverName.find(strFamilyName)); EXPECT_NE(nullptr, caps.name); @@ -720,6 +721,7 @@ TEST(Device_GetCaps, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenRet auto device = Device::create(platformDevices[0]); device->setDriverInfo(nullptr); + device->name.clear(); device->initializeCaps(); const auto &caps = device->getDeviceInfo();