[all-commits] [llvm/llvm-project] 1100e4: [AbstractAttributor] Fold function calls to `__kmp...

Shilei Tian via All-commits all-commits at lists.llvm.org
Tue Jul 13 19:28:49 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1100e4aafea233bc8bbc307c5758a7d287ad3bae
      https://github.com/llvm/llvm-project/commit/1100e4aafea233bc8bbc307c5758a7d287ad3bae
  Author: Shilei Tian <tianshilei1992 at gmail.com>
  Date:   2021-07-13 (Tue, 13 Jul 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    M llvm/test/Transforms/OpenMP/custom_state_machines.ll
    A llvm/test/Transforms/OpenMP/is_spmd_exec_mode_fold.ll

  Log Message:
  -----------
  [AbstractAttributor] Fold function calls to `__kmpc_is_spmd_exec_mode` if possible

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.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D105787




More information about the All-commits mailing list