[all-commits] [llvm/llvm-project] d67947: [flang][OpenMP] Implement HAS_DEVICE_ADDR clause (...

Krzysztof Parzyszek via All-commits all-commits at lists.llvm.org
Mon Mar 10 06:11:22 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d67947162f4b06172fac91fefa6a9ad25eb6dd56
      https://github.com/llvm/llvm-project/commit/d67947162f4b06172fac91fefa6a9ad25eb6dd56
  Author: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
  Date:   2025-03-10 (Mon, 10 Mar 2025)

  Changed paths:
    M flang/include/flang/Support/OpenMP-utils.h
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/ClauseProcessor.h
    M flang/lib/Lower/OpenMP/Clauses.cpp
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/lib/Lower/OpenMP/Utils.cpp
    M flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
    M flang/lib/Support/OpenMP-utils.cpp
    A flang/test/Lower/OpenMP/has_device_addr-mapinfo.f90
    M mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenMP/ops.mlir
    A mlir/test/Target/LLVMIR/openmp-target-has-device-addr.mlir
    M mlir/test/Target/LLVMIR/openmp-todo.mlir
    A offload/test/offloading/fortran/target-has-device-addr1.f90
    A offload/test/offloading/fortran/target-has-device-addr2.f90
    A offload/test/offloading/fortran/target-has-device-addr3.f90

  Log Message:
  -----------
  [flang][OpenMP] Implement HAS_DEVICE_ADDR clause (#128568)

The HAS_DEVICE_ADDR indicates that the object(s) listed exists at an
address that is a valid device address. Specifically,
`has_device_addr(x)` means that (in C/C++ terms) `&x` is a device
address.

When entering a target region, `x` does not need to be allocated on the
device, or have its contents copied over (in the absence of additional
mapping clauses). Passing its address verbatim to the region for use is
sufficient, and is the intended goal of the clause.

Some Fortran objects use descriptors in their in-memory representation.
If `x` had a descriptor, both the descriptor and the contents of `x`
would be located in the device memory. However, the descriptors are
managed by the compiler, and can be regenerated at various points as
needed. The address of the effective descriptor may change, hence it's
not safe to pass the address of the descriptor to the target region.
Instead, the descriptor itself is always copied, but for objects like
`x`, no further mapping takes place (as this keeps the storage pointer
in the descriptor unchanged).

---------

Co-authored-by: Sergio Afonso <safonsof at amd.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list