Skip to content

Commit

Permalink
Move device name to device scope.
Browse files Browse the repository at this point in the history
Change-Id: If7df4c8f97fa6b0c6f9449ae6802386c639241c2
  • Loading branch information
MichalMrozek authored and Compute-Runtime-Automation committed Jun 21, 2018
1 parent ca87805 commit 3e65a39
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions runtime/device/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions runtime/device/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class Device : public BaseObject<_cl_device_id> {
MOCKABLE_VIRTUAL const WhitelistedRegisters &getWhitelistedRegisters() { return hwInfo.capabilityTable.whitelistedRegisters; }
std::vector<unsigned int> simultaneousInterops;
std::string deviceExtensions;
std::string name;
bool getEnabled64kbPages();
bool isSourceLevelDebuggerActive() const;
SourceLevelDebugger *getSourceLevelDebugger() { return sourceLevelDebugger.get(); }
Expand Down
13 changes: 5 additions & 8 deletions runtime/device/device_caps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ";
Expand Down Expand Up @@ -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());
}

Expand Down
2 changes: 2 additions & 0 deletions unit_tests/device/device_caps_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -720,6 +721,7 @@ TEST(Device_GetCaps, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenRet
auto device = Device::create<OCLRT::MockDevice>(platformDevices[0]);

device->setDriverInfo(nullptr);
device->name.clear();
device->initializeCaps();

const auto &caps = device->getDeviceInfo();
Expand Down

0 comments on commit 3e65a39

Please sign in to comment.