From 31291b1cf00de67b4c083a3eccccf1b5e9b1481a Mon Sep 17 00:00:00 2001 From: Jaime Arteaga Date: Tue, 20 Oct 2020 15:33:41 -0700 Subject: [PATCH] Add 4-digit zero alignment of device id in device name (2) Unify names for OpenCL and L0 Related-To: NEO-4744 Change-Id: I5094f228f447ecbd942c25d6244abee593f3ffbf Signed-off-by: Jaime Arteaga --- level_zero/core/source/device/device_imp.cpp | 2 +- opencl/source/cl_device/cl_device_caps.cpp | 8 +------- shared/source/device/device_caps.cpp | 9 +++++++++ shared/source/device/device_info.h | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index c7835db4f8..ec748df6a5 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -394,7 +394,7 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties) memset(pDeviceProperties->name, 0, ZE_MAX_DEVICE_NAME); - std::string name = getNEODevice()->getDeviceName(hardwareInfo); + std::string name = getNEODevice()->getDeviceInfo().name; memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length()); return ZE_RESULT_SUCCESS; diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index c6266d0e6a..b0507f1b7e 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -19,7 +19,6 @@ #include "driver_version.h" -#include #include namespace NEO { @@ -434,12 +433,7 @@ void ClDevice::initializeOpenclCAllVersions() { } const std::string ClDevice::getClDeviceName(const HardwareInfo &hwInfo) const { - std::stringstream deviceName; - - deviceName << device.getDeviceName(hwInfo); - deviceName << " [0x" << std::hex << std::setw(4) << std::setfill('0') << hwInfo.platform.usDeviceID << "]"; - - return deviceName.str(); + return this->getDevice().getDeviceInfo().name; } } // namespace NEO diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index 782d7a6450..0974689a86 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -12,6 +12,8 @@ #include "shared/source/memory_manager/memory_manager.h" #include "shared/source/os_interface/hw_info_config.h" +#include + namespace NEO { static const char *spirvWithVersion = "SPIR-V_1.2 "; @@ -118,6 +120,13 @@ void Device::initializeCaps() { if (DebugManager.flags.EnableSharedSystemUsmSupport.get() != -1) { deviceInfo.sharedSystemAllocationsSupport = DebugManager.flags.EnableSharedSystemUsmSupport.get(); } + + std::stringstream deviceName; + + deviceName << this->getDeviceName(hwInfo); + deviceName << " [0x" << std::hex << std::setw(4) << std::setfill('0') << hwInfo.platform.usDeviceID << "]"; + + deviceInfo.name = deviceName.str(); } } // namespace NEO diff --git a/shared/source/device/device_info.h b/shared/source/device/device_info.h index 96c32b0e4e..d76439915c 100644 --- a/shared/source/device/device_info.h +++ b/shared/source/device/device_info.h @@ -47,6 +47,7 @@ struct DeviceInfo { bool debuggerActive; bool force32BitAddressess; bool sharedSystemAllocationsSupport; + std::string name; }; } // namespace NEO