[llvm] [openmp] [clang] [clang-tools-extra] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

Ethan Luis McDonough via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 13:55:00 PST 2024


================
@@ -428,13 +428,22 @@ std::string getPGOFuncNameVarName(StringRef FuncName,
   return VarName;
 }
 
+bool isGPUProfTarget(const Module &M) {
+  const auto &triple = M.getTargetTriple();
+  return triple.rfind("nvptx", 0) == 0 || triple.rfind("amdgcn", 0) == 0 ||
+         triple.rfind("r600", 0) == 0;
+}
+
----------------
EthanLuisMcDonough wrote:

I did briefly consider turning the `isGPUProfTarget` function into a method of either the Module or Triple class, but I was worried that would be out of the scope of this PR. Do you think adding an `isGPU` method to the Triple class would make things cleaner?

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


More information about the cfe-commits mailing list