Observed issues › oop/cce21-element-component-map-lost
a component of an array element mapped tofrom does not come back (CCE 21, both memory modes)
Legality: not independently confirmed. no independent review yet How this is checked
Same issue as oop/cce-element-component-map-lost; this program is another reproducer of it.
map(tofrom: vk(4)%g(3)), an element of a component of an element of an array of structures: the target region's write is lost on CCE 21.0.3 and 21.0.4 with separate and with unified memory. Mapping the whole element vk(5) works. AFAR and GCC are correct.
Affected variants
| Compiler | MI300A 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.0 | correct | correct | unknown not run | correct | correct | n/a | n/a |
| CCE 19.0.0 | correct | behaves incorrectly | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | correct | behaves incorrectly | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | behaves incorrectly | behaves incorrectly | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | behaves incorrectly | behaves incorrectly | unknown not run | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | correct | correct |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | correct | correct |
| GCC 16.2.0 | correct | correct | correct | correct | correct | correct | n/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
| Result | Compiler and GPU | Message |
|---|---|---|
| behaves incorrectly | CCE 19.0.0, MI300A copy CCE 20.0.2, MI300A copy CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy | showr1= 0 r2= 0 RESULT ran_on_host=0 check=fail |
Reproduce
CCE 19.0.0, MI300A copy
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=0 OMP_TARGET_OFFLOAD=mandatory ./repro
CCE 20.0.2, MI300A copy
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=0 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 (54 lines)
! # Finding (fortran-oop): map(tofrom: vk(4)%g(3)) of a component of an array element does not reach the host (CCE 21, both modes)
!
! - toolchains and modes that fail: 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: wrong_answer (check=fail); OMP_TARGET_OFFLOAD=mandatory
! - observed: `r1= 0 r2= 0` on CCE 21.0.3 and 21.0.4 at HSA_XNACK=0 and 1; the same for a section vk(5)%g(3:5). The nested form
! vk(4)%h%c(8) is an internal compiler error on CCE 21 instead, linked to fuzz/s1-3463-cce21.f90 by the confirmer and not
! counted here
! - expected: `r1= 74 r2= 74`
! - rule: 5.2 §5.8.3 p.151 l.13; §5.8.3 p.154 exit step 1a
! - same-compiler control: the whole element map(tofrom: vk(5)) (controls/elemsec-element.f90): correct on CCE 21 in both modes
! (results/oop/main/rows.part*.jsonl)
! - other families: AFAR and GCC 16.2 correct; CCE 19 and 20 fail at HSA_XNACK=0 only
! - 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 (2): oop-elemsec-comp-element, oop-elemsec-comp-section (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 dc
integer :: g(20) = 0
integer :: i = 0
end type dc
end module oop_m
program oop
use omp_lib
use oop_m
implicit none
integer :: host_flag
logical :: ok
integer :: r1, r2
type(dc) :: vk(5)
integer :: l
host_flag = 1
!$omp target map(from: host_flag)
host_flag = merge(1, 0, omp_is_initial_device())
!$omp end target
!$omp target map(tofrom: vk(4)%g(3))
vk(4)%g(3) = 74
!$omp end target
r1 = vk(4)%g(3)
r2 = sum(vk(4)%g)
ok = .true.
ok = ok .and. (r1 == 74)
ok = ok .and. (r2 == 74)
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
Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page
Expected and observed
Expected
r1= 74
Observed where it behaves incorrectly
r1= 0 r2= 0 RESULT ran_on_host=0 check=fail
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.154
Evidence
Same compiler, one change
- the whole array element instead of a component of it: not run yet
Control program
! control (fortran-oop family program oop-elemsec-element, correct on every CCE in both modes) ! fortran-oop elemsec/element (OpenMP 5.2, free-form Fortran): ! map(tofrom: vk(5)): one element of an array of structures ! 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; OpenMP 5.2 §5.8.3 p.151-155 (map clause) ! legality: defined ! expected (computed by compliance/oop_gen.py): r1= 610, r2= 40, r3= 0 module oop_m implicit none integer, parameter :: n = 64 type dc integer :: g(20) = 0 integer :: i = 0 end type dc end module oop_m program oop use omp_lib use oop_m implicit none integer :: host_flag logical :: ok integer :: r1, r2, r3 type(dc) :: vk(5) integer :: l host_flag = 1 !$omp target map(from: host_flag) host_flag = merge(1, 0, omp_is_initial_device()) !$omp end target !$omp target map(tofrom: vk(5)) do l = 1, 20 vk(5)%g(l) = 20 + l end do vk(5)%i = 40 !$omp end target r1 = sum(vk(5)%g) r2 = vk(5)%i r3 = sum(vk(4)%g) ok = .true. ok = ok .and. (r1 == 610) ok = ok .and. (r2 == 40) ok = ok .and. (r3 == 0) print '(a,i0)', 'r1= ', r1 print '(a,i0)', 'r2= ', r2 print '(a,i0)', 'r3= ', r3 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