OffTarget

Observed issues › fuzz/s1-4339-afar

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

AFAR offload runtime at HSA_XNACK=1: map(close, ...) breaks presence lookup and device access (abort, memory fault)

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

Same issue as fuzz/s1-9443-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.0behaves incorrectlycorrectunknown
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
behaves incorrectlyAFAR 24.3.0, MI300A unified
show
Warning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT
Display only launched kernel:
Kernel 'omp target in _QMmmPkp1 @ 13 (__omp_offloading_14_1c7066b3__QMmmPkp1_l13)'
OFFLOAD ERROR: memory access fault by GPU 6 (agent 0x5555556d35a0) at virtual address 0x1555450d0000. Reasons: Unknown (0)
Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations
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-0034-Syntax error at or near : (s1-4339-afar.f90: 13)
  0 inform,   0 warnings,   1 severes, 0 fatal for kp1

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 (74 lines)
! Finding: AFAR at HSA_XNACK=1 aborts (SIGABRT; in
! the campaign "OFFLOAD ERROR: memory access fault by GPU ... Write access
! to a read-only page") on a target construct with map(close, tofrom: ia)
! for an allocatable dummy ia that the region does not even reference,
! while the region reads another assumed-shape dummy (dsi, implicitly
! mapped tofrom). AFAR at HSA_XNACK=0 and CCE 19/20/21 in both modes print
! "RESULT check=pass".
!
! Legal OpenMP 5.2: close is a map-type modifier that is a hint ("The close
! map-type-modifier is a hint to the runtime to allocate memory close to
! the target device", 5.2 §5.8.3 p.155 l.12); an
! assumed-shape dummy referenced in the region is mapped tofrom implicitly
! (5.2 §5.8.1).
!
! Observed (tuolumne, MI300A, -O2, 2026-10-23, results/t28_probe/close/
! c4339_*.f90.*.json): this program (c4339_c) aborts on AFAR at
! HSA_XNACK=1 on every run and passes at HSA_XNACK=0; without close
! (c4339_b) it passes; with an explicit-shape ia (c4339_d) it passes; with
! the region reading ia instead of the other dummy (c4339_e) it passes; the
! derived-type dummy of the reduction (c4339_a) aborts the same way. The
! close + present abort of fuzz/158-afar.f90 is another symptom of AFAR's
! close handling at HSA_XNACK=1 (no present modifier here).
! From s1 seed 4339 (the smallest program of the s1 group "AFAR memory
! access fault", 59 compiler_bug cells): tools/campaigns/fuzz.py minimize-one,
! 141 -> 91 lines (data/evidence/dataenv_probe/rt/4339-afar.f90), then by hand.
! Expected: "RESULT check=pass".
!
! amdflang -fopenmp --offload-arch=gfx942 -O2 (afar recipe, offload/engine/toolchains.py)
module mm
  implicit none
  integer, parameter :: n = 128
  type :: el_t
    integer :: u
  end type el_t
contains
  subroutine kp1(ia, o1, dsi)
    integer, allocatable, intent(inout) :: ia(:)
    integer, intent(inout) :: o1(:)
    integer, intent(in) :: dsi(:)
    integer :: i
    !$omp target map(close, tofrom: ia) map(tofrom: o1)
      do i = 1, n
        o1(i) = dsi(i)
      end do
    !$omp end target
  end subroutine kp1
end module mm
program p
  use mm
  implicit none
  type(el_t) :: ds(n)
  integer :: dsi(n)
  integer, allocatable :: ia(:)
  integer, pointer :: o1(:)
  integer :: i
  logical :: ok
  allocate(ia(n))
  ia = 1
  allocate(o1(n))
  do i = 1, n
    dsi(i) = mod(i * 26 + 31, 97) - 21
  end do
  o1 = 0
  call kp1(ia, o1, dsi)
  ok = .true.
  do i = 1, n
    ok = ok .and. o1(i) == mod(i * 26 + 31, 97) - 21
  end do
  if (ok) then
    print '(a)', 'RESULT check=pass'
  else
    print '(a)', 'RESULT check=fail'
  end if
end program p

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

Expected

RESULT check=pass

Observed where it behaves incorrectly

Warning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT
Display only launched kernel:
Kernel 'omp target in _QMmmPkp1 @ 13 (__omp_offloading_14_1c7066b3__QMmmPkp1_l13)'
OFFLOAD ERROR: memory access fault by GPU 6 (agent 0x5555556d35a0) at virtual address 0x1555450d0000. Reasons: Unknown (0)
Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations

What the specification requires

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

OpenMP 5.2 §5.8.3 p.155 l.12

The close map-type-modifier is a hint to the runtime to allocate memory close to the target device

OpenMP 5.2 §5.8.1

Evidence

Same compiler, one change

  • map(tofrom: ia) without the close modifier: 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
    module mm
      implicit none
      integer, parameter :: n = 128
      type :: el_t
        integer :: u
      end type el_t
    contains
      subroutine kp1(ia, o1, dsi)
        integer, allocatable, intent(inout) :: ia(:)
        integer, intent(inout) :: o1(:)
        integer, intent(in) :: dsi(:)
        integer :: i
        !$omp target map(tofrom: ia) map(tofrom: o1)
          do i = 1, n
            o1(i) = dsi(i)
          end do
        !$omp end target
      end subroutine kp1
    end module mm
    program p
      use mm
      implicit none
      type(el_t) :: ds(n)
      integer :: dsi(n)
      integer, allocatable :: ia(:)
      integer, pointer :: o1(:)
      integer :: i
      logical :: ok
      allocate(ia(n))
      ia = 1
      allocate(o1(n))
      do i = 1, n
        dsi(i) = mod(i * 26 + 31, 97) - 21
      end do
      o1 = 0
      call kp1(ia, o1, dsi)
      ok = .true.
      do i = 1, n
        ok = ok .and. o1(i) == mod(i * 26 + 31, 97) - 21
      end do
      if (ok) then
        print '(a)', 'RESULT check=pass'
      else
        print '(a)', 'RESULT check=fail'
      end if
    end program p
    

Other compilers run it correctly

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