[IE CLDNN] Added is_discrete flag into device info and FULL_DEVICE_NAME flag (#2089)
authorVladimir Paramuzov <vladimir.paramuzov@intel.com>
Tue, 8 Sep 2020 06:56:54 +0000 (09:56 +0300)
committerGitHub <noreply@github.com>
Tue, 8 Sep 2020 06:56:54 +0000 (09:56 +0300)
inference-engine/src/cldnn_engine/cldnn_engine.cpp
inference-engine/thirdparty/clDNN/api/device.hpp
inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp
inference-engine/thirdparty/clDNN/src/gpu/device_info.h
inference-engine/thirdparty/clDNN/src/gpu/ocl_toolkit.cpp

index 954d49f..14effa2 100644 (file)
@@ -578,7 +578,9 @@ Parameter clDNNEngine::GetMetric(const std::string& name, const std::map<std::st
             availableDevices.push_back(dev.first);
         IE_SET_METRIC_RETURN(AVAILABLE_DEVICES, availableDevices);
     } else if (name == METRIC_KEY(FULL_DEVICE_NAME)) {
-        IE_SET_METRIC_RETURN(FULL_DEVICE_NAME, StringRightTrim(device_info.dev_name, "NEO", false));
+        auto deviceName = StringRightTrim(device_info.dev_name, "NEO", false);
+        deviceName += std::string(" (") + (device_info.dev_type == cldnn::device_type::discrete_gpu ? "dGPU" : "iGPU") + ")";
+        IE_SET_METRIC_RETURN(FULL_DEVICE_NAME, deviceName);
     } else if (name == METRIC_KEY(SUPPORTED_CONFIG_KEYS)) {
         std::vector<std::string> configKeys;
         for (auto opt : _impl->m_config.key_config_map)
index 7e49aa0..4789324 100644 (file)
@@ -29,6 +29,12 @@ namespace cldnn {
 /// @defgroup cpp_device GPU Device
 /// @{
 
+/// @brief Enumeration of supported device types
+enum class device_type {
+    integrated_gpu = 0,
+    discrete_gpu = 1
+};
+
 /// @brief Information about the device properties and capabilities.
 struct device_info {
     uint32_t cores_count;     ///< Number of available HW cores.
@@ -55,6 +61,8 @@ struct device_info {
 
     std::string dev_name;     ///< Device ID string
     std::string driver_version;  ///< Version of OpenCL driver
+
+    device_type dev_type;  ///< Defines type of current GPU device (integrated or discrete)
 };
 
 struct device_impl;
index 1fc851d..8383fdf 100644 (file)
@@ -117,15 +117,20 @@ int driver_dev_id()
         return result.back();
 }
 
-bool get_imad_support(const cl::Device& device) {
+static device_type get_device_type(const cl::Device& device) {
+    auto unified_mem = device.getInfo<CL_DEVICE_HOST_UNIFIED_MEMORY>();
+
+    return unified_mem ? device_type::integrated_gpu : device_type::discrete_gpu;
+}
+
+static bool get_imad_support(const cl::Device& device) {
     std::string dev_name = device.getInfo<CL_DEVICE_NAME>();
 
     if (dev_name.find("Gen12") != std::string::npos ||
         dev_name.find("Xe") != std::string::npos)
         return true;
 
-    auto flag = device.getInfo<CL_DEVICE_HOST_UNIFIED_MEMORY>();
-    if (flag != 0) {
+    if (get_device_type(device) == device_type::integrated_gpu) {
         const std::vector<int> imad_ids = {
             0x9A40, 0x9A49, 0x9A59, 0x9AD9,
             0x9A60, 0x9A68, 0x9A70, 0x9A78,
@@ -189,6 +194,7 @@ bool is_local_block_io_supported(const cl::Device& device) {
 device_info_internal::device_info_internal(const cl::Device& device) {
     dev_name = device.getInfo<CL_DEVICE_NAME>();
     driver_version = device.getInfo<CL_DRIVER_VERSION>();
+    dev_type = get_device_type(device);
 
     compute_units_count = device.getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>();
 
@@ -220,7 +226,6 @@ device_info_internal::device_info_internal(const cl::Device& device) {
     supports_imad = get_imad_support(device);
     supports_immad = false;
 
-    dev_type = static_cast<uint32_t>(device.getInfo<CL_DEVICE_TYPE>());
     vendor_id = static_cast<uint32_t>(device.getInfo<CL_DEVICE_VENDOR_ID>());
 
     supports_usm = extensions.find("cl_intel_unified_shared_memory") != std::string::npos;
index 076bf76..9fb804b 100644 (file)
@@ -26,7 +26,6 @@ namespace gpu {
 
 struct device_info_internal : cldnn::device_info {
     std::uint32_t compute_units_count;
-    uint32_t dev_type;
     uint32_t vendor_id;
     uint8_t supports_usm;
     bool supports_optimization_hints;
@@ -51,7 +50,8 @@ struct device_info_internal : cldnn::device_info {
          supports_immad,
          supports_usm,
          dev_name,
-         driver_version
+         driver_version,
+         dev_type
         };
     }
 };
index dc8ea53..0d1f2d3 100644 (file)
@@ -117,7 +117,6 @@ gpu_toolkit::gpu_toolkit(const device_impl& device_impl, const configuration& co
                    << "    profiling: " << std::boolalpha << _configuration.enable_profiling << "\n"
                    << "    meaningful names: " << std::boolalpha << _configuration.meaningful_kernels_names << "\n"
                    << "    dump custom program: " << std::boolalpha << _configuration.dump_custom_program << "\n"
-                   << "    device type: " << std::to_string(device_info.dev_type) << "\n"
                    << "    vendor type: " << std::hex << std::setfill('0') << std::setw(4) << std::right
                    << std::to_string(device_info.vendor_id) << "\n"
                    << std::dec << std::setfill(' ') << std::right