[PATCH] D106298: [OpenMP] Creating the `NumTeams` and `ThreadLimit` attributes to outlined functions

Jose Manuel Monsalve Diaz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 19 12:05:14 PDT 2021


josemonsalve2 created this revision.
josemonsalve2 added reviewers: ABataev, jdoerfert, JonChesterfield, ggeorgakoudis, jhuber6, baziotis, sstefan1, uenoku, tianshilei1992.
Herald added subscribers: jfb, guansong, yaxunl.
josemonsalve2 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The device runtime contains several calls to __kmpc_get_hardware_num_threads_in_block
and __kmpc_get_hardware_num_blocks. If the thread_limit and the num_teams are constant,
these calls can be folded to the constant value.

In commit D106033 <https://reviews.llvm.org/D106033> we have the optimization phase. This commit adds the attributes to
the outlined function for the grid size. the two attributes are `NumTeams` and
`ThreadLimit`. These values are added as long as they are constant.

Two functions are created `getNumThreadsExprForTargetDirective` and
`getNumTeamsExprForTargetDirective`. The original functions `emitNumTeamsForTargetDirective`
 and `emitNumThreadsForTargetDirective` identify the expresion and emit the code.
However, for the Device version of the outlined function, we cannot emit anything.
Therefore, this is a first attempt to separate emision of code from deduction of the
values.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106298

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106298.359873.patch
Type: text/x-patch
Size: 12311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210719/a7d358f9/attachment.bin>


More information about the cfe-commits mailing list