OffTarget

Observed issues › oop/cce-section-of-element-component-overlap

Appears to behave incorrectlyRun-time error · Fortran · OpenMP · Open

mapping the allocatable component of an array element aborts as a partial overlap

Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked

map(tofrom: v(2)%a(5:20)) (v an array of structures with an allocatable component; the whole component v(2)%a too) aborts at the target construct on CCE 19, 20 and 21 in both memory modes: the runtime reports that the host region overlaps a present region but is not contained in it. Mapping the whole array v works. AFAR and GCC run it correctly.

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/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 incorrectlyCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
show
ACC: libcrayacc/acc_present.c:762 CRAY_ACC_ERROR - Host region (409400 to 4094f0) overlaps present region (409450 to 4094a0 index 1) but is not contained for 't$2(:)' from site-oop--cce-section-of-ele
behaves incorrectlyCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
show
ACC: libcrayacc/acc_present.c:762 CRAY_ACC_ERROR - Host region (408400 to 4084f0) overlaps present region (408450 to 4084a0 index 1) but is not contained for 't$2(:)' from site-oop--cce-section-of-ele
behaves incorrectlyCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
ACC: libcrayacc/acc_present.c:762 CRAY_ACC_ERROR - Host region (408440 to 408530) overlaps present region (408490 to 4084e0 index 1) but is not contained for 't$3(:)' from site-oop--cce-section-of-ele

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 (69 lines)
! # Finding (fortran-oop): mapping the allocatable component of an array element aborts: 'overlaps present region'
!
! - toolchains and modes that fail: cce19 (CCE 19.0.0: copy, unified), cce20 (CCE 20.0.2: copy, unified), cce21 (CCE 21.0.3: copy,
!   unified), cce21_4 (CCE 21.0.4: copy, unified); -O2
! - build: ftn -fopenmp -O2 (module load cce/<v> craype-accel-amd-gfx942 rocm/<r>; OpenACC: ftn -h acc)
! - failure: run_error (exit 1); OMP_TARGET_OFFLOAD=mandatory
! - observed: `CRAY_ACC_ERROR - Host region ... overlaps present region ... but is not contained for 't$2(:)'` at the target
!   construct, every CCE release, both modes. Mapping the whole component v(2)%a instead of its section
!   (controls/section-element-whole-component.f90) stops with the same message in every environment a-d
!   (results/oop/probe/ctl2.*.section-element-whole-component.*.jsonl): the defect is the component of an array element, not
!   the section
! - expected: `r1= 2880 r2= 2080`
! - rule: 5.2 §5.8.3 p.151 l.13; the construct maps one list item, so no earlier storage overlaps it (§5.8.3 p.156 l.19-22 is
!   about storage present before the construct)
! - same-compiler control: the same program mapping the whole array v (controls/section-element-whole-array.f90, one change:
!   map(tofrom: v), whose default mapper maps each element's component): correct (check=pass) on CCE 19, 20, 21.0.3 and 21.0.4 in
!   both modes, in the stored run and the gate's four environments a-d with (c) on another node
!   (results/oop/probe/ctl2.*.section-element-whole-array.*.jsonl)
! - other families: AFAR and GCC 16.2 correct; related to harvest/cce-c-implicit-struct-map-partly-present.c (the same runtime
!   message for a structure whose members are present)
! - gate and confirmer: 8 cells, 8 confirmed in the gate's four environments (a-d; results/oop/main/gate_reruns*.jsonl); confirmer
!   (results/oop/main/confirm.jsonl): needs_human (R22-expected-weak) 8; R22-expected-weak means the expected value has one
!   source, the generator's Python model; the values follow from the program's arithmetic (checked by hand), and AFAR, GCC 16.2
!   (gfx90a), GCC 16.2 (sm_80), NVHPC 25.11, NVHPC 26.9 print them on this program
! - programs (1): oop-section-element (offload/engine/oop_gen.py; this file is the first one)
! - legality: for the cce cells: the rules (offload.engine.rules, with the fortran-oop restrictions) and AFAR's flang front end
!   (-fsyntax-only) and NVHPC 26.9 nvfortran (compile only) (tools/campaigns/oop.py legality, results/oop/main/legality.json)
module oop_m
  implicit none
  integer, parameter :: n = 64
  type vec
    integer :: n = 0
    integer, allocatable :: a(:)
  end type vec
end module oop_m

program oop
  use omp_lib
  use oop_m
  implicit none
  integer :: host_flag
  logical :: ok
  integer :: r1, r2
  type(vec) :: v(3)
  integer :: i, k
  host_flag = 1
  !$omp target map(from: host_flag)
  host_flag = merge(1, 0, omp_is_initial_device())
  !$omp end target
  do k = 1, 3
    allocate(v(k)%a(n))
    v(k)%n = n
    do i = 1, n
      v(k)%a(i) = i
    end do
  end do
  !$omp target teams distribute parallel do map(tofrom: v(2)%a(5:20))
  do i = 5, 20
    v(2)%a(i) = v(2)%a(i) + 50
  end do
  r1 = sum(v(2)%a)
  r2 = sum(v(1)%a)
  ok = .true.
  ok = ok .and. (r1 == 2880)
  ok = ok .and. (r2 == 2080)
  print '(a,i0)', 'r1= ', r1
  print '(a,i0)', 'r2= ', r2
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program oop

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

ACC: libcrayacc/acc_present.c:762 CRAY_ACC_ERROR - Host region (409400 to 4094f0) overlaps present region (409450 to 4094a0 index 1) but is not contained for 't$2(:)' from site-oop--cce-section-of-ele

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.151 l.13

OpenMP 5.2 §5.8.3 p.156 l.19-22

Evidence

Same compiler, one change

  • the same program mapping the whole array v: not run yet
    Control program
    ! control for oop-section-element: the same program; one change: map(tofrom: v) (the whole array of structures, which
    ! maps every element's allocatable component through the default mapper) for the section v(2)%a(5:20)
    ! fortran-oop section/element (OpenMP 5.2, free-form Fortran):
    ! map(tofrom: v(2)%a(5:20)): a section of the allocatable component of an array element
    ! spec: OpenMP 5.2 §5.8.3 p.151 l.13 (structure elements and array sections are list items); §5.8.3
    !   p.157 l.21-22
    ! legality: defined
    ! expected (computed by compliance/oop_gen.py): r1= 2880, r2= 2080
    module oop_m
      implicit none
      integer, parameter :: n = 64
      type vec
        integer :: n = 0
        integer, allocatable :: a(:)
      end type vec
    end module oop_m
    
    program oop
      use omp_lib
      use oop_m
      implicit none
      integer :: host_flag
      logical :: ok
      integer :: r1, r2
      type(vec) :: v(3)
      integer :: i, k
      host_flag = 1
      !$omp target map(from: host_flag)
      host_flag = merge(1, 0, omp_is_initial_device())
      !$omp end target
      do k = 1, 3
        allocate(v(k)%a(n))
        v(k)%n = n
        do i = 1, n
          v(k)%a(i) = i
        end do
      end do
      !$omp target teams distribute parallel do map(tofrom: v)
      do i = 5, 20
        v(2)%a(i) = v(2)%a(i) + 50
      end do
      r1 = sum(v(2)%a)
      r2 = sum(v(1)%a)
      ok = .true.
      ok = ok .and. (r1 == 2880)
      ok = ok .and. (r2 == 2080)
      print '(a,i0)', 'r1= ', r1
      print '(a,i0)', 'r2= ', r2
      print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
    end program oop
    

Other compilers run it correctly

AFAR 24.3.0, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0