OffTarget

Observed issues › fuzz/1978-cce19

Appears to behave incorrectlyWrong answer · Fortran · OpenMP · Open

An array mapped always, from next to defaultmap(firstprivate: aggregate) is not copied back (fuzz seed 1978)

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.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.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/abehaves incorrectlybehaves incorrectly
NVHPC 26.9n/an/an/an/an/abehaves incorrectlybehaves incorrectly
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
NVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
RESULT checksum=0

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

NVHPC 25.11, A100 separate

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

NVHPC 26.9, A100 separate

export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib
nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
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 (38 lines)
! Minimized by compliance.fuzz_min from fuzz seed 1978 (fuzz-1).
! toolchain: cce19 (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: wrong_code
! expected: the host reference checksum (host reference (cce20/cce21) checksum=1879642524)
! 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.
program fuzz_prog
  implicit none
  integer, parameter :: n = 24, m = 5
  integer :: o1(n)
  integer :: i, j, jj, acc1
  integer(8) :: cs
  o1 = 0
  ! fuzz: kernels
  !$omp target map(always, from: o1) defaultmap(firstprivate: aggregate) private(acc1, jj)
  do i = n, 1, -1
    acc1 = 0
    o1(i) = i
  end do
  !$omp end target
  ! 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=', 0
end program fuzz_prog
! spec (requirement): explicit data-environment attribute clauses on a target construct determine the attributes of the
!   variables they name, and the implicit rules, including defaultmap, apply only to the variables that no explicit clause names,
!   so map(always, from: o1) copies the device array back whatever defaultmap(firstprivate: aggregate) says.
! "When specified, explicit data-environment attribute clauses on target directives determine the attributes for variables
!   referenced in a target construct." (5.2 §5.8.1 p.148 l.2-3)
! "If a defaultmap clause is present for the category of the variable and specifies an implicit behavior other than default, the
!   data-mapping or data-sharing attribute is determined by that clause." (5.2 §5.8.1 p.148 l.18-20)
! spec (this program): o1 is mapped explicitly with map(always, from: o1) and defaultmap(firstprivate: aggregate) must not
!   change that; CCE 19 returns checksum 0 instead of the host's 1879642524.

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 l.2-3

When specified, explicit data-environment attribute clauses on target directives determine the attributes for variables referenced in a target construct.

OpenMP 5.2 §5.8.1 p.148 l.18-20

If a defaultmap clause is present for the category of the variable and specifies an implicit behavior other than default, the data-mapping or data-sharing attribute is determined by that clause.

Evidence

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0