File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,19 @@ namespace ur_loader {
17
17
context_t *getContext () { return context_t::get_direct (); }
18
18
19
19
ur_result_t context_t::init () {
20
+ #ifdef _WIN32
21
+ // Suppress system errors.
22
+ // Tells the system to not display the critical-error-handler message box.
23
+ // Instead, the system sends the error to the calling process.
24
+ // This is crucial for graceful handling of plugins that couldn't be
25
+ // loaded, e.g. due to missing native run-times.
26
+ // Sometimes affects L0 or the unified runtime.
27
+ // TODO: add reporting in case of an error.
28
+ // NOTE: we restore the old mode to not affect user app behavior.
29
+ // See https://github.com/intel/llvm/blob/sycl/sycl/ur_win_proxy_loader/ur_win_proxy_loader.cpp (preloadLibraries())
30
+ UINT SavedMode = SetErrorMode (SEM_FAILCRITICALERRORS);
31
+ #endif
32
+
20
33
#ifdef UR_STATIC_ADAPTER_LEVEL_ZERO
21
34
// If the adapters were force loaded, it means the user wants to use
22
35
// a specific adapter library. Don't load any static adapters.
@@ -35,6 +48,10 @@ ur_result_t context_t::init() {
35
48
}
36
49
}
37
50
}
51
+ #ifdef _WIN32
52
+ // Restore system error handling.
53
+ (void )SetErrorMode (SavedMode);
54
+ #endif
38
55
39
56
forceIntercept = getenv_tobool (" UR_ENABLE_LOADER_INTERCEPT" );
40
57
You can’t perform that action at this time.
0 commit comments