OffTarget

Observed issues › fuzz/b3-190-cce21

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

ftn: map(to: zopt) of an absent optional dummy in an internal subroutine crashes the run (SIGSEGV)

Legality: not independently confirmed. no independent review yet How this is checked

Same issue as catalog/afar-flang-absent-optional-target-crash; this program is another reproducer of it.

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.0fails another wayfails another wayunknown
not run
fails another wayfails another wayn/an/a
CCE 19.0.0correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/acorrectcorrect
NVHPC 26.9n/an/an/an/an/acorrectcorrect
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 incorrectlyCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
RUN_FAIL
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
PluginInterface error: Failure to allocate device memory: "out of resources" failed to allocate from memory manager
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
fails another wayAFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
PluginInterface error: Failure to allocate device memory: "out of resources" failed to allocate from memory manager
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

Reproduce

CCE 21.0.3, MI300A unified

module load cce/21.0.3 craype-accel-amd-gfx942 rocm/7.2.0
module unload cray-mpich
ftn -fopenmp -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

CCE 21.0.4, MI300A unified

module load cce/21.0.4 craype-accel-amd-gfx942 rocm/7.2.0
module unload cray-mpich
ftn -fopenmp -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

NVHPC 25.11, A100 separate (runs correctly)

export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib
nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
OMP_TARGET_OFFLOAD=mandatory ./repro
Program (81 lines)
! Minimized by compliance.fuzz_min from fuzz seed 190 (fuzz-3).
! toolchain: cce21 (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: run_error (crash: SIGSEGV)
! expected: runs to completion (the host run does)
! observed: device: fail crash: SIGSEGV; host reference (afar) checksum=0
! Legal OpenMP 5.2: 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.
module fuzz_mod
  implicit none
contains
  integer function g1(x, y)
    !$omp declare target
    integer, intent(in) :: x, y
    g1 = 0
  end function g1
end module fuzz_mod
program fuzz_prog
  use omp_lib, only: omp_is_initial_device
  use fuzz_mod, only: g1
  implicit none
  integer, parameter :: n = 24, m = 3
  type :: rec_t
  end type rec_t
  type(rec_t) :: dr
  integer, allocatable, target :: ia(:)
  integer, target :: ib(n)
  integer, allocatable :: as1
  integer, allocatable :: o1(:, :)
  integer :: o2(n, m)
  integer :: i, j, jj
  integer(8) :: cs
  allocate(ia(n))
  allocate(o1(n, m))
  allocate(as1)
  do i = 1, n
    ia(i) = mod(i * 19 + 10, 101) - 23
  end do
  do i = 1, n
    ib(i) = mod(i * 32 + 7, 97) - 39
  end do
  as1 = 46
  o1 = 0
  o2 = 0
  ! fuzz: kernels
  call kp1(as1, ia, o1, dr)
  ! fuzz: checksum
  cs = 0
  do j = 1, m
    do i = 1, n
      cs = modulo(cs * 31_8 + int(o1(i, j), 8), 2147483629_8)
    end do
  end do
  do j = 1, m
    do i = 1, n
      cs = modulo(cs * 31_8 + int(o2(i, j), 8), 2147483629_8)
    end do
  end do
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', 0
contains
  subroutine kp1(as1, ia, o1, dr, zopt)
    integer, intent(inout) :: as1
    integer, intent(in) :: ia(n)
    integer, intent(inout) :: o1(n, m)
    type(rec_t), intent(inout) :: dr
    integer, intent(in), optional :: zopt(:)
    integer :: i, j, jj, t1
    !$omp target private(t1) map(to: zopt)
    do i = 1, n
      do j = 1, m
        t1 = g1((-10), as1)
      end do
    end do
    !$omp end target
  end subroutine kp1
  subroutine kp2(ib, o2)
    integer, intent(inout) :: ib(n)
    integer, intent(inout) :: o2(n, m)
    integer :: i, j, jj
  end subroutine kp2
end program fuzz_prog

Source in the repository

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

What the specification requires

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

The same requirement as the issue catalog/afar-flang-absent-optional-target-crash.

OpenMP 5.2 §3.2.1 p.61

Evidence

Same compiler, one change

  • map(to: zopt) removed (the absent dummy is not named in a map clause): 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
    module fuzz_mod
      implicit none
    contains
      integer function g1(x, y)
        !$omp declare target
        integer, intent(in) :: x, y
        g1 = 0
      end function g1
    end module fuzz_mod
    program fuzz_prog
      use fuzz_mod, only: g1
      implicit none
      integer, parameter :: n = 24, m = 3
      integer, allocatable :: as1
      allocate(as1)
      as1 = 46
      call kp1(as1)
      print '(a)', 'RESULT check=pass'
    contains
      subroutine kp1(as1, zopt)
        integer, intent(inout) :: as1
        integer, intent(in), optional :: zopt(:)
        integer :: i, j, t1
        !$omp target private(t1)
        do i = 1, n
          do j = 1, m
            t1 = g1((-10), as1)
          end do
        end do
        !$omp end target
      end subroutine kp1
    end program fuzz_prog
    

Other compilers run it correctly

NVHPC 25.11, NVHPC 26.9, GCC 16.2.0