OffTarget

Observed issues › fuzz/698-afar

Appears to behave incorrectlyCrashes or aborts at run time · Fortran · OpenMP · Not reproduced in current runs

amdflang at HSA_XNACK=1: a parallel region with a reduction (or atomic) nested in a distribute loop of a reducing teams region aborts

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

Same issue as fuzz/916-afar; 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.0correctcorrectunknown
not run
correctcorrectn/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/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
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-0155-Unknown PROC_BIND type  (fuzz-698-afar.f90: 31)
  0 inform,   0 warnings,   1 severes, 0 fatal for fuzz_prog

Reproduce

AFAR 24.3.0, MI300A unified (runs correctly)

$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (63 lines)
! Minimized by compliance.fuzz_min from fuzz seed 698 (fuzz-1).
! toolchain: afar (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: run_error (crash: SIGABRT)
! expected: runs to completion (the host run does)
! : not reproducible on the current install (AFAR 24.3.0; reruns,
!   data/vendor/README.md: held, not reproducible); kept as a record.
! observed: device: fail crash: SIGABRT; host reference (afar/cce19) checksum=260035799
! Legal OpenMP 5.2: offload.engine.rules accepts it (offload.engine.prerun.check, rerun: with the
!   race rule and the restriction checks); NVHPC is no witness: it rejects it
!   (NVFORTRAN-S-0155-Unknown PROC_BIND type); 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.
program fuzz_prog
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 100, m = 5
  integer, allocatable :: ia(:)
  integer, allocatable :: ib(:)
  integer, allocatable :: ic(:, :)
  integer :: o1(n, m)
  integer :: i, j, r1a, r1b, hf1
  integer(8) :: cs
  allocate(ia(n))
  allocate(ib(n))
  allocate(ic(n, m))
  do i = 1, n
    ia(i) = mod(i * 12 + 1, 1009) - 250
  end do
  do i = 1, n
    ib(i) = mod(i * 54 + 38, 211) - 26
  end do
  do j = 1, m
    do i = 1, n
      ic(i, j) = mod((i + 6 * j) * 33 + 24, 1009) - 451
    end do
  end do
  o1 = 0
  r1a = -11
  r1b = 65535
  hf1 = 0
  ! fuzz: kernels
  !$omp target teams map(tofrom: hf1) reduction(max: r1a) reduction(iand: r1b)
    !$omp distribute dist_schedule(static, 2)
    do i = 1, n
      !$omp parallel do reduction(max: r1a) reduction(iand: r1b) num_threads(64) proc_bind(primary)
      do j = 1, m
        o1(i, j) = ia((mod(((j * 4) + 5), n) + 1))
        r1a = max(r1a, 0)
        r1b = iand(r1b, (ishft(iand(i, 1023), (-1)) + min(ic(i, (6 - j)), ic(i, (6 - j)))))
      end do
    end do
  !$omp end target teams
  ! fuzz: checksum
  cs = 0
  cs = modulo(cs * 31_8 + int(r1a, 8), 2147483629_8)
  cs = modulo(cs * 31_8 + int(r1b, 8), 2147483629_8)
  do j = 1, m
    do i = 1, n
      cs = modulo(cs * 31_8 + int(o1(i, j), 8), 2147483629_8)
    end do
  end do
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', max(hf1, 0)
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 fuzz/916-afar.

OpenMP 5.2 §5.5.8 p.135 l.4-10

For the teams construct, one or more private copies of each list item are created for the initial task of each team in the league, as if the private clause had been used. For the loop construct, private copies are created and used in the construct according to the description and restrictions in Section 5.3. At the end of a region that corresponds to a construct for which the reduction clause was specified, the original list item is updated by combining its original value with the final value of each of the private copies, using the combiner of the specified reduction-identifier.

OpenMP 5.2 §5.5.8 p.135 l.26-27

A list item that appears in a reduction clause on a worksharing construct must be shared in the parallel region to which a corresponding worksharing region binds.

Evidence

Other compilers run it correctly

AFAR 24.3.0, CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, GCC 16.2.0