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

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Fri Dec 29 13:46:59 PST 2023


================
@@ -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;
+}
+
----------------
jhuber6 wrote:

```suggestion
bool isGPUProfTarget(const Module &M) {
  const llvm::Triple &Triple = M.getTargetTriple();
  return Triple.isAMDGPU() || Triple.isNVPTX()
}
```
Standard way looks like this. Side note, we really need a way to express this in a more re-usable way especially with SYCL looming. @arsenm should be make some common interface in `CodeGenModule` that just returns if we're currently targeting a "GPU like" device?

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


More information about the Openmp-commits mailing list