OffTarget

Observed issues › fuzz/591-cce19

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

ftn: internal compiler error "Unhandled contexts must be fixed!!!" for teams distribute simd with lastprivate, private and nontemporal

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.0correctcorrectunknown
not run
correctcorrectn/an/a
CCE 19.0.0behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4behaves incorrectlybehaves incorrectlyunknown
not run
unknown
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
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
There are unprocessed contexts for construct 3!!!
2: Omp_Nontemporal  o1 (on_list)
14: Omp_Nontemporal  o1 (on_list)
   Error message      ::  Unhandled contexts must be fixed!!!
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 5982
   Initiated from     ::  Line 660 (v_main.c)
behaves incorrectlyCCE 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..
There are unprocessed contexts for construct 3!!!
2: Omp_Nontemporal  o1 (on_list)
14: Omp_Nontemporal  o1 (on_list)
   Error message      ::  Unhandled contexts must be fixed!!!
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 6156
   Initiated from     ::  Line 660 (v_main.c)
behaves incorrectlyCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 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..
There are unprocessed contexts for construct 3!!!
2: Omp_Nontemporal  o1 (on_list)
14: Omp_Nontemporal  o1 (on_list)
   Error message      ::  Unhandled contexts must be fixed!!!
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 6350
   Initiated from     ::  Line 732 (v_main.c)
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 nontemporal (fuzz-591-cce19.f90: 10)
  0 inform,   0 warnings,   1 severes, 0 fatal for fuzz_prog

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 (49 lines)
! Minimized by compliance.fuzz_min from fuzz seed 591 (fuzz-1).
! toolchain: cce19 (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: ice (ice: INTERNAL COMPILER ERROR: "Unhandled contexts must be fixed!!!)
! expected: compiles
! observed: internal compiler error: ice: INTERNAL COMPILER ERROR:  "Unhandled contexts must be fixed!!!
! Legal OpenMP 5.2: offload.engine.prerun.check accepts it (rerun: offload.engine.rules with the
!   race rule and the restriction checks, and the AFAR flang front end, not under test here); no
!   compiler under test, gfortran or gcc is a legality witness.
! also fails on: cce20, cce21
program fuzz_prog
  implicit none
  integer, parameter :: n = 128, m = 8
  integer :: o1(n, m)
  integer :: i, j, lp1, t1
  integer(8) :: cs
  o1 = 0
  lp1 = 0
  ! fuzz: kernels
  !$omp target
    !$omp teams distribute simd lastprivate(lp1) private(t1) nontemporal(o1)
    do i = n, 1, -1
      do j = 1, m
        t1 = 0
        lp1 = 0
      end do
    end do
    !$omp end teams distribute simd
  !$omp end target
  ! fuzz: checksum
  cs = 0
  cs = modulo(cs * 31_8 + int(lp1, 8), 2147483629_8)
  do j = 1, m
    do i = 1, n
      cs = modulo(cs * 31_8 + int(o1(i, j), 8), 2147483629_8)
    end do
  end do
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', 0
end program fuzz_prog
! spec (requirement): the nontemporal clause is permitted on simd (and so on a composite construct with simd as a leaf), and the
!   lastprivate clause applies to every leaf construct that permits it; a clause on a composite construct must apply to at least
!   one leaf construct.
! "The nontemporal clause specifies that accesses to the storage locations to which the list items refer have low temporal
!   locality across the iterations in which those storage locations are accessed. The list items of the nontemporal clause may
!   also appear as list items of data-environment attribute clauses." (5.2 §10.4.1 p.236 l.21-24)
! "The effect of the lastprivate clause is as if it is applied to all leaf constructs that permit the clause. If the parallel
!   construct is among the constituent constructs and the list item is not also" (5.2 §17.2 p.340 l.21-22)
! spec (this program): teams distribute simd with lastprivate(lp1), private(t1) and nontemporal(o1) is a legal composite
!   construct; CCE 19, 20 and 21 stop with an internal compiler error (Unhandled contexts must be fixed), and compile it when
!   nontemporal(o1) is removed.

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..
There are unprocessed contexts for construct 3!!!
2: Omp_Nontemporal  o1 (on_list)
14: Omp_Nontemporal  o1 (on_list)
   Error message      ::  Unhandled contexts must be fixed!!!
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 5982
   Initiated from     ::  Line 660 (v_main.c)

What the specification requires

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

OpenMP 5.2 §10.4.1 p.236 l.21-24

The nontemporal clause specifies that accesses to the storage locations to which the list items refer have low temporal locality across the iterations in which those storage locations are accessed. The list items of the nontemporal clause may also appear as list items of data-environment attribute clauses.

OpenMP 5.2 §17.2 p.340 l.21-22

The effect of the lastprivate clause is as if it is applied to all leaf constructs that permit the clause. If the parallel construct is among the constituent constructs and the list item is not also

Evidence

Same compiler, one change

  • nontemporal(o1) removed: 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 fuzz_prog
      implicit none
      integer, parameter :: n = 128, m = 8
      integer :: o1(n, m)
      integer :: i, j, lp1, t1
      integer(8) :: cs
      o1 = 0
      lp1 = 0
      !$omp target
        !$omp teams distribute simd lastprivate(lp1) private(t1)
        do i = n, 1, -1
          do j = 1, m
            t1 = 0
            lp1 = 0
          end do
        end do
        !$omp end teams distribute simd
      !$omp end target
      cs = 0
      cs = modulo(cs * 31_8 + int(lp1, 8), 2147483629_8)
      do j = 1, m
        do i = 1, n
          cs = modulo(cs * 31_8 + int(o1(i, j), 8), 2147483629_8)
        end do
      end do
      print '(a,i0)', 'RESULT checksum=', cs
    end program fuzz_prog
    

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0