OffTarget

Observed issues › catalog/cce-linear-lastprivate-ice

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

ftn: internal compiler error "ACC - barrier/reset/protected last private not supported" for linear and lastprivate on a loop 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.0fails another wayfails another wayfails another wayfails another wayfails another wayn/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..
   Error message      ::  ACC - barrier/reset/protected last private not supported
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_translate.c', line 4874
   Initiated from     ::  Line 1849 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  cce-linear-lastprivate-ice.f90
   Function           ::  gen_prog
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..
   Error message      ::  ACC - barrier/reset/protected last private not supported
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_translate.c', line 5607
   Initiated from     ::  Line 1859 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  cce-linear-lastprivate-ice.f90
   Function           ::  gen_prog
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..
   Error message      ::  ACC - barrier/reset/protected last private not supported
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_translate.c', line 5798
   Initiated from     ::  Line 1939 (v_main.c)
   Optimizer built    ::  2026-07-14 (production)
   File               ::  cce-linear-lastprivate-ice.f90
   Function           ::  gen_prog
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..
   Error message      ::  ACC - barrier/reset/protected last private not supported
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_translate.c', line 5798
   Initiated from     ::  Line 1939 (v_main.c)
   Optimizer built    ::  2026-09-24 (production)
   File               ::  cce-linear-lastprivate-ice.f90
   Function           ::  gen_prog
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.42-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx942 -mlink-built
 #0 0x0000155543273e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) ($AFAR/lib/llvm/bin/../lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x0000155543270b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000155555116990 __restore_rt (/lib64/libpthread.so.0+0x12990)
 #3 0x00001555443d6eb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) ($AFAR/lib/llvm/bin/../lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00001555443d759e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) ($AFAR/lib/llvm/bin/../lib/libLLVM.so.24.0git+0x19f059e)
fails another wayAFAR 24.3.0, MI250X
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.0a-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx90a -mlink-built
 #0 0x0000155543273e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) ($AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x0000155543270b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000155555116990 __restore_rt (/lib64/libpthread.so.0+0x12990)
 #3 0x00001555443d6eb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) ($AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00001555443d759e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) ($AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19f059e)
fails another wayAFAR 24.3.0, MI300X
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.42-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx942 -mlink-built
 #0 0x00007f06df08ce6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x00007f06df089b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f06de03ebf0 __restore_rt (/lib64/libc.so.6+0x3ebf0)
 #3 0x00007f06e01efeb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00007f06e01f059e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19f059e)
fails another wayAFAR 24.3.0, MI350X
show
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: $AFAR/lib/llvm/bin/flang-24 -fc1 -triple amdgpu9.50-amd-amdhsa -emit-llvm-bc -fno-color-diagnostics -flto=full -mrelocation-model pic -pic-level 2 -target-cpu gfx950 -mlink-built
 #0 0x00007f2955a8ce6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x88ce6a)
 #1 0x00007f2955a89b46 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f2954a3fc30 __restore_rt (/lib64/libc.so.6+0x3fc30)
 #3 0x00007f2956befeb2 llvm::CodeExtractorAnalysisCache::findSideEffectInfoForBlock(llvm::BasicBlock&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19efeb2)
 #4 0x00007f2956bf059e llvm::CodeExtractorAnalysisCache::CodeExtractorAnalysisCache(llvm::Function&) $AFAR/lib/llvm/lib/libLLVM.so.24.0git+0x19f059e)
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-W-0547-OpenMP feature, LINEAR, not yet implemented in this version of the compiler. (cce-linear-lastprivate-ice.f90: 20)
NVFORTRAN-W-0547-OpenMP feature, LINEAR, not yet implemented in this version of the compiler. (cce-linear-lastprivate-ice.f90: 20)
NVFORTRAN-S-0155-x must appear in a SHARED or PRIVATE clause (cce-linear-lastprivate-ice.f90: 22)
  0 inform,   2 warnings,   1 severes, 0 fatal for gen_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

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-linear on cce19
!
! - compiler: cce19
! - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: copy; opt: -O2
! - program: catalog omp52-clause-linear (f90, version 52, sha256 707ffe408d371cb3)
! - expected: None (None; )
! - actual: ice  (ice: INTERNAL COMPILER ERROR:  "ACC - barrier/reset/protected last private not supported"
!   (/workspace/crayftn/pdgcs/v_mt_translate.c, line 4874, version cc4d36e4ff3377d45f0e6e892b5dacd82009a0ca))
! - 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-linear
! primary atom: omp.clause.linear
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
! derivation (check=pass): linear(x: 1) on the parallel do (5.2 §5.4.6 p.118): on the logical iteration of i (number i - 1) the new
! derivation: x is the original x (3) plus (i - 1)*1, so x - (i + 2) = 0 and b(i) = 2*a(i) + 1 = 2*i + 1 = ref(i); the body's x = x
! derivation: + 1 keeps x on that sequence, and the value of the sequentially last iteration, taken as the new x at the end of that
! derivation: iteration (3 + n after its increment, as the OpenMP Examples' linear programs assume), is assigned to the original x,
! derivation: which the target maps tofrom: x = 1*n + 3; the check accepts
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 :: x
  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
  x = 3
  !$omp target map(to: a) map(from: b) map(tofrom: x) map(tofrom: host_flag)
    host_flag = merge(1, 0, omp_is_initial_device())
    !$omp parallel do default(none) shared(a, b) linear(x: 1)
      do i = 1, n
        b(i) = 2*a(i) + 1 + (x - (1*i + 2))
        x = x + 1
      end do
    !$omp end parallel do
  !$omp end target
  ok = all(b == ref) .and. (x == 1*n + 3)
  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

Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
   Error message      ::  ACC - barrier/reset/protected last private not supported
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_mt_translate.c', line 4874
   Initiated from     ::  Line 1849 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  cce-linear-lastprivate-ice.f90
   Function           ::  gen_prog

What the specification requires

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

OpenMP 5.2 §5.4.6 p.118

Evidence

Same compiler, one change

  • the same parallel do on the host (the target directive 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 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 :: x
      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
      x = 3
        host_flag = merge(1, 0, omp_is_initial_device())
        !$omp parallel do default(none) shared(a, b) linear(x: 1)
          do i = 1, n
            b(i) = 2*a(i) + 1 + (x - (1*i + 2))
            x = x + 1
          end do
        !$omp end parallel do
      ok = all(b == ref) .and. (x == 1*n + 3)
      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

Reproducers of this issue