[all-commits] [llvm/llvm-project] 5ab6ae: [OpenMP] Folding threadLimit and numThreads when s...

Shilei Tian via All-commits all-commits at lists.llvm.org
Tue Jul 27 18:47:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ab6aedda9d959a44453b7163b59f645012dbb83
      https://github.com/llvm/llvm-project/commit/5ab6aedda9d959a44453b7163b59f645012dbb83
  Author: Jose M Monsalve Diaz <jmonsalvediaz at anl.gov>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    A llvm/test/Transforms/OpenMP/get_hardware_num_threads_in_block_fold.ll
    M openmp/libomptarget/deviceRTLs/target_interface.h

  Log Message:
  -----------
  [OpenMP] Folding threadLimit and numThreads when single value in kernels

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 this patch we use the already introduced `AAFoldRuntimeCall` and the `NumTeams` and
`NumThreads` kernel attributes (to be introduced in a different patch) to fold these functions.
The code checks all the kernels, and if their attributes match, the functions are folded.

In the future we will explore specializing for multiple values of NumThreads and NumTeams.

Depends on D106390

Reviewed By: jdoerfert, JonChesterfield

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




More information about the All-commits mailing list