OffTarget

Observed issues › fuzz/b3-197-cce19

Appears to behave incorrectlyCrashes or aborts at run time · Fortran · OpenMP · Changed in 21.0.3

ftn: a target construct with in_reduction in an internal subroutine loses the writes to an implicitly mapped dummy array

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

Same issue as fuzz/b3-61-cce20; 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.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.3fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayunknown
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.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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
show
Memory access fault by GPU node-5 (Agent handle: 0x56fdf0) on address (nil). Reason: Unknown.
behaves incorrectlyCCE 19.0.0, MI300A copy
show
Memory access fault by GPU node-4 (Agent handle: 0x56fdf0) on address (nil). Reason: Unknown.
behaves incorrectlyCCE 20.0.2, MI300A unified
show
Memory access fault by GPU node-6 (Agent handle: 0x5620f0) on address (nil). Reason: Unknown.
behaves incorrectlyCCE 20.0.2, MI300A copy
show
Memory access fault by GPU node-5 (Agent handle: 0x5620f0) on address (nil). Reason: Unknown.
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.4, MI300A unified
show
ACC: libcrayacc/acc_hw_amd.c:1927 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorIllegalAddress: 'an illegal memory access was encountered' from fuzz-b3-197-cce19.f90:54
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorIllegalAddress: 'an illegal memory access was encountered'
fails another wayCCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A copy
show
ACC: libcrayacc/acc_hw_amd.c:1496 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorIllegalAddress: 'an illegal memory access was encountered' from fuzz-b3-197-cce19.f90:59
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorIllegalAddress: 'an illegal memory access was encountered'
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier task_reduction (fuzz-b3-197-cce19.f90: 53)
NVFORTRAN-S-0034-Syntax error at or near identifier in_reduction (fuzz-b3-197-cce19.f90: 54)
NVFORTRAN/x86-64 Linux 25.11-0: compilation completed with severe errors
fails another wayNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier task_reduction (fuzz-b3-197-cce19.f90: 53)
NVFORTRAN-S-0034-Syntax error at or near identifier in_reduction (fuzz-b3-197-cce19.f90: 54)
NVFORTRAN/x86-64 Linux 26.9-0: compilation completed with severe errors
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI250X
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
GCC 16.2.0, A100 separate
show
libgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but device not found

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

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 (73 lines)
! Minimized by compliance.fuzz_min from fuzz seed 197 (fuzz-3).
! toolchain: cce19 (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: run_error (crash: SIGABRT)
! expected: runs to completion (the host run does)
! observed: device: fail crash: SIGABRT; host reference (afar) checksum=1030200169
! 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: cce20
program fuzz_prog
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 16, m = 3
  integer, target :: ib(n)
  integer, target :: ic(n, m)
  integer, allocatable :: as1
  integer, allocatable :: o2(:)
  integer, pointer :: o3(:)
  integer, allocatable :: o4(:)
  integer, target :: o3t(n)
  integer :: i, j, r4a, hf4
  integer(8) :: cs
  allocate(o2(n))
  allocate(o4(n))
  allocate(as1)
  o3 => o3t
  do i = 1, n
    ib(i) = mod(i * 52 + 34, 211) - 23
  end do
  do j = 1, m
    do i = 1, n
      ic(i, j) = mod((i + 7 * j) * 58 + 25, 101) - 21
    end do
  end do
  as1 = 20
  o2 = 0
  o3 = 0
  o4 = 0
  r4a = 3
  hf4 = 0
  ! fuzz: kernels
  call kp1(as1, ib, ic, o2, o3, o4)
  ! fuzz: checksum
  cs = 0
  do i = 1, n
    cs = modulo(cs * 31_8 + int(o2(i), 8), 2147483629_8)
  end do
  do i = 1, n
    cs = modulo(cs * 31_8 + int(o3t(i), 8), 2147483629_8)
  end do
  cs = modulo(cs * 31_8 + int(r4a, 8), 2147483629_8)
  do i = 1, n
    cs = modulo(cs * 31_8 + int(o4(i), 8), 2147483629_8)
  end do
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', max(hf4, 0)
contains
  subroutine kp1(as1, ib, ic, o2, o3, o4)
    integer, intent(inout) :: as1
    integer, intent(inout) :: ib(:)
    integer, intent(in) :: ic(:, :)
    integer, intent(in) :: o2(:)
    integer, intent(inout) :: o3(:)
    integer, intent(inout) :: o4(:)
    !$omp taskgroup task_reduction(+: r4a)
      !$omp target map(tofrom: hf4) in_reduction(+: r4a)
        hf4 = merge(1, 0, omp_is_initial_device())
        do i = 1, n
          o4(i) = mod(iand(o3((mod(((i * 3) + 5), n) + 1)), 1023), 97)
        end do
      !$omp end target
    !$omp end taskgroup
  end subroutine kp1
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

Memory access fault by GPU node-5 (Agent handle: 0x56fdf0) on address (nil). Reason: Unknown.

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/b3-61-cce20.

OpenMP 5.2 §5.8.1 p.149 l.4-5

If a variable is not a scalar then it is treated as if it had appeared in a map clause with a map-type of tofrom.

OpenMP 5.2 §5.8.1 p.148 l.15-17

If a variable is the base variable of a list item in an in_reduction clause on a target construct then it is treated as if the list item had appeared in a map clause with a map-type of tofrom and a map-type-modifier of always.

Evidence

Other compilers run it correctly

AFAR 24.3.0