File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,18 @@ context_t *getContext() { return context_t::get_direct(); }
1515
1616// /////////////////////////////////////////////////////////////////////////////
1717ur_result_t context_t::init () {
18+ #ifdef _WIN32
19+ // Suppress system errors.
20+ // Tells the system to not display the critical-error-handler message box.
21+ // Instead, the system sends the error to the calling process.
22+ // This is crucial for graceful handling of plugins that couldn't be
23+ // loaded, e.g. due to missing native run-times.
24+ // Sometimes affects L0 or the unified runtime.
25+ // TODO: add reporting in case of an error.
26+ // NOTE: we restore the old mode to not affect user app behavior.
27+ // See https://github.com/intel/llvm/blob/sycl/sycl/ur_win_proxy_loader/ur_win_proxy_loader.cpp (preloadLibraries())
28+ UINT SavedMode = SetErrorMode (SEM_FAILCRITICALERRORS);
29+ #endif
1830 for (const auto &adapterPaths : adapter_registry) {
1931 for (const auto &path : adapterPaths) {
2032 auto handle = LibLoader::loadAdapterLibrary (path.string ().c_str ());
@@ -24,6 +36,10 @@ ur_result_t context_t::init() {
2436 }
2537 }
2638 }
39+ #ifdef _WIN32
40+ // Restore system error handling.
41+ (void )SetErrorMode (SavedMode);
42+ #endif
2743
2844 forceIntercept = getenv_tobool (" UR_ENABLE_LOADER_INTERCEPT" );
2945
You can’t perform that action at this time.
0 commit comments