[all-commits] [llvm/llvm-project] 266235: [OpenMP] Add new OpenMP globalization functions to...

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Jun 22 10:23:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2662351e3b75052f3ab273b36ee7d64b5cb7cb85
      https://github.com/llvm/llvm-project/commit/2662351e3b75052f3ab273b36ee7d64b5cb7cb85
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2021-06-22 (Tue, 22 Jun 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetLibraryInfo.def
    M llvm/lib/Analysis/MemoryBuiltins.cpp
    M llvm/lib/Analysis/TargetLibraryInfo.cpp
    M llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

  Log Message:
  -----------
  [OpenMP] Add new OpenMP globalization functions to library info

Summary:
The changes to globalization introduced in D97680 created two new functions to
push / pop shareably memory on the GPU, __kmpc_alloc_shared and
__kmpc_free_shared. This patch adds these new runtime functions to the
library info so they can be used by the HeapToStack attributor interface. This
optimization replaces malloc / free pairs with stack memory if legal.

Reviewed By: tianshilei1992

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


  Commit: 7d69da71dd35f91a5d4310b16940405e7f0c2f20
      https://github.com/llvm/llvm-project/commit/7d69da71dd35f91a5d4310b16940405e7f0c2f20
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2021-06-22 (Tue, 22 Jun 2021)

  Changed paths:
    M llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    M llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
    A llvm/test/Transforms/OpenMP/remove_globalization.ll
    M llvm/test/Transforms/PhaseOrdering/openmp-opt-module.ll

  Log Message:
  -----------
  [OpenMP] Enable HeapToStack conversion in OpenMPOpt for new RTL globalization calls

Summary:
The changes to globalization introduced in D97680 introduce a large amount of overhead by default. The old globalization method would always ignore globalization code if executing in SPMD mode. This wasn't strictly correct as data sharing is still possible in SPMD mode. The new interface is correct but introduces globalization code even when unnecessary. This optimization will use the existing HeapToStack transformation in the attributor to allow for unneeded globalization to be replaced with thread-private stack memory. This is done using the newly introduced library instances for the RTL functions added in D102087.

Depends on D97818

Reviewed By: jdoerfert

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


Compare: https://github.com/llvm/llvm-project/compare/d03736455cee...7d69da71dd35


More information about the All-commits mailing list