[all-commits] [llvm/llvm-project] e070ea: [flang][openacc] Enable lowering support for OpenA...

Razvan Lupusoru via All-commits all-commits at lists.llvm.org
Mon Sep 11 13:58:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e070ea47a991d2b4a135f6bfb761b19013d7f6af
      https://github.com/llvm/llvm-project/commit/e070ea47a991d2b4a135f6bfb761b19013d7f6af
  Author: Razvan Lupusoru <razvan.lupusoru at gmail.com>
  Date:   2023-09-11 (Mon, 11 Sep 2023)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp
    A flang/lib/Lower/DirectivesCommon.h
    M flang/lib/Lower/OpenACC.cpp
    M flang/lib/Lower/OpenMP.cpp
    A flang/test/Lower/OpenACC/acc-atomic-capture.f90
    A flang/test/Lower/OpenACC/acc-atomic-read.f90
    A flang/test/Lower/OpenACC/acc-atomic-update-hlfir.f90
    A flang/test/Lower/OpenACC/acc-atomic-update.f90
    A flang/test/Lower/OpenACC/acc-atomic-write.f90

  Log Message:
  -----------
  [flang][openacc] Enable lowering support for OpenACC atomic operations (#65776)

Since the OpenACC atomics specification is a subset of OpenMP atomics,
the same lowering implementation can be used. This change extracts out
the necessary pieces from the OpenMP lowering and puts them in a shared
spot. The shared spot is a header file so that each implementation can
template specialize directly.

After putting the OpenMP implementation in a common spot, the following
changes were needed to make it work for OpenACC:
* Ensure parsing works correctly by avoiding hardcoded offsets.
* Templatize based on atomic type.
* The checking whether it is OpenMP or OpenACC is done by checking for
OmpAtomicClauseList (OpenACC does not implement this so we just
templatize with void). It was preferable to check this instead of atomic
type because in some cases, like atomic capture, the read/write/update
implementations are called - and we want compile time evaluation of
these conditional parts.
* The memory order and hint are used only for OpenMP.
* Generate acc dialect operations instead of omp dialect operations.




More information about the All-commits mailing list