OffTarget

Observed issues › catalog/afar-flang-reduction-task-ice

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

amdflang: "Call parameter type does not match function signature!" for sections, and for reduction(task), in a target region

Legality: not independently confirmed. no independent review yet How this is checked

Same issue as catalog/afar-flang-sections-in-target-ice; this program is another reproducer of it.

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.0behaves incorrectlybehaves incorrectlybehaves incorrectlybehaves incorrectlybehaves incorrectlyn/an/a
CCE 19.0.0fails another wayfails another wayfails another wayunknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayfails another wayunknown
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.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 incorrectlyAFAR 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
Call parameter type does not match function signature!
  %.taskred.input = alloca [1 x %kmp_taskred_input_t], align 8, addrspace(5)
 ptr  %.taskred.desc = call ptr @__kmpc_taskred_modifier_init(ptr addrspacecast (ptr addrspace(1) @6 to ptr), i32 %omp_global_thread_num5, i32 1, i32 1, ptr addrspace(5) %.taskred.input)
error: failed to create the LLVM module
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 19.0.0, MI250X
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
error: afar-flang-reduction-task-ice.f90:25:0: in function gen_prog_$ck_L22_1 void (i64, i64, i64, i64, i64, i64, i64): invalid addrspacecast
fails another wayCCE 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..
lld: error: undefined symbol: _cray$mt_taskred_modifier_init
>>> referenced by <dir>/cooltmpdir-XuikEp/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/cooltmpdir-XuikEp/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
lld: error: undefined symbol: _cray$mt_taskred_modifier_fini
>>> referenced by <dir>/cooltmpdir-XuikEp/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/cooltmpdir-XuikEp/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
fails another wayCCE 20.0.2, MI250X
show
Warning:
 Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
lld: error: undefined symbol: _cray$mt_taskred_modifier_init
>>> referenced by <dir>/cooltmpdir-MhfAnN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/cooltmpdir-MhfAnN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
lld: error: undefined symbol: _cray$mt_taskred_modifier_fini
>>> referenced by <dir>/cooltmpdir-MhfAnN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/cooltmpdir-MhfAnN/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
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_taskred_modifier_init
>>> referenced by <dir>/pe_3275651//cooltmpdir-Mx19Kq/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3275651//cooltmpdir-Mx19Kq/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
lld: error: undefined symbol: _cray$mt_taskred_modifier_fini
>>> referenced by <dir>/pe_3275651//cooltmpdir-Mx19Kq/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3275651//cooltmpdir-Mx19Kq/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
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_taskred_modifier_init
>>> referenced by <dir>/pe_3795488//cooltmpdir-4frgi9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3795488//cooltmpdir-4frgi9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
lld: error: undefined symbol: _cray$mt_taskred_modifier_fini
>>> referenced by <dir>/pe_3795488//cooltmpdir-4frgi9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3795488//cooltmpdir-4frgi9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
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_taskred_modifier_init
>>> referenced by <dir>/pe_3528386//cooltmpdir-f7y7jk/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3528386//cooltmpdir-f7y7jk/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
lld: error: undefined symbol: _cray$mt_taskred_modifier_fini
>>> referenced by <dir>/pe_3528386//cooltmpdir-f7y7jk/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3528386//cooltmpdir-f7y7jk/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
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_taskred_modifier_init
>>> referenced by <dir>/pe_3751111//cooltmpdir-96RAQ9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3751111//cooltmpdir-96RAQ9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
lld: error: undefined symbol: _cray$mt_taskred_modifier_fini
>>> referenced by <dir>/pe_3751111//cooltmpdir-96RAQ9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
>>> referenced by <dir>/pe_3751111//cooltmpdir-96RAQ9/repro-cce-openmppost_lld.amdgpu.lto.o:(gen_prog_$ck_L22_1)
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 + (afar-flang-reduction-task-ice.f90: 25)
  0 inform,   0 warnings,   1 severes, 0 fatal for gen_prog

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

GCC 16.2.0, MI300A unified (runs correctly)

export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib
$GCC_16_2/bin/gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (62 lines)
! # Draft finding: omp52-clause-reduction-task on afar
!
! - compiler: afar
! - toolchain: afar; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
! - program: catalog omp52-clause-reduction-task (f90, version 52, sha256 0181c241953a07c1)
! - expected: None (None; )
! - actual: ice  (ice: Call parameter type does not match function signature!)
! - verdict: compiler_bug by rule R10-compile-ice: an internal compiler error (or the compiler rejecting code it generated) on a
!   legal program: always the compiler's defect
! - 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-reduction-task
! primary atom: omp.clause.reduction.task
! 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 target map(to: a) map(from: b) map(tofrom: host_flag) map(tofrom: s)
    host_flag = merge(1, 0, omp_is_initial_device())
    !$omp parallel default(none) shared(a, b, s)
      !$omp do reduction(task, +: s)
        do i = 1, n
          b(i) = 2*a(i) + 1
          s = s + a(i)
        end do
      !$omp end do
    !$omp end parallel
  !$omp end target
  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

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

Call parameter type does not match function signature!
  %.taskred.input = alloca [1 x %kmp_taskred_input_t], align 8, addrspace(5)
 ptr  %.taskred.desc = call ptr @__kmpc_taskred_modifier_init(ptr addrspacecast (ptr addrspace(1) @6 to ptr), i32 %omp_global_thread_num5, i32 1, i32 1, ptr addrspace(5) %.taskred.input)
error: failed to create the LLVM module

What the specification requires

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

The same requirement as the issue catalog/afar-flang-sections-in-target-ice.

OpenMP 5.2 §11.3 p.243

Evidence

Same compiler, one change

  • reduction(+: s) without the task modifier: AFAR 24.3.0: correct; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
    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 target map(to: a) map(from: b) map(tofrom: host_flag) map(tofrom: s)
        host_flag = merge(1, 0, omp_is_initial_device())
        !$omp parallel default(none) shared(a, b, s)
          !$omp do reduction(+: s)
            do i = 1, n
              b(i) = 2*a(i) + 1
              s = s + a(i)
            end do
          !$omp end do
        !$omp end parallel
      !$omp end target
      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

GCC 16.2.0