OffTarget

Observed issues › catalog/afar-flang-sections-in-target-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: 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.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!
  %p.lastiter = alloca i32, align 4, addrspace(5)
 ptr  call void @__kmpc_for_static_init_4u(ptr addrspacecast (ptr addrspace(1) @6 to ptr), i32 %omp_global_thread_num14, i32 34, ptr addrspace(5) %p.lastiter, ptr addrspace(5) %p.lowerbound, ptr addrs
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..
MT_CONTEXT_SECTIONS
   Error message      ::  unhandled construct type
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 7617
   Initiated from     ::  Line 660 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  afar-flang-sections-in-target-ice.f90
fails another wayCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 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..
MT_CONTEXT_SECTIONS
   Error message      ::  unhandled acc construct type
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 7881
   Initiated from     ::  Line 660 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  afar-flang-sections-in-target-ice.f90
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 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..
MT_CONTEXT_SECTIONS
   Error message      ::  unhandled acc construct type
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 8265
   Initiated from     ::  Line 732 (v_main.c)
   Optimizer built    ::  2026-07-14 (production)
   File               ::  afar-flang-sections-in-target-ice.f90
fails another wayCCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
CCE 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..
MT_CONTEXT_SECTIONS
   Error message      ::  unhandled acc construct type
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 8265
   Initiated from     ::  Line 732 (v_main.c)
   Optimizer built    ::  2026-09-24 (production)
   File               ::  afar-flang-sections-in-target-ice.f90
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
show
NVFORTRAN-F-1196-OpenMP - omp sections is not supported in GPU region (afar-flang-sections-in-target-ice.f90: 15)
NVFORTRAN/x86-64 Linux 25.11-0: compilation aborted
fails another wayNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-F-1196-OpenMP - omp sections is not supported in GPU region (afar-flang-sections-in-target-ice.f90: 15)
NVFORTRAN/x86-64 Linux 26.9-0: compilation aborted

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 (60 lines)
! # Draft finding: omp52-w-sections on afar
!
! - compiler: afar
! - toolchain: afar; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
! - program: catalog omp52-w-sections (f90, version 52, sha256 d299f7f016bae1e6)
! - 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: offload.engine.rules accepts it (offload.engine.prerun.check, rerun: with the
!   race rule and the restriction checks); NVHPC is no witness: it does not implement a feature the
!   program uses (NVFORTRAN-F-1196-OpenMP - omp sections is not supported in GPU
!   region); the check's other witness, the AFAR flang front end, is the compiler under test and is
!   not counted; no gfortran or gcc is a legality witness
! - witnesses: none
! - withdrawn: none
!
! Generated by compliance.widen (OpenMP 5.2, free-form Fortran; catalog widening). Do not edit.
! id: omp52-w-sections
! primary atom: omp.directive.sections
! atoms: omp.directive.sections
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
! feature: a sections construct with two sections in a target parallel region
! spec: OpenMP 5.2 §11.3, p.243 (sections construct)
program wide_prog
  use omp_lib, only: omp_is_initial_device
  implicit none
  integer, parameter :: n = 64
  integer :: a(n), b(n), ref(n)
  integer :: i, host_flag
  logical :: ok
  do i = 1, n
    a(i) = i
    b(i) = 0
    ref(i) = 2*i + 1
  end do
  host_flag = 1
  !$omp target parallel map(to: a) map(tofrom: b, host_flag)
  !$omp sections
  !$omp section
  do i = 1, n/2
    b(i) = 2*a(i) + 1
  end do
  host_flag = merge(1, 0, omp_is_initial_device())
  !$omp section
  do i = n/2 + 1, n
    b(i) = a(i) + a(i) + 1
  end do
  !$omp end sections
  !$omp end target parallel
  ok = all(b == ref)
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program wide_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!
  %p.lastiter = alloca i32, align 4, addrspace(5)
 ptr  call void @__kmpc_for_static_init_4u(ptr addrspacecast (ptr addrspace(1) @6 to ptr), i32 %omp_global_thread_num14, i32 34, ptr addrspace(5) %p.lastiter, ptr addrspace(5) %p.lowerbound, ptr addrs
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.

OpenMP 5.2 §11.3 p.243

Evidence

Same compiler, one change

  • the same sections on the host (parallel instead of target parallel): 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 wide_prog
      use omp_lib, only: omp_is_initial_device
      implicit none
      integer, parameter :: n = 64
      integer :: a(n), b(n), ref(n)
      integer :: i, host_flag
      logical :: ok
      do i = 1, n
        a(i) = i
        b(i) = 0
        ref(i) = 2*i + 1
      end do
      host_flag = 1
      !$omp parallel
      !$omp sections
      !$omp section
      do i = 1, n/2
        b(i) = 2*a(i) + 1
      end do
      host_flag = merge(1, 0, omp_is_initial_device())
      !$omp section
      do i = n/2 + 1, n
        b(i) = a(i) + a(i) + 1
      end do
      !$omp end sections
      !$omp end parallel
      ok = all(b == ref)
      print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
    end program wide_prog
    

Other compilers run it correctly

GCC 16.2.0

Reproducers of this issue