[all-commits] [llvm/llvm-project] 61278e: [openacc][openmp] Add dialect representation for a...

Razvan Lupusoru via All-commits all-commits at lists.llvm.org
Wed Sep 6 13:54:52 PDT 2023


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

  Changed paths:
    M mlir/include/mlir/Dialect/CMakeLists.txt
    M mlir/include/mlir/Dialect/OpenACC/OpenACC.h
    M mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
    A mlir/include/mlir/Dialect/OpenACCMPCommon/CMakeLists.txt
    A mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h
    A mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td
    A mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/CMakeLists.txt
    M mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.h
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/lib/Dialect/CMakeLists.txt
    M mlir/lib/Dialect/OpenACC/CMakeLists.txt
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
    A mlir/lib/Dialect/OpenACCMPCommon/CMakeLists.txt
    A mlir/lib/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp
    A mlir/lib/Dialect/OpenACCMPCommon/Interfaces/CMakeLists.txt
    M mlir/lib/Dialect/OpenMP/CMakeLists.txt
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenACC/canonicalize.mlir
    M mlir/test/Dialect/OpenACC/invalid.mlir
    M mlir/test/Dialect/OpenACC/ops.mlir
    M mlir/test/Dialect/OpenMP/invalid.mlir
    M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

  Log Message:
  -----------
  [openacc][openmp] Add dialect representation for acc atomic operations (#65493)

The OpenACC standard specifies an `atomic` construct in section 2.12 (of
3.3 spec), used to ensure that a specific location is accessed or
updated atomically. Four different clauses are allowed: `read`, `write`,
`update`, or `capture`. If no clause appears, it is as if `update` is
used.

The OpenMP specification defines the same clauses for `omp atomic`. The
types of expression and the clauses in the OpenACC spec match the OpenMP
spec exactly. The main difference is that the OpenMP specification is a
superset - it includes clauses for `hint` and `memory order`. It also
allows conditional expression statements. But otherwise, the expression
definition matches.

Thus, for OpenACC, we refactor and reuse the OpenMP implementation as
follows:
* The atomic operations are duplicated in OpenACC dialect. This is
preferable so that each language's semantics are precisely represented
even if specs have divergence.
* However, since semantics overlap, a common interface between the
atomic operations is being added. The semantics for the interfaces are
not generic enough to be used outside of OpenACC and OpenMP, and thus
new folders were added to hold common pieces of the two dialects.
* The atomic interfaces define common accessors (such as getting `x` or
`v`) which match the OpenMP and OpenACC specs. It also adds common
verifiers intended to be called by each dialect's operation verifier.
* The OpenMP write operation was updated to use `x` and `expr` to be
consistent with its other operations (that use naming based on spec).

The frontend lowering necessary to generate the dialect can also be
reused. This will be done in a follow up change.




More information about the All-commits mailing list