[all-commits] [llvm/llvm-project] 38fc89: [Attributor][Fix] Add alignment return attribute t...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Dec 27 13:58:44 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38fc89623b3ea274ba45be20a19de217e45e1563
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2021-12-27 (Mon, 27 Dec 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/test/Transforms/Attributor/heap_to_stack.ll

  Log Message:
  [Attributor][Fix] Add alignment return attribute to HeapToStack

This patch changes the HeapToStack optimization to attach the return alignment
attribute information to the created alloca instruction. This would cause
problems when replacing the heap allocation with an alloca did not respect the
alignment of the original heap allocation, which would typically be aligned on
an 8 or 16 byte boundary. Malloc calls now contain alignment attributes,
so we can use that information here.

Reviewed By: jdoerfert

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

  Commit: 7cdaa5a94ed74a7f31bb16b722833b54bc21b0be
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2021-12-27 (Mon, 27 Dec 2021)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/test/OpenMP/declare_target_codegen_globalization.cpp
    M clang/test/OpenMP/nvptx_data_sharing.cpp
    M clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
    M clang/test/OpenMP/nvptx_parallel_codegen.cpp
    M clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
    M clang/test/OpenMP/nvptx_target_codegen.cpp
    M clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/nvptx_teams_codegen.cpp
    M clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
    M openmp/libomptarget/DeviceRTL/src/State.cpp

  Log Message:
  [OpenMP][FIX] Change globalization alignment to 16

This patch changes the default aligntment from 8 to 16, and encodes this
information in the `__kmpc_alloc_shared` runtime call to communicate it
to the HeapToStack pass. The previous alignment of 8 was not sufficient
for the maximum size of primitive types on 64-bit systems, and needs to
be increaesd. This reduces the amount of space availible in the data
sharing stack, so this implementation will need to be improved later to
include the alignment requirements in the allocation call, and use it
properly in the data sharing stack in the runtime.

Depends on D115888

Reviewed By: jdoerfert

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

  Commit: 6e220296d7d13b8255c2c26baf59f5433a135475
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2021-12-27 (Mon, 27 Dec 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    M llvm/test/Transforms/OpenMP/replace_globalization.ll
    M llvm/test/Transforms/OpenMP/spmdization.ll

  Log Message:
  [OpenMP] Use alignment information in HeapToShared

This patch uses the return alignment attribute now present in the
`__kmpc_alloc_shared` runtime call to set the alignment of the shared
memory global created to replace it.

Depends on D115971

Reviewed By: jdoerfert

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

Compare: https://github.com/llvm/llvm-project/compare/80c14dcc0e29...6e220296d7d1

More information about the All-commits mailing list