[PATCH] D83492: [OpenMP] Use common interface to access GPU Grid Values

Saiyedul Islam via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 08:39:26 PDT 2020


saiislam marked an inline comment as done.
saiislam added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:654
+  unsigned LaneIDBits =
+      CGF.getTarget().getGridValue(llvm::omp::GV_Warp_Size_Log2);
   return Bld.CreateAShr(getNVPTXThreadID(CGF), LaneIDBits, "nvptx_warp_id");
----------------
jdoerfert wrote:
> Why do we keep the enum value with this name then?
Enums in OMPGridValues.h has been named like this because many of the values are dependent on a different value in the same enum. For example, hardcoded value of number of bits required to represent the max number of threads in a warp (LaneIDBits here), is computed as log of WarpSize. Similarly, mask of this value (LaneIDMask below) is based on WarpSize. A future change in WarpSize thus will require update in all the enums based on (and prefixed as) WarpSize, so less chances of a manual error.

See this: https://github.com/llvm/llvm-project/blob/8b6821a5843bb321b3738e2519beae7142e62928/llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h#L120


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83492





More information about the cfe-commits mailing list