OffTarget

Observed issues › fuzz/b3-54-afar

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

amdflang: an empty target nowait with depend(inout:) on a derived-type variable with an allocatable component crashes (SIGSEGV)

Legality: independently confirmed. 2 independent readings find the program legal and the result required. 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.0behaves incorrectlybehaves incorrectlyunknown
not run
behaves incorrectlybehaves incorrectlyn/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.3correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4correctcorrectunknown
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 incorrectlyAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
RUN_FAIL
behaves incorrectlyAFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
timeout: the monitored command dumped core

Reproduce

AFAR 24.3.0, MI300A unified

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

CCE 19.0.0, MI300A unified (runs correctly)

module load cce/19.0.0 craype-accel-amd-gfx942 rocm/6.4.3
module unload cray-mpich
ftn -fopenmp -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (62 lines)
! Minimized by compliance.fuzz_min from fuzz seed 54 (fuzz-3).
! toolchain: afar (-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 (elision) checksum=0
! Legal OpenMP 5.2: offload.engine.rules accepts it (offload.engine.prerun.check, rerun: with the
!   race rule and the restriction checks); nvfortran/nvc 26.9 and 25.11 (NVHPC, not under test
!   here) compile it; the check's other witness, the AFAR flang front end, is the compiler under
!   test and is not counted; no gfortran or gcc is a legality witness.
module fuzz_mod
  implicit none
contains
end module fuzz_mod
program fuzz_prog
  use omp_lib, only: omp_get_thread_num, omp_is_initial_device
  implicit none
  integer, parameter :: n = 32, m = 5
  type :: rec_t
    integer, allocatable :: q(:)
  end type rec_t
  type(rec_t) :: dr
  integer, allocatable, target :: ic(:, :)
  integer, pointer :: o1(:)
  integer :: i, j, p1, hf1
  integer(8) :: cs
  allocate(ic(n, m))
  allocate(dr%q(n))
  allocate(o1(n))
  do j = 1, m
    do i = 1, n
      ic(i, j) = mod((i + 8 * j) * 26 + 35, 97) - 30
    end do
  end do
  do i = 1, n
    dr%q(i) = mod(i * 6 + 6, 1009) - 171
  end do
  o1 = 0
  p1 = -3
  hf1 = 0
  ! fuzz: kernels
  !$omp target nowait depend(in: p1) depend(inout: dr, hf1, ic, o1)
  !$omp end target
  !$omp taskwait
  ! fuzz: checksum
  cs = 0
  do i = 1, n
    cs = modulo(cs * 31_8 + int(o1(i), 8), 2147483629_8)
  end do
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', max(hf1, 0)
end program fuzz_prog
! spec (requirement): a depend clause on a target construct is associated with the target task and derives its dependences from
!   the storage locations of its list items; a variable of derived type with an allocated allocatable component is a legal list
!   item.
! "The target construct generates a target task. The generated task region encloses the target region. If a depend clause is
!   present, it is associated with the target task. The device clause determines the device on which the target region executes.
!   If the nowait clause is present," (5.2 §13.8 p.284 l.14-16)
! "The depend clause enforces additional constraints on the scheduling of tasks. These constraints establish dependences only
!   between sibling tasks. Task dependences are derived from the task-dependence-type and the list items." (5.2 §15.9.5 p.323
!   l.16-18)
! spec (this program): target nowait depend(inout: dr, hf1, ic, o1) with an empty body followed by taskwait is legal, dr being a
!   derived-type variable with an allocated allocatable component; AFAR crashes (SIGSEGV), and the program is correct when dr is
!   removed from the depend clause.

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

Observed where it behaves incorrectly

timeout: the monitored command dumped core

What the specification requires

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

OpenMP 5.2 §13.8 p.284 l.14-16

The target construct generates a target task. The generated task region encloses the target region. If a depend clause is present, it is associated with the target task. The device clause determines the device on which the target region executes. If the nowait clause is present,

OpenMP 5.2 §15.9.5 p.323 l.16-18

The depend clause enforces additional constraints on the scheduling of tasks. These constraints establish dependences only between sibling tasks. Task dependences are derived from the task-dependence-type and the list items.

Evidence

Same compiler, one change

  • dr removed from the depend 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
    program fuzz_prog
      implicit none
      integer, parameter :: n = 32, m = 5
      type :: rec_t
        integer, allocatable :: q(:)
      end type rec_t
      type(rec_t) :: dr
      integer, allocatable, target :: ic(:, :)
      integer, pointer :: o1(:)
      integer :: i, j, p1, hf1
      integer(8) :: cs
      allocate(ic(n, m))
      allocate(dr%q(n))
      allocate(o1(n))
      do j = 1, m
        do i = 1, n
          ic(i, j) = mod((i + 8 * j) * 26 + 35, 97) - 30
        end do
      end do
      do i = 1, n
        dr%q(i) = mod(i * 6 + 6, 1009) - 171
      end do
      o1 = 0
      p1 = -3
      hf1 = 0
      !$omp target nowait depend(in: p1) depend(inout: hf1, ic, o1)
      !$omp end target
      !$omp taskwait
      cs = 0
      do i = 1, n
        cs = modulo(cs * 31_8 + int(o1(i), 8), 2147483629_8)
      end do
      print '(a,i0)', 'RESULT checksum=', cs
    end program fuzz_prog
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0