Observed issues › catalog/afar-flang-reduction-minus-rejected
Appears not to supportRefused at compile time · Fortran · OpenMP · Open
amdflang: the deprecated - reduction identifier in task_reduction/in_reduction is rejected as not supported
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
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 | not supported | not supported | not supported | not supported | not supported | n/a | n/a |
| CCE 19.0.0 | correct | correct | correct | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | correct | correct | correct | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| GCC 16.2.0 | fails another way | fails another way | fails another way | fails another way | fails another way | fails another way | 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 |
|---|---|---|
| not supported | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy AFAR 24.3.0, MI250X AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X | showerror: Semantic errors in afar-flang-reduction-minus-rejected.f90
afar-flang-reduction-minus-rejected.f90:22:19: error: The minus reduction operator is deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause.
!$omp taskgroup task_reduction(-: s)
^^^^^^^^^^^^^^^^^^^^
afar-flang-reduction-minus-rejected.f90:23:65: error: The minus reduction operator is deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause.
!$omp target map(to: a) map(from: b) map(tofrom: host_flag) in_reduction(-: s)
^^^^^^^^^^^^^^^^^^ |
| fails another way | CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. lld: error: undefined symbol: _cray$mt_taskwait >>> referenced by <dir>/pe_3262541//cooltmpdir-0NXlaN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3262541//cooltmpdir-0NXlaN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3262541//cooltmpdir-0NXlaN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced 1 more times |
| fails another way | CCE 21.0.3, MI250X | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. lld: error: undefined symbol: _cray$mt_taskwait >>> referenced by <dir>/pe_3759800//cooltmpdir-zyZOt4/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3759800//cooltmpdir-zyZOt4/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3759800//cooltmpdir-zyZOt4/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced 1 more times |
| fails another way | CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. lld: error: undefined symbol: _cray$mt_taskwait >>> referenced by <dir>/pe_3307692//cooltmpdir-gyo69J/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3307692//cooltmpdir-gyo69J/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3307692//cooltmpdir-gyo69J/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced 1 more times |
| fails another way | CCE 21.0.4, MI250X | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. lld: error: undefined symbol: _cray$mt_taskwait >>> referenced by <dir>/pe_3714721//cooltmpdir-WluOQN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3714721//cooltmpdir-WluOQN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced by <dir>/pe_3714721//cooltmpdir-WluOQN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L23_1) >>> referenced 1 more times |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | showNVFORTRAN-S-0034-Syntax error at or near identifier task_reduction (afar-flang-reduction-minus-rejected.f90: 22) NVFORTRAN-S-0034-Syntax error at or near identifier in_reduction (afar-flang-reduction-minus-rejected.f90: 23) 0 inform, 0 warnings, 2 severes, 0 fatal for gen_prog |
| fails another way | GCC 16.2.0, MI300A unified GCC 16.2.0, MI300A copy GCC 16.2.0, MI250X GCC 16.2.0, MI300X GCC 16.2.0, MI350X GCC 16.2.0, A100 separate | showlibgomp: OMP_TARGET_OFFLOAD is set to MANDATORY, but device not found |
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 (73 lines)
! # Draft finding: omp52-clause-in_reduction-minus on afar
!
! - compiler: afar
! - toolchain: afar; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
! - program: catalog omp52-clause-in_reduction-minus (f90, version 52, sha256 685f776281adfd53)
! - expected: None (None; )
! - actual: rejected (diagnostic: <tmpdir>/omp52-clause-in_reduction-minus.f90:31:19: error: The minus reduction operator is
! deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause.)
! - verdict: compiler_bug by rule R11-compile-rejection: a legal program the compiler rejects with a diagnostic (or whose link fails
! on symbols the compiler's own code needs, or whose compile does not finish) while another compiler family compiles it
! - reason:
! - citations: RUL-COMPILE-TIME (rulings.md)
! - legality: legal (legal by construction: offload.engine.gen / c_gen / acc_gen check every program against the catalog rules
! and the
! offload scope as it is built (no compiler))
! - witnesses: none
! - withdrawn: none
!
! Generated by compliance.gen (OpenMP 5.2, free-form Fortran). Do not edit.
! id: omp52-clause-in_reduction-minus
! primary atom: omp.clause.in_reduction.minus
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
program gen_prog
use omp_lib, only: omp_is_initial_device
implicit none
integer, parameter :: n = 64
integer, allocatable, target :: a(:), b(:)
integer :: ref(n)
integer :: i, host_flag
logical :: ok
integer :: s, sref
allocate(a(n), b(n))
do i = 1, n
a(i) = i
b(i) = 0
ref(i) = 2*i + 1
end do
host_flag = 1
s = 0
sref = 0
do i = 1, n
sref = sref - a(i)
end do
!$omp taskgroup task_reduction(-: s)
!$omp target map(to: a) map(from: b) map(tofrom: host_flag) in_reduction(-: s)
host_flag = merge(1, 0, omp_is_initial_device())
do i = 1, n
b(i) = 2*a(i) + 1
s = s - a(i)
end do
!$omp end target
!$omp end taskgroup
ok = all(b == ref) .and. (s == sref)
print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
deallocate(a, b)
end program gen_prog
! spec (requirement): The minus operator is still a reduction identifier in OpenMP 5.2 (deprecated, not removed), so a
! conforming compiler accepts it in reduction-type clauses.
! "following operators: +, - (deprecated), *, .and., .or., .eqv., .neqv." (5.2 §5.5.1 p.124 l.23)
! spec (requirement): The 5.2 list of changes states that the minus operator was deprecated, not removed.
! "The minus (-) operator for reductions was deprecated (see Section 5.5.5)." (5.2 §B.2 p.627 l.18)
! spec (requirement): The reduction identifier of task_reduction and in_reduction must match a previously declared
! identifier of the same name and type; Table 5.2 lists - (deprecated) as implicitly declared for Fortran numeric
! types.
! "The reduction identifier must match a previously declared reduction identifier of the same name and type for each
! of the list items." (5.2 §5.5.5 p.131 l.4-5)
! spec (this program): task_reduction(-: s) and in_reduction(-: s) use the deprecated but valid minus identifier;
! amdflang rejects it with a diagnostic that the minus reduction operator is not supported in the reduction clause.
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
error: Semantic errors in afar-flang-reduction-minus-rejected.f90
afar-flang-reduction-minus-rejected.f90:22:19: error: The minus reduction operator is deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause.
!$omp taskgroup task_reduction(-: s)
^^^^^^^^^^^^^^^^^^^^
afar-flang-reduction-minus-rejected.f90:23:65: error: The minus reduction operator is deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause.
!$omp target map(to: a) map(from: b) map(tofrom: host_flag) in_reduction(-: s)
^^^^^^^^^^^^^^^^^^What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §5.5.1 p.124 l.23
following operators: +, - (deprecated), *, .and., .or., .eqv., .neqv.
OpenMP 5.2 §B.2 p.627 l.18
The minus (-) operator for reductions was deprecated (see Section 5.5.5).
OpenMP 5.2 §5.5.5 p.131 l.4-5
The reduction identifier must match a previously declared reduction identifier of the same name and type for each of the list items.
Evidence
Same compiler, one change
- the reduction identifier + instead of -: AFAR 24.3.0: correct; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: fails another way; CCE 21.0.4: fails another way
Control program
program gen_prog use omp_lib, only: omp_is_initial_device implicit none integer, parameter :: n = 64 integer, allocatable, target :: a(:), b(:) integer :: ref(n) integer :: i, host_flag logical :: ok integer :: s, sref allocate(a(n), b(n)) do i = 1, n a(i) = i b(i) = 0 ref(i) = 2*i + 1 end do host_flag = 1 s = 0 sref = 0 do i = 1, n sref = sref - a(i) end do !$omp taskgroup task_reduction(+: s) !$omp target map(to: a) map(from: b) map(tofrom: host_flag) in_reduction(+: s) host_flag = merge(1, 0, omp_is_initial_device()) do i = 1, n b(i) = 2*a(i) + 1 s = s - a(i) end do !$omp end target !$omp end taskgroup ok = all(b == ref) .and. (s == sref) print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok) deallocate(a, b) end program gen_prog
Other compilers run it correctly
CCE 19.0.0, CCE 20.0.2