[PATCH] D153725: [clang] Make amdgpu-arch tool work on Windows

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 06:35:13 PDT 2023


jhuber6 added a comment.

In D153725#4463589 <https://reviews.llvm.org/D153725#4463589>, @arsenm wrote:

> Unrelated but can we get this to start reporting xnack and ecc?

A lot of CMake relies on this just being an ordered list of architectures, so we'd probably need to make that an opt-in thing.



================
Comment at: clang/tools/amdgpu-arch/AMDGPUArch.cpp:47
 
-  // Attempt to load the HSA runtime.
-  if (llvm::Error Err = loadHSA()) {
-    logAllUnhandledErrors(std::move(Err), llvm::errs());
-    return 1;
-  }
-
-  hsa_status_t Status = hsa_init();
-  if (Status != HSA_STATUS_SUCCESS) {
-    return 1;
-  }
-
-  std::vector<std::string> GPUs;
-  Status = hsa_iterate_agents(iterateAgentsCallback, &GPUs);
-  if (Status != HSA_STATUS_SUCCESS) {
-    return 1;
-  }
-
-  for (const auto &GPU : GPUs)
-    printf("%s\n", GPU.c_str());
-
-  if (GPUs.size() < 1)
-    return 1;
-
-  hsa_shut_down();
-  return 0;
+#ifdef _WIN32
+  return printGPUsByHIP();
----------------
Doesn't LLVM know if it's being built for Windows? Maybe we should key off of that instead and then conditionally `add_sources` for a single function that satisfies the same "print all the architectures" thing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153725/new/

https://reviews.llvm.org/D153725



More information about the cfe-commits mailing list