@@ -109,6 +109,8 @@ void *&getDllHandle() {
109
109
110
110
// / Load the adapter libraries
111
111
void preloadLibraries () {
112
+ std::cout << " ---> one\n "
113
+ << std::endl;
112
114
// Suppress system errors.
113
115
// Tells the system to not display the critical-error-handler message box.
114
116
// Instead, the system sends the error to the calling process.
@@ -119,44 +121,69 @@ void preloadLibraries() {
119
121
// NOTE: we restore the old mode to not affect user app behavior.
120
122
//
121
123
UINT SavedMode = SetErrorMode (SEM_FAILCRITICALERRORS);
124
+ std::cout << " ---> one point five \n "
125
+ << std::endl;
122
126
// Exclude current directory from DLL search path
123
127
if (!SetDllDirectory (L" " )) {
124
128
assert (false && " Failed to update DLL search path" );
125
129
}
126
-
130
+ std::cout << " ---> two\n "
131
+ << std::endl;
127
132
// this path duplicates sycl/detail/ur.cpp:initializeAdapters
128
133
std::filesystem::path LibSYCLDir (getCurrentDSODir ());
129
-
134
+ std::cout << " ---> three\n "
135
+ << std::endl;
130
136
// When searching for dependencies of the adapters limit the
131
137
// list of directories to %windows%\system32 and the directory that contains
132
138
// the loaded DLL (the adapter). This is necessary to avoid loading dlls from
133
139
// current directory and some other directories which are considered unsafe.
134
140
auto loadAdapter = [&](auto adapterName,
135
141
DWORD flags = LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
136
142
LOAD_LIBRARY_SEARCH_SYSTEM32) {
143
+ std::cout << " ---> NAME " << std::string (path.wstring ().c_str ()) << " \n "
144
+ << std::endl;
137
145
auto path = LibSYCLDir / adapterName;
138
146
return LoadLibraryEx (path.wstring ().c_str (), NULL , flags);
139
147
};
140
148
// We keep the UR Loader handle so it can be fetched by the runtime, but the
141
149
// adapter libraries themselves won't be used.
142
150
getDllHandle () = loadAdapter (UR_LIBRARY_NAME (loader));
151
+ std::cout << " ---> four\n "
152
+ << std::endl;
143
153
loadAdapter (UR_LIBRARY_NAME (adapter_opencl));
154
+ std::cout << " ---> five\n "
155
+ << std::endl;
144
156
loadAdapter (UR_LIBRARY_NAME (adapter_level_zero));
157
+ std::cout << " ---> six\n "
158
+ << std::endl;
145
159
loadAdapter (UR_LIBRARY_NAME (adapter_level_zero_v2));
160
+ std::cout << " ---> seven\n "
161
+ << std::endl;
146
162
loadAdapter (UR_LIBRARY_NAME (adapter_cuda));
163
+ std::cout << " ---> eight\n "
164
+ << std::endl;
147
165
loadAdapter (UR_LIBRARY_NAME (adapter_hip));
166
+ std::cout << " ---> nine\n "
167
+ << std::endl;
148
168
loadAdapter (UR_LIBRARY_NAME (adapter_native_cpu));
169
+ std::cout << " ---> ten\n "
170
+ << std::endl;
149
171
// Load the Level Zero loader dynamic library to ensure it is loaded during
150
172
// the runtime. This is necessary to avoid the level zero loader from being
151
173
// unloaded prematurely. the Only trusted loader is the one that is loaded
152
174
// from the system32 directory.
153
175
LoadLibraryExW (L" ze_loader.dll" , NULL , LOAD_LIBRARY_SEARCH_SYSTEM32);
154
-
176
+ std::cout << " ---> eleven\n "
177
+ << std::endl;
155
178
// Restore system error handling.
156
179
(void )SetErrorMode (SavedMode);
180
+ std::cout << " ---> twelve\n "
181
+ << std::endl;
157
182
if (!SetDllDirectory (nullptr )) {
158
183
assert (false && " Failed to restore DLL search path" );
159
184
}
185
+ std::cout << " ---> thirteen\n "
186
+ << std::endl;
160
187
}
161
188
162
189
// / windows_ur.cpp:getURLoaderLibrary() calls this to get the DLL loaded
0 commit comments