[clang] Fix amdgpu-arch for dll name on Windows (PR #101350)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 09:06:18 PDT 2024


================
@@ -31,16 +43,108 @@ typedef hipError_t (*hipGetDeviceCount_t)(int *);
 typedef hipError_t (*hipDeviceGet_t)(int *, int);
 typedef hipError_t (*hipGetDeviceProperties_t)(hipDeviceProp_t *, int);
 
-int printGPUsByHIP() {
+extern cl::opt<bool> Verbose;
+
 #ifdef _WIN32
-  constexpr const char *DynamicHIPPath = "amdhip64.dll";
+std::vector<std::string> getSearchPaths() {
+  std::vector<std::string> Paths;
+
+  // Get the directory of the current executable
+  if (auto MainExe = sys::fs::getMainExecutable(nullptr, nullptr);
+      !MainExe.empty())
+    Paths.push_back(sys::path::parent_path(MainExe).str());
+
+  // Get the system directory
+  char SystemDirectory[MAX_PATH];
+  if (GetSystemDirectoryA(SystemDirectory, MAX_PATH) > 0) {
+    Paths.push_back(SystemDirectory);
+  }
+
+  // Get the Windows directory
+  char WindowsDirectory[MAX_PATH];
+  if (GetWindowsDirectoryA(WindowsDirectory, MAX_PATH) > 0) {
----------------
arsenm wrote:

Should these be using the unicode versions? 

https://github.com/llvm/llvm-project/pull/101350


More information about the cfe-commits mailing list