[all-commits] [llvm/llvm-project] 2a1200: [Flang][OpenMP] Fix Fortran automap handling (#162...

Akash Banerjee via All-commits all-commits at lists.llvm.org
Tue Jul 14 08:03:27 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a1200e08cd1cb0e6744e38a7ec4611d983fb44f
      https://github.com/llvm/llvm-project/commit/2a1200e08cd1cb0e6744e38a7ec4611d983fb44f
  Author: Akash Banerjee <akash.banerjee at amd.com>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M flang/lib/Optimizer/OpenMP/AutomapToTargetData.cpp
    A flang/test/Lower/OpenMP/declare-target-automap.f90
    M flang/test/Transforms/omp-automap-to-target-data.fir
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
    M offload/test/offloading/fortran/declare-target-automap.f90

  Log Message:
  -----------
  [Flang][OpenMP] Fix Fortran automap handling (#162501)

This fixes Fortran `declare target enter(automap:...)` handling for
allocatable
descriptors.

- Replace the previous `has_device_addr` target-region rewrite with
explicit
  target data operations around allocation/deallocation.
- On allocation, emit:
  - descriptor `map(always,to)` to keep the Fortran descriptor present
  - storage `map(storage)` for the allocated array data
- `map(attach)` to update the device descriptor base address to the
device data
- On deallocation, delete both the mapped storage and descriptor.
- Add a weak visible offload-entry alias for local/hidden `declare
target to/enter`
globals so libomptarget can associate the host descriptor with the real
device
  global without changing the original symbol linkage.

This fixes `offload/test/offloading/fortran/declare-target-automap.f90`
reported broken in #161265.

Co-authored-by: Codex <codex at openai.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