OffTarget

Observed issues › afar-flang-task-reduction-max

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

amdflang: task_reduction(max: r) / in_reduction(max: r) rejected ("Internal: no symbol found for 'max'")

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.0not supportednot supportednot supportednot supportednot supportedn/an/a
CCE 19.0.0correctcorrectcorrectunknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectcorrectunknown
not run
unknown
not run
n/an/a
CCE 21.0.3fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayfails another wayunknown
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.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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 supportedAFAR 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
show
error: Semantic errors in afar-flang-task-reduction-max.f90
afar-flang-task-reduction-max.f90:5:34: error: Internal: no symbol found for 'max'
    !$omp taskgroup task_reduction(max: r)
                                   ^^^
afar-flang-task-reduction-max.f90:5:34: error: Invalid reduction identifier in TASK_REDUCTION clause.
    !$omp taskgroup task_reduction(max: r)
                                   ^^^
afar-flang-task-reduction-max.f90:6:31: error: Internal: no symbol found for 'max'
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
show
Warning:
 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_2688329//cooltmpdir-RsjWPw/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_2688329//cooltmpdir-RsjWPw/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_2688329//cooltmpdir-RsjWPw/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced 1 more times
fails another wayCCE 21.0.3, MI250X
show
Warning:
 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_3442575//cooltmpdir-NXemL3/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_3442575//cooltmpdir-NXemL3/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_3442575//cooltmpdir-NXemL3/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced 1 more times
fails another wayCCE 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..
lld: error: undefined symbol: _cray$mt_taskwait
>>> referenced by <dir>/pe_3528793//cooltmpdir-zhq1GM/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_3528793//cooltmpdir-zhq1GM/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_3528793//cooltmpdir-zhq1GM/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced 1 more times
fails another wayCCE 21.0.4, MI250X
show
Warning:
 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_3494603//cooltmpdir-YOma37/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_3494603//cooltmpdir-YOma37/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced by <dir>/pe_3494603//cooltmpdir-YOma37/repro-cce-openmppost_lld.amdgpu.lto.o:(p_$ck_L6_1)
>>> referenced 1 more times
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier task_reduction (afar-flang-task-reduction-max.f90: 5)
NVFORTRAN-S-0034-Syntax error at or near identifier in_reduction (afar-flang-task-reduction-max.f90: 6)
  0 inform,   0 warnings,   2 severes, 0 fatal for p
fails another wayGCC 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
show
libgomp: 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 (26 lines)
program p
  implicit none
  integer :: r, i
  r = 0
  !$omp taskgroup task_reduction(max: r)
    !$omp target in_reduction(max: r)
      do i = 1, 10
        r = max(r, i)
      end do
    !$omp end target
  !$omp end taskgroup
  print *, 'r =', r
end program p
! spec (requirement): In Fortran the intrinsic procedure names max and min are OpenMP reduction identifiers, usable
!   wherever a reduction identifier is.
! "following intrinsic procedure names: max, min, iand, ior, ieor." (5.2 §5.5.1 p.124 l.24)
! spec (requirement): The task_reduction clause on a taskgroup specifies a reduction among tasks.
! "The task_reduction clause is a reduction scoping clause, as described in Section 5.5.6, that specifies a reduction
!   among tasks." (5.2 §5.5.9 p.137 l.14-15)
! spec (requirement): An in_reduction clause makes a task a participant in a task reduction defined by an enclosing
!   task_reduction clause with the same reduction identifier.
! "defines a task to be a participant in a task reduction that is defined by an enclosing region for a matching list
!   item that appears in a task_reduction clause" (5.2 §5.5.10 p.138 l.11-13)
! spec (this program): task_reduction(max: r) on a taskgroup and in_reduction(max: r) on the enclosed target use the
!   intrinsic max as reduction identifier for an integer; amdflang rejects both clauses with Internal: no symbol found
!   for max.

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

error: Semantic errors in afar-flang-task-reduction-max.f90
afar-flang-task-reduction-max.f90:5:34: error: Internal: no symbol found for 'max'
    !$omp taskgroup task_reduction(max: r)
                                   ^^^
afar-flang-task-reduction-max.f90:5:34: error: Invalid reduction identifier in TASK_REDUCTION clause.
    !$omp taskgroup task_reduction(max: r)
                                   ^^^
afar-flang-task-reduction-max.f90:6:31: error: Internal: no symbol found for 'max'

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.24

following intrinsic procedure names: max, min, iand, ior, ieor.

OpenMP 5.2 §5.5.9 p.137 l.14-15

The task_reduction clause is a reduction scoping clause, as described in Section 5.5.6, that specifies a reduction among tasks.

OpenMP 5.2 §5.5.10 p.138 l.11-13

defines a task to be a participant in a task reduction that is defined by an enclosing region for a matching list item that appears in a task_reduction clause

Evidence

Same compiler, one change

  • the reduction identifier + instead of max (r = r + i): 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 p
      implicit none
      integer :: r, i
      r = 0
      !$omp taskgroup task_reduction(+: r)
        !$omp target in_reduction(+: r)
          do i = 1, 10
            r = r + i
          end do
        !$omp end target
      !$omp end taskgroup
      print *, 'r =', r
    end program p
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2