From b045fe1f9816aea483ee22a194ce3e17e7687fc9 Mon Sep 17 00:00:00 2001 From: Vladimir Paramuzov Date: Tue, 18 Apr 2023 09:16:47 +0400 Subject: [PATCH] [GPU] Added try/catch for device detection loop to skip platforms which throw an exception --- .../src/runtime/ocl/ocl_device_detector.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device_detector.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device_detector.cpp index e5d8fe0cb869e9..e5dd320dfae22c 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device_detector.cpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device_detector.cpp @@ -197,12 +197,18 @@ std::vector ocl_device_detector::create_device_list() const { for (auto& id : platform_ids) { cl::Platform platform = cl::Platform(id); - std::vector devices; - platform.getDevices(CL_DEVICE_TYPE_ALL, &devices); - for (auto& device : devices) { - if (!does_device_match_config(device)) - continue; - supported_devices.emplace_back(std::make_shared(device, cl::Context(device), id)); + try { + std::vector devices; + platform.getDevices(CL_DEVICE_TYPE_ALL, &devices); + for (auto& device : devices) { + if (!does_device_match_config(device)) + continue; + supported_devices.emplace_back(std::make_shared(device, cl::Context(device), id)); + } + } catch (std::exception& ex) { + GPU_DEBUG_LOG << "Devices query/creation failed for " << platform.getInfo() << ": " << ex.what() << std::endl; + GPU_DEBUG_LOG << "Platform is skipped" << std::endl; + continue; } } OPENVINO_ASSERT(!supported_devices.empty(), create_device_error_msg);