[GPU] Disable threaded kernel compilation when running in Windows Store app (#18062)

This commit is contained in:
Patman11 authored and GitHub committed 2023-06-19 17:55:47 +04:00
1 parent 6143a4fa42
commit b9575d9586
1 file changed
+19 -2
@@ -15,6 +15,13 @@
#include "intel_gpu/runtime/itt.hpp"
#include "openvino/util/file_util.hpp"
#ifdef WIN32
#include <sdkddkver.h>
#ifdef NTDDI_WIN10_RS5
#include <appmodel.h>
#endif
#endif
#include <algorithm>
#include <cassert>
#include <sstream>
@@ -407,7 +414,17 @@ void kernels_cache::build_all() {
get_program_source(_kernels_code, &batches);
}
if (_task_executor) {
// build_batch crashes randomly when threaded while running from a Microsoft Store app
// it seems to be a bug in Intel's graphics driver, disabling threading is a work around
auto use_threads{true};
#if defined(WIN32) && defined(NTDDI_WIN10_RS5)
UINT32 length{0};
auto error_code{GetCurrentPackageFullName(&length, nullptr)};
// If we get this error, it means we're a regular desktop application, and we can use threads
use_threads = error_code == APPMODEL_ERROR_NO_PACKAGE;
#endif
if (_task_executor && use_threads) {
std::exception_ptr exception;
std::vector<InferenceEngine::Task> tasks;
for (size_t idx = 0; idx < batches.size(); idx++) {
@@ -415,7 +432,7 @@ void kernels_cache::build_all() {
tasks.push_back([this, &_build_engine, &batch, &exception] {
try {
build_batch(_build_engine, batch, _kernels);
} catch(...) {
} catch (...) {
exception = std::current_exception();
}
});