From 99544d2a43bef0fe4ddc08c94b1389464638a425 Mon Sep 17 00:00:00 2001 From: Mingyu Kim Date: Mon, 18 Oct 2021 15:44:46 +0900 Subject: [PATCH] [GPU] Improve opencl compile error message (#8032) Show some details on error message by parsing "error" in the message. --- .../thirdparty/clDNN/runtime/kernels_cache.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp index 9a8189098e0..89224a91b3b 100644 --- a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp @@ -377,8 +377,24 @@ void kernels_cache::build_batch(const engine& build_engine, const batch_program& if (!err_log.empty()) { GPU_DEBUG_GET_INSTANCE(debug_config); GPU_DEBUG_IF(debug_config->verbose) { + std::cout << "-------- OpenCL build error" << std::endl; std::cout << err_log << std::endl; + std::cout << "-------- End of OpenCL build error" << std::endl; } + std::stringstream err_ss(err_log); + std::string line; + int cnt = 0; + + while (std::getline(err_ss, line, '\n')) { + if (line.find("error") != std::string::npos) + cnt = 5; + cnt--; + if (cnt > 0) + std::cout << line << std::endl; + else if (cnt == 0) + std::cout << "...." << std::endl; + } + throw std::runtime_error("Program build failed. You may enable OCL source dump to see the error log.\n"); } }