[PATCH] D105787: [AbstractAttributor] Fold function calls to `__kmpc_is_spmd_exec_mode` if possible

Shilei Tian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 11 18:03:11 PDT 2021


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, JonChesterfield, ggeorgakoudis, jhuber6.
Herald added subscribers: ormris, okura, uenoku, hiraditya.
Herald added a reviewer: uenoku.
tianshilei1992 requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added subscribers: llvm-commits, bbn, sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.

In the device runtime there are many function calls to `__kmpc_is_spmd_exec_mode`
to query the execution mode of current kernels. In many cases, user programs
only contain target region executing in one mode. As a consequence, those runtime
function calls will only return one value. If we can get rid of these function
calls during compliation, it can potentially improve performance.

In this patch, we use `AAKernelInfo` to analyze kernel execution. Basically, for
each kernel (device) function `F`, we collect all kernel entries `K` that can
reach `F`. A new AA, `AAFoldRuntimeCall`, is created for each call site. In each
iteration, it will check all reaching kernel entries, and update the folded value
accordingly.

In the future we will support more function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105787

Files:
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105787.357822.patch
Type: text/x-patch
Size: 11674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210712/54c4e3bc/attachment.bin>


More information about the llvm-commits mailing list