@@ -109,6 +109,8 @@ void *&getDllHandle() {
109109
110110// / Load the adapter libraries
111111void preloadLibraries () {
112+ std::cout << " ---> one\n "
113+ << std::endl;
112114 // Suppress system errors.
113115 // Tells the system to not display the critical-error-handler message box.
114116 // Instead, the system sends the error to the calling process.
@@ -119,44 +121,70 @@ void preloadLibraries() {
119121 // NOTE: we restore the old mode to not affect user app behavior.
120122 //
121123 UINT SavedMode = SetErrorMode (SEM_FAILCRITICALERRORS);
124+ std::cout << " ---> one point five \n "
125+ << std::endl;
122126 // Exclude current directory from DLL search path
123127 if (!SetDllDirectory (L" " )) {
124128 assert (false && " Failed to update DLL search path" );
125129 }
126-
130+ std::cout << " ---> two\n "
131+ << std::endl;
127132 // this path duplicates sycl/detail/ur.cpp:initializeAdapters
128133 std::filesystem::path LibSYCLDir (getCurrentDSODir ());
129-
134+ std::cout << " ---> three\n "
135+ << std::endl;
130136 // When searching for dependencies of the adapters limit the
131137 // list of directories to %windows%\system32 and the directory that contains
132138 // the loaded DLL (the adapter). This is necessary to avoid loading dlls from
133139 // current directory and some other directories which are considered unsafe.
134140 auto loadAdapter = [&](auto adapterName,
135141 DWORD flags = LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
136142 LOAD_LIBRARY_SEARCH_SYSTEM32) {
143+
137144 auto path = LibSYCLDir / adapterName;
145+ std::wcout << " ---> NAME " << path.wstring () << " \n "
146+ << std::endl;
138147 return LoadLibraryEx (path.wstring ().c_str (), NULL , flags);
139148 };
140149 // We keep the UR Loader handle so it can be fetched by the runtime, but the
141150 // adapter libraries themselves won't be used.
142151 getDllHandle () = loadAdapter (UR_LIBRARY_NAME (loader));
152+ std::cout << " ---> four\n "
153+ << std::endl;
143154 loadAdapter (UR_LIBRARY_NAME (adapter_opencl));
155+ std::cout << " ---> five\n "
156+ << std::endl;
144157 loadAdapter (UR_LIBRARY_NAME (adapter_level_zero));
158+ std::cout << " ---> six\n "
159+ << std::endl;
145160 loadAdapter (UR_LIBRARY_NAME (adapter_level_zero_v2));
161+ std::cout << " ---> seven\n "
162+ << std::endl;
146163 loadAdapter (UR_LIBRARY_NAME (adapter_cuda));
164+ std::cout << " ---> eight\n "
165+ << std::endl;
147166 loadAdapter (UR_LIBRARY_NAME (adapter_hip));
167+ std::cout << " ---> nine\n "
168+ << std::endl;
148169 loadAdapter (UR_LIBRARY_NAME (adapter_native_cpu));
170+ std::cout << " ---> ten\n "
171+ << std::endl;
149172 // Load the Level Zero loader dynamic library to ensure it is loaded during
150173 // the runtime. This is necessary to avoid the level zero loader from being
151174 // unloaded prematurely. the Only trusted loader is the one that is loaded
152175 // from the system32 directory.
153176 LoadLibraryExW (L" ze_loader.dll" , NULL , LOAD_LIBRARY_SEARCH_SYSTEM32);
154-
177+ std::cout << " ---> eleven\n "
178+ << std::endl;
155179 // Restore system error handling.
156180 (void )SetErrorMode (SavedMode);
181+ std::cout << " ---> twelve\n "
182+ << std::endl;
157183 if (!SetDllDirectory (nullptr )) {
158184 assert (false && " Failed to restore DLL search path" );
159185 }
186+ std::cout << " ---> thirteen\n "
187+ << std::endl;
160188}
161189
162190// / windows_ur.cpp:getURLoaderLibrary() calls this to get the DLL loaded
0 commit comments