[PATCH] D85276: [PGO][CUDA][HIP] Skip generating profile on the device stub and wrong-side functions.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 10:26:21 PDT 2020


hliao added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenPGO.cpp:839-840
 
+  // Skip host-only functions in the CUDA device compilation and device-only
+  // functions in the host compilation.
+  if (CGM.getLangOpts().CUDA &&
----------------
tra wrote:
> We will still have around some functions that may never be used on the host side (HD functions referenced from device code only).  I'm not sure if that's a problem for profiling, though. I wonder if we can somehow tie `skipRegionMappingForDecl` to whether we've actually codegen'ed the function. 
Skipping wrong-side functions here just makes the report not confusing as these functions are not emitted at all and are supposed never running on the host/device side. If we still create the mapping for them, e.g., we may report they have 0 runs instead of reporting nothing (just like comments between function.) That looks a little bit confusing.
It seems the current PGO adds everything for coverage mapping and late prune them based on checks here. Just try to follow that logic to skip wrong-side functions. If we need to revise the original logic and generate coverage mapping for emitted functions only, the change here is unnecessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85276



More information about the cfe-commits mailing list