@@ -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,70 @@ 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
+
137
144
auto path = LibSYCLDir / adapterName;
145
+ std::wcout << " ---> NAME " << path.wstring () << " \n "
146
+ << std::endl;
138
147
return LoadLibraryEx (path.wstring ().c_str (), NULL , flags);
139
148
};
140
149
// We keep the UR Loader handle so it can be fetched by the runtime, but the
141
150
// adapter libraries themselves won't be used.
142
151
getDllHandle () = loadAdapter (UR_LIBRARY_NAME (loader));
152
+ std::cout << " ---> four\n "
153
+ << std::endl;
143
154
loadAdapter (UR_LIBRARY_NAME (adapter_opencl));
155
+ std::cout << " ---> five\n "
156
+ << std::endl;
144
157
loadAdapter (UR_LIBRARY_NAME (adapter_level_zero));
158
+ std::cout << " ---> six\n "
159
+ << std::endl;
145
160
loadAdapter (UR_LIBRARY_NAME (adapter_level_zero_v2));
161
+ std::cout << " ---> seven\n "
162
+ << std::endl;
146
163
loadAdapter (UR_LIBRARY_NAME (adapter_cuda));
164
+ std::cout << " ---> eight\n "
165
+ << std::endl;
147
166
loadAdapter (UR_LIBRARY_NAME (adapter_hip));
167
+ std::cout << " ---> nine\n "
168
+ << std::endl;
148
169
loadAdapter (UR_LIBRARY_NAME (adapter_native_cpu));
170
+ std::cout << " ---> ten\n "
171
+ << std::endl;
149
172
// Load the Level Zero loader dynamic library to ensure it is loaded during
150
173
// the runtime. This is necessary to avoid the level zero loader from being
151
174
// unloaded prematurely. the Only trusted loader is the one that is loaded
152
175
// from the system32 directory.
153
176
LoadLibraryExW (L" ze_loader.dll" , NULL , LOAD_LIBRARY_SEARCH_SYSTEM32);
154
-
177
+ std::cout << " ---> eleven\n "
178
+ << std::endl;
155
179
// Restore system error handling.
156
180
(void )SetErrorMode (SavedMode);
181
+ std::cout << " ---> twelve\n "
182
+ << std::endl;
157
183
if (!SetDllDirectory (nullptr )) {
158
184
assert (false && " Failed to restore DLL search path" );
159
185
}
186
+ std::cout << " ---> thirteen\n "
187
+ << std::endl;
160
188
}
161
189
162
190
// / windows_ur.cpp:getURLoaderLibrary() calls this to get the DLL loaded
0 commit comments