OffTarget

Observed issues › afar-xnack1-target-is-present

Appears to behave incorrectlyWrong answer · Fortran · OpenMP · Open

AFAR offload runtime at HSA_XNACK=1: omp_target_is_present returns false after target enter data, and map(present) of an absent item does not terminate

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.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/acorrectcorrect
NVHPC 26.9n/an/an/an/an/acorrectcorrect
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
 after enter data: present= 0
 after exit data: present= 0

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 (42 lines)
! AFAR reports nothing present in the device data
! environment at HSA_XNACK=1 (unified memory).
! After target enter data map(to: a), a has corresponding storage in the
! device data environment, so omp_target_is_present must return true
! (5.2 §18.8.3 p.389: "returns true if ... ptr refers to storage that has
! corresponding storage in the device data environment"); after target
! exit data map(release: a) it must return false. The program has no
! requires directive.
! Expected: after enter data: present= 1, after exit data: present= 0
! Observed (tuolumne, MI300A, 2026-10-22, 3 runs each, -O2,
! OMP_TARGET_OFFLOAD=mandatory):
! - AFAR amdflang 24.0.0git at HSA_XNACK=1: present= 0 after enter data;
!   at HSA_XNACK=0: present= 1, as required. AFAR amdclang the same (C
!   reproducer: afar-c-xnack1-target-is-present.c).
! - CCE 19.0.0, 20.0.2, 21.0.3: present= 1 / 0 in both modes.
! The catalog's copy-mode programs skip their presence checks at
! HSA_XNACK=1; run with the presence checks at HSA_XNACK=1
! (tools/campaigns/presence_x1.py, tests/data/presence_x1_summary.json) every one of
! them fails on AFAR (Fortran and C map alloc/delete/release, target data,
! target enter/exit data, map iterator) and passes on CCE except the C
! map.delete programs (cce-c-map-delete-refcount.c). Those AFAR cells are
! correct at HSA_XNACK=0 only (portable verdict x0_only): 31 cells (19
! Fortran, 12 C; with C map.iterator and transparent 34 presence cells)
! that are ONE bug counted once per feature. The 5.2 basis:
! entering a map creates a corresponding storage block with a reference
! count even when it shares storage with the original (5.2 §5.8.3 p.153),
! and the routine reports that block (§18.8.3 p.389).
! AFAR: amdflang -fopenmp --offload-arch=gfx942 -O2
! Run:  OMP_TARGET_OFFLOAD=mandatory HSA_XNACK=1 ./a.out
program p
  use omp_lib
  use, intrinsic :: iso_c_binding, only: c_loc
  implicit none
  integer, target :: a(64)
  integer :: d
  a = 1
  d = omp_get_default_device()
  !$omp target enter data map(to: a)
  print *, 'after enter data: present=', omp_target_is_present(c_loc(a), d)
  !$omp target exit data map(release: a)
  print *, 'after exit data: present=', omp_target_is_present(c_loc(a), d)
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

Observed where it behaves incorrectly

 after enter data: present= 0
 after exit data: present= 0

What the specification requires

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

OpenMP 5.2 §18.8.3 p.389

returns true if ... ptr refers to storage that has corresponding storage in the device data environment

OpenMP 5.2 §5.8.3 p.153

OpenMP 5.2 §18.8.3 p.389

Evidence

Same compiler, one change

  • run at HSA_XNACK=0: 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 p
      use omp_lib
      use, intrinsic :: iso_c_binding, only: c_loc
      implicit none
      integer, target :: a(64)
      integer :: d
      a = 1
      d = omp_get_default_device()
      !$omp target enter data map(to: a)
      print *, 'after enter data: present=', omp_target_is_present(c_loc(a), d)
      !$omp target exit data map(release: a)
      print *, 'after exit data: present=', omp_target_is_present(c_loc(a), d)
    end program p
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0

Reproducers of this issue