File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,18 @@ 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 adapters that couldn't be
25
+ // loaded, e.g. due to missing native run-times.
26
+ // TODO: add reporting in case of an error.
27
+ // NOTE: we restore the old mode to not affect user app behavior.
28
+ // See https://github.com/intel/llvm/blob/sycl/sycl/ur_win_proxy_loader/ur_win_proxy_loader.cpp (preloadLibraries())
29
+ UINT SavedMode = SetErrorMode (SEM_FAILCRITICALERRORS);
30
+ #endif
31
+
20
32
#ifdef UR_STATIC_ADAPTER_LEVEL_ZERO
21
33
// If the adapters were force loaded, it means the user wants to use
22
34
// a specific adapter library. Don't load any static adapters.
@@ -35,6 +47,10 @@ ur_result_t context_t::init() {
35
47
}
36
48
}
37
49
}
50
+ #ifdef _WIN32
51
+ // Restore system error handling.
52
+ (void )SetErrorMode (SavedMode);
53
+ #endif
38
54
39
55
forceIntercept = getenv_tobool (" UR_ENABLE_LOADER_INTERCEPT" );
40
56
You can’t perform that action at this time.
0 commit comments