OffTarget

Observed issues › fuzz/b2-85-cce20

Mixed evidenceWrong answer · Fortran · OpenMP · Mixed evidence

A minimized program with defaultmap and teams distribute computes checksum 0 on the device (fuzz seed 85)

Legality: not independently confirmed. Independent readings are uncertain: The program is race-free: distinct dr%o1(i) per iteration, t1 private. dr%o1 is explicitly mapped tofrom, and the data-environment attribute clause is stated to take precedence over implicit rules. How this is checked

Mixed evidence

rests on reading map(tofrom: dr%o1) as an explicit attribute of the structure dr; 5.2 §5.8.1 p.148 treats a reference to a structure element as a reference to the structure when implicit attributes are determined, so defaultmap(firstprivate: aggregate) may apply to dr

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.0behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2behaves incorrectlybehaves incorrectlyunknown
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/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 incorrectlyCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
RESULT checksum=0
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
show
NVFORTRAN-F-1225-Unmatched directive END - TARGET. (fuzz-b2-85-cce20.f90: 30)
NVFORTRAN/x86-64 Linux 25.11-0: compilation aborted
fails another wayNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-F-1225-Unmatched directive END - TARGET. (fuzz-b2-85-cce20.f90: 30)
NVFORTRAN/x86-64 Linux 26.9-0: compilation aborted

Reproduce

CCE 19.0.0, MI300A unified

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

CCE 20.0.2, MI300A unified

module load cce/20.0.2 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

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

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 (48 lines)
! Minimized by compliance.fuzz_min from fuzz seed 85 (fuzz-3).
! toolchain: cce20 (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: wrong_code
! expected: the host reference checksum (host reference (afar) checksum=1901273453)
! observed: device checksum=0 ran_on_host=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.
! also fails on: cce19, cce21
program fuzz_prog
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 48, m = 8
  type :: rec_t
    integer :: o1(n)
  end type rec_t
  type(rec_t) :: dr
  integer, allocatable :: ib(:)
  integer :: ic(n, m)
  integer :: i, j, p1, t1
  integer(8) :: cs
  allocate(ib(n))
  do i = 1, n
    ib(i) = mod(i * 51 + 10, 101) - 15
  end do
  do j = 1, m
    do i = 1, n
      ic(i, j) = mod((i + 8 * j) * 55 + 11, 211) - 18
    end do
  end do
  dr%o1 = 0
  p1 = -6
  ! fuzz: kernels
  !$omp target map(tofrom: dr%o1) map(to: ic) defaultmap(firstprivate: aggregate)
    !$omp teams distribute private(t1)
    do i = n, 1, -1
      t1 = 0
      dr%o1(i) = mod((mod((ic((mod(((i * 2) + 6), n) + 1), (mod(((i * 3) + 3), m) + 1)) + t1), 7) - &
          & ior((2 + ib(i)), mod(p1, 7))), 1009)
    end do
  !$omp end target
  ! fuzz: checksum
  cs = 0
  do i = 1, n
    cs = modulo(cs * 31_8 + int(dr%o1(i), 8), 2147483629_8)
  end do
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', 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

Expected and observed

Observed where it behaves incorrectly

RESULT checksum=0

What the specification requires

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

OpenMP 5.2 §5.8.1 p.148

Evidence

Same compiler, one change

  • defaultmap(firstprivate: 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 fuzz_prog
      implicit none
      integer, parameter :: n = 48, m = 8
      type :: rec_t
        integer :: o1(n)
      end type rec_t
      type(rec_t) :: dr
      integer, allocatable :: ib(:)
      integer :: ic(n, m)
      integer :: i, j, p1, t1
      integer(8) :: cs
      allocate(ib(n))
      do i = 1, n
        ib(i) = mod(i * 51 + 10, 101) - 15
      end do
      do j = 1, m
        do i = 1, n
          ic(i, j) = mod((i + 8 * j) * 55 + 11, 211) - 18
        end do
      end do
      dr%o1 = 0
      p1 = -6
      !$omp target map(tofrom: dr%o1) map(to: ic)
        !$omp teams distribute private(t1)
        do i = n, 1, -1
          t1 = 0
          dr%o1(i) = mod((mod((ic((mod(((i * 2) + 6), n) + 1), (mod(((i * 3) + 3), m) + 1)) + t1), 7) - &
              & ior((2 + ib(i)), mod(p1, 7))), 1009)
        end do
      !$omp end target
      cs = 0
      do i = 1, n
        cs = modulo(cs * 31_8 + int(dr%o1(i), 8), 2147483629_8)
      end do
      print '(a,i0)', 'RESULT checksum=', cs
    end program fuzz_prog
    

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0