OffTarget

Observed issues › cce19-target-parallel-single-ice

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

Constructs documented as unsupported in offload regions (single, masked, task, ordered, scan) give internal compiler errors or device link failures instead of a diagnostic

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.0correctcorrectcorrectcorrectcorrectn/an/a
CCE 19.0.0behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 20.0.2behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 21.0.3behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 21.0.4behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
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 incorrectlyCCE 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_SINGLE
   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               ::  cce19-target-parallel-single-ice.f90
behaves incorrectlyCCE 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_SINGLE
   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               ::  cce19-target-parallel-single-ice.f90
behaves incorrectlyCCE 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_SINGLE
   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               ::  cce19-target-parallel-single-ice.f90
behaves incorrectlyCCE 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_SINGLE
   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               ::  cce19-target-parallel-single-ice.f90
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
RUN_TIMEOUT

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 (31 lines)
program t
  use omp_lib, only: omp_get_thread_num
  implicit none
  integer, parameter :: n = 64
  integer, allocatable :: a(:), b(:)
  integer :: ref(n), i, nbad
  allocate(a(n), b(n))
  do i = 1, n
    a(i) = i; b(i) = 0; ref(i) = 2*i + 1
  end do
  !$omp target parallel map(to: a) map(from: b) 
    !$omp single
      do i = 1, n
        b(i) = 2*a(i) + 1
      end do
    !$omp end single
  !$omp end target parallel
  nbad = count(b /= ref)
  print *, 'single bad=', nbad
end program
! spec (requirement): A single construct in a parallel region is executed by exactly one thread of the team, with an
!   implicit barrier at its end.
! "The single construct specifies that the associated structured block is executed by only one of the threads in the
!   team" (5.2 §11.1 p.241 l.2-3)
! spec (requirement): The implicit barrier at the end of a single region applies unless nowait is specified.
! "An implicit barrier occurs at the end of a single region if the nowait clause is not specified." (5.2 §11.1 p.241
!   l.5-6)
! spec (this program): The program uses single inside target parallel without nowait. The nesting rules of OpenMP 5.2
!   list no restriction against single in a target region, so the program is legal; the vendor documentation that
!   lists single as unsupported in offload regions is a statement outside the spec, and the compiler gives an internal
!   error or link failure instead of a diagnostic.

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..
MT_CONTEXT_SINGLE
   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               ::  cce19-target-parallel-single-ice.f90

What the specification requires

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

OpenMP 5.2 §11.1 p.241 l.2-3

The single construct specifies that the associated structured block is executed by only one of the threads in the team

OpenMP 5.2 §11.1 p.241 l.5-6

An implicit barrier occurs at the end of a single region if the nowait clause is not specified.

Evidence

Same compiler, one change

  • the single construct replaced by a worksharing do construct: 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 t
      use omp_lib, only: omp_get_thread_num
      implicit none
      integer, parameter :: n = 64
      integer, allocatable :: a(:), b(:)
      integer :: ref(n), i, nbad
      allocate(a(n), b(n))
      do i = 1, n
        a(i) = i; b(i) = 0; ref(i) = 2*i + 1
      end do
      !$omp target parallel map(to: a) map(from: b)
        !$omp do
          do i = 1, n
            b(i) = 2*a(i) + 1
          end do
        !$omp end do
      !$omp end target parallel
      nbad = count(b /= ref)
      print *, 'single bad=', nbad
    end program
    

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0

Reproducers of this issue