@@ -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,69 @@ 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+ std::cout << " ---> NAME " << std::string (path.wstring ().c_str ()) << " \n "
144+ << std::endl;
137145 auto path = LibSYCLDir / adapterName;
138146 return LoadLibraryEx (path.wstring ().c_str (), NULL , flags);
139147 };
140148 // We keep the UR Loader handle so it can be fetched by the runtime, but the
141149 // adapter libraries themselves won't be used.
142150 getDllHandle () = loadAdapter (UR_LIBRARY_NAME (loader));
151+ std::cout << " ---> four\n "
152+ << std::endl;
143153 loadAdapter (UR_LIBRARY_NAME (adapter_opencl));
154+ std::cout << " ---> five\n "
155+ << std::endl;
144156 loadAdapter (UR_LIBRARY_NAME (adapter_level_zero));
157+ std::cout << " ---> six\n "
158+ << std::endl;
145159 loadAdapter (UR_LIBRARY_NAME (adapter_level_zero_v2));
160+ std::cout << " ---> seven\n "
161+ << std::endl;
146162 loadAdapter (UR_LIBRARY_NAME (adapter_cuda));
163+ std::cout << " ---> eight\n "
164+ << std::endl;
147165 loadAdapter (UR_LIBRARY_NAME (adapter_hip));
166+ std::cout << " ---> nine\n "
167+ << std::endl;
148168 loadAdapter (UR_LIBRARY_NAME (adapter_native_cpu));
169+ std::cout << " ---> ten\n "
170+ << std::endl;
149171 // Load the Level Zero loader dynamic library to ensure it is loaded during
150172 // the runtime. This is necessary to avoid the level zero loader from being
151173 // unloaded prematurely. the Only trusted loader is the one that is loaded
152174 // from the system32 directory.
153175 LoadLibraryExW (L" ze_loader.dll" , NULL , LOAD_LIBRARY_SEARCH_SYSTEM32);
154-
176+ std::cout << " ---> eleven\n "
177+ << std::endl;
155178 // Restore system error handling.
156179 (void )SetErrorMode (SavedMode);
180+ std::cout << " ---> twelve\n "
181+ << std::endl;
157182 if (!SetDllDirectory (nullptr )) {
158183 assert (false && " Failed to restore DLL search path" );
159184 }
185+ std::cout << " ---> thirteen\n "
186+ << std::endl;
160187}
161188
162189// / windows_ur.cpp:getURLoaderLibrary() calls this to get the DLL loaded
0 commit comments