OffTarget

Observed issues › catalog/defaultmap-present-private-array-abort

Appears to behave incorrectlyCrashes or aborts at run time · Fortran · OpenMP · Open

AFAR at HSA_XNACK=0: defaultmap(present: aggregate) checks the presence of an array that is private on the same construct and aborts

Legality: contested. An independent adjudicating reading finds the program not legal: Section 17.3 applies private only to the innermost leaf construct that permits it, which is the worksharing loop, so the target construct has no explicit data-sharing attribute for t. t is an array (aggregate), so defaultmap(present: aggregate) gives it an implicit map with alloc and the present modifier. t is not present on the device, so runtime error termination is required. The 16-byte message matches t (4 integers). How this is checked

Affected variants

CompilerMI300A gfx942
unified memory (XNACK 1)
MI300A gfx942
copy (XNACK 0)
MI250X gfx90a
copy (XNACK 0)
MI300X gfx942
copy (XNACK 0)
MI350X gfx950
copy (XNACK 0)
A100 sm_80
separate memory
A100 sm_80
managed memory
AFAR 24.3.0correctbehaves incorrectlybehaves incorrectlybehaves incorrectlybehaves incorrectlyn/an/a
CCE 19.0.0fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 21.0.3fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/afails another wayfails another way
NVHPC 26.9n/an/an/an/an/afails another wayfails another way
GCC 16.2.0correctcorrectcorrectcorrectcorrectcorrectn/a

"behaves incorrectly" / "not supported": this issue, confirmed in up to four environments (another build directory, another node, a repeat). "fails another way": a different failure, not counted as this issue. "unknown": not run there, or the runs disagree.

Messages

ResultCompiler and GPUMessage
behaves incorrectlyAFAR 24.3.0, MI300A copy
show
omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x00007fffffff8190 (16 bytes)
omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
omptarget error: Call to targetDataBegin failed, abort target.
omptarget error: Failed to process data before launching the kernel.
omptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
omptarget fatal error 1: failure of target construct while offloading is mandatory
behaves incorrectlyAFAR 24.3.0, MI250X
show
omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x00007fffffffe210 (16 bytes)
omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
omptarget error: Call to targetDataBegin failed, abort target.
omptarget error: Failed to process data before launching the kernel.
omptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
omptarget fatal error 1: failure of target construct while offloading is mandatory
behaves incorrectlyAFAR 24.3.0, MI300X
show
omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x00007ffe9e37b160 (16 bytes)
omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
omptarget error: Call to targetDataBegin failed, abort target.
omptarget error: Failed to process data before launching the kernel.
omptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
omptarget fatal error 1: failure of target construct while offloading is mandatory
timeout: the monitored command dumped core
behaves incorrectlyAFAR 24.3.0, MI350X
show
omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x00007fff014df9b0 (16 bytes)
omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
omptarget error: Call to targetDataBegin failed, abort target.
omptarget error: Failed to process data before launching the kernel.
omptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
omptarget fatal error 1: failure of target construct while offloading is mandatory
timeout: the monitored command dumped core
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 19.0.0, MI250X
show
ACC:            find_in_present_table failed for 't(:)' (0x407dc0-0x407dd0) from defaultmap-present-private-array-abort.f90:16
ACC: libcrayacc/acc_runtime.c:703 CRAY_ACC_ERROR - Variable not found in present table
fails another wayCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 20.0.2, MI250X
show
ACC:            find_in_present_table failed for 't(:)' (0x407e00-0x407e10) from defaultmap-present-private-array-abort.f90:16
ACC: libcrayacc/acc_runtime.c:817 CRAY_ACC_ERROR - Variable not found in present table
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.3, MI250X
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
CCE 21.0.4, MI250X
show
ACC:            find_in_present_table failed for 't(:)' (0x407e40-0x407e50) from defaultmap-present-private-array-abort.f90:16
ACC: libcrayacc/acc_runtime.c:856 CRAY_ACC_ERROR - Variable not found in present table
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-1197-OpenMP GPU - presents cannot be used with defaultmap clause. (defaultmap-present-private-array-abort.f90: 16)
  0 inform,   0 warnings,   1 severes, 0 fatal for wide_prog

Reproduce

AFAR 24.3.0, MI300A copy

$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=0 OMP_TARGET_OFFLOAD=mandatory ./repro

GCC 16.2.0, MI300A unified (runs correctly)

export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib
$GCC_16_2/bin/gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (67 lines)
! # Draft finding: omp52-w-defaultmap-present-private-array on afar
!
! - compiler: afar
! - toolchain: afar; arch: gfx942; machine: tuolumne; memory mode: copy; opt: -O2
! - program: catalog omp52-w-defaultmap-present-private-array (f90, version 52, sha256 24c00652b35b31db)
! - expected: check=pass (trusted; elision + model)
! - actual: crash  (crash: SIGABRT; without mandatory: crash: SIGABRT)
! - scope: AFAR in copy mode (MI300A and MI250X), where defaultmap(present) and the private array each pass alone; CCE
!   19, 20, 21 also abort, but defaultmap(present) alone already fails there, so that failure is not this finding's
! - verdict: copy_mode_failure by rule R17-copy-mode-failure: wrong in copy mode, the same toolchain gives the expected value in
!   unified mode, the same compiler on another arch does not give it in copy mode, and the expected value is trusted: a compiler
!   failure specific to separate host and device memory
! - reason: expected trusted check=pass (elision + model): stored main verdict: elision + model agree; witnesses: afar/gfx942/copy
!   (port:omp52-c-w-defaultmap-present-private-array)
! - citations: RUL-DERIVED-NEEDS-EXECUTION (rulings.md); RUL-WITNESS-PER-MODE (rulings.md); RUL-PRESENCE-WITNESS
!   (rulings.md)
! - legality: legal: offload.engine.prerun.check accepts it (rerun: offload.engine.rules with the
!   race rule and the restriction checks, and the AFAR flang front end, not under test here); no
!   compiler under test, gfortran or gcc is a legality witness
! - witnesses: afar/gfx942/copy (port:omp52-c-w-defaultmap-present-private-array)
! - withdrawn: none
!
! Generated by compliance.widen (OpenMP 5.2, free-form Fortran; catalog widening). Do not edit.
! id: omp52-w-defaultmap-present-private-array
! primary atom: pair.omp.clause.defaultmap.present+base.device.private_array
! atoms: pair.omp.clause.defaultmap.present+base.device.private_array, omp.clause.defaultmap.present, base.device.private_array
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
! feature: defaultmap(present: aggregate) with a private array on the same target loop (the arrays the loop maps are present by
! enter data)
! spec: OpenMP 5.2 §5.8.7, p.161 (defaultmap applies to variables without an explicitly determined attribute: the private array is
! not one)
! pair of: omp.clause.defaultmap.present + base.device.private_array (each has a program of its own)
program wide_prog
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 64
  integer :: a(n), b(n), ref(n)
  integer :: t(4)
  integer :: i, host_flag
  logical :: ok
  do i = 1, n
    a(i) = i
    b(i) = 0
    ref(i) = 2*i + 1
  end do
  host_flag = 1
  !$omp target enter data map(to: a) map(alloc: b)
  !$omp target teams distribute parallel do defaultmap(present: aggregate) &
  !$omp& private(t) map(tofrom: host_flag)
  do i = 1, n
    t(1) = a(i)
    t(2) = 1
    t(3) = a(i)
    t(4) = 0
    b(i) = sum(t)
    if (i == 1) host_flag = merge(1, 0, omp_is_initial_device())
  end do
  !$omp end target teams distribute parallel do
  !$omp target exit data map(from: b) map(release: a)
  ok = all(b == ref)
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program wide_prog

Source in the repository

Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page

Expected and observed

Expected

check=pass

Observed where it behaves incorrectly

omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0x00007fffffff8190 (16 bytes)
omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
omptarget error: Call to targetDataBegin failed, abort target.
omptarget error: Failed to process data before launching the kernel.
omptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
omptarget fatal error 1: failure of target construct while offloading is mandatory

What the specification requires

The specification text this program relies on and the compiler is expected to support.

OpenMP 5.2 §5.8.7 p.161

Evidence

Same compiler, one change

  • defaultmap(present: aggregate) removed: AFAR 24.3.0: correct; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
    Control program
    program wide_prog
      use omp_lib, only: omp_is_initial_device
      implicit none
      integer, parameter :: n = 64
      integer :: a(n), b(n), ref(n)
      integer :: t(4)
      integer :: i, host_flag
      logical :: ok
      do i = 1, n
        a(i) = i
        b(i) = 0
        ref(i) = 2*i + 1
      end do
      host_flag = 1
      !$omp target enter data map(to: a) map(alloc: b)
      !$omp target teams distribute parallel do &
      !$omp& private(t) map(tofrom: host_flag)
      do i = 1, n
        t(1) = a(i)
        t(2) = 1
        t(3) = a(i)
        t(4) = 0
        b(i) = sum(t)
        if (i == 1) host_flag = merge(1, 0, omp_is_initial_device())
      end do
      !$omp end target teams distribute parallel do
      !$omp target exit data map(from: b) map(release: a)
      ok = all(b == ref)
      print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
    end program wide_prog
    

Other compilers run it correctly

GCC 16.2.0