OffTarget

Observed issues › oop/cce-udr-derived-type-unsupported

Appears not to supportRefused at compile time · Fortran · OpenMP · Open

declare reduction on a derived type cannot be used in a target region

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

A user-defined reduction on a derived type (declare reduction with a function, subroutine or type-bound operator combiner) used on a target teams distribute parallel do is rejected by CCE 19, 20 and 21 ('Unsupported OpenMP construct'). AFAR and GCC compile and run all six forms 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.0not supportednot supportedunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2not supportednot supportedunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3not supportednot supportedunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4not supportednot supportedunknown
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
not supportedCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target teams distribute parallel do reduction(vsum: acc)
ftn-7032 ftn: ERROR OOP, File = site-oop--cce-udr-derived-type-unsupported.f90, Line = 51 
  Unsupported OpenMP construct Calls -- $udr_i_1OOP
not supportedCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target teams distribute parallel do reduction(vsum: acc)
ftn-7032 ftn: ERROR OOP, File = site-oop--cce-udr-derived-type-unsupported.f90, Line = 51 
  Unsupported OpenMP construct Calls -- $udr_i_1OOP
not supportedCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target teams distribute parallel do reduction(vsum: acc)
ftn-7032 ftn: ERROR OOP, File = site-oop--cce-udr-derived-type-unsupported.f90, Line = 51 
  Unsupported OpenMP construct Calls -- $udr_i_1OOP
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-W-0155-Unimplemented feature - DECLARE REDUCTION  (site-oop--cce-udr-derived-type-unsupported.f90: 45)
NVFORTRAN-S-0155-The reduction intrinsic must be MAX, MIN, IAND, IOR, or IEOR, not vsum (site-oop--cce-udr-derived-type-unsupported.f90: 51)
  0 inform,   1 warnings,   1 severes, 0 fatal for oop

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 (63 lines)
! # Finding (fortran-oop): declare reduction on a derived type is rejected in target loops (Unsupported OpenMP construct)
!
! - 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: rejected (not_implemented); OMP_TARGET_OFFLOAD=mandatory
! - observed: `Unsupported OpenMP construct Calls -- $udr_i_1OOP` for every combiner and initializer form (function, subroutine,
!   type-bound operator(+), default initialization, argmax, a parallel do inside target), every CCE release
! - expected: compiles; `r1= 2080 r2= 4160`
! - rule: 5.2 §5.5.11 p.139-140 (declare reduction on a derived type); the procedures it calls are declare target (§5.5.2 p.125
!   l.25-27)
! - other families: AFAR correct on all six (its earlier finding afar-udr-derived-type-link.f90 is a structure constructor
!   combiner); GCC 16.2 correct on all six
! - gate and confirmer: 48 cells, 48 confirmed in the gate's four environments (a-d; results/oop/main/gate_reruns*.jsonl);
!   confirmer (results/oop/main/confirm.jsonl): unsupported (R05-unsupported) 48
! - programs (6): oop-dreduce-function, oop-dreduce-subroutine, oop-dreduce-operator, oop-dreduce-default-init,
!   oop-dreduce-argmax, oop-dreduce-nested (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) (tools/campaigns/oop.py legality, results/oop/main/legality.json)
module oop_m
  implicit none
  integer, parameter :: n = 64
  type v2
    integer :: x = 0, y = 0
  end type v2
contains
  function vadd(a, b) result(c)
    !$omp declare target
    type(v2), intent(in) :: a, b
    type(v2) :: c
    c%x = a%x + b%x
    c%y = a%y + b%y
  end function vadd
end module oop_m

program oop
  use omp_lib
  use oop_m
  implicit none
  integer :: host_flag
  logical :: ok
  integer :: r1, r2
  type(v2) :: acc
  integer :: i
  !$omp declare reduction(vsum: v2: omp_out = vadd(omp_out, omp_in)) initializer(omp_priv = v2(0, 0))
  host_flag = 1
  !$omp target map(from: host_flag)
  host_flag = merge(1, 0, omp_is_initial_device())
  !$omp end target
  acc = v2(0, 0)
  !$omp target teams distribute parallel do reduction(vsum: acc)
  do i = 1, n
    acc = vadd(acc, v2(i, 2 * i))
  end do
  r1 = acc%x
  r2 = acc%y
  ok = .true.
  ok = ok .and. (r1 == 2080)
  ok = ok .and. (r2 == 4160)
  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

Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
  !$omp target teams distribute parallel do reduction(vsum: acc)
ftn-7032 ftn: ERROR OOP, File = site-oop--cce-udr-derived-type-unsupported.f90, Line = 51 
  Unsupported OpenMP construct Calls -- $udr_i_1OOP

What the specification requires

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

OpenMP 5.2 §5.5.11 p.139-140

OpenMP 5.2 §5.5.2 p.125 l.25-27

Evidence

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0