OffTarget

Observed issues › catalog/cce-atomic-default-mem-order-acquire-release-rejected

Appears not to supportRefused at compile time · Fortran · OpenMP · Open

craycc/ftn: OpenMP 5.1/5.2/6.0 forms HPE does not claim are rejected, and some crash the compiler instead of a diagnostic

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

Same issue as catalog/cce-c-map-iterator-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.0correctcorrectcorrectcorrectcorrectn/an/a
CCE 19.0.0not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 20.0.2not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.3not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.4not supportednot supportednot supportedunknown
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
not supportedCCE 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..
  !$omp requires atomic_default_mem_order(release)
                                                 ^ 
ftn-1725 ftn: ERROR GEN_PROG, File = cce-atomic-default-mem-order-acquire-release-rejected.f90, Line = 4, Column = 50 
  Unexpected syntax while parsing the DIRECTIVE statement : "(seq_cst | acq_rel | relaxed)" was expected but found ")".
Cray Fortran : 27 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
not supportedCCE 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..
  !$omp requires atomic_default_mem_order(release)
                                                 ^ 
ftn-1725 ftn: ERROR GEN_PROG, File = cce-atomic-default-mem-order-acquire-release-rejected.f90, Line = 4, Column = 50 
  Unexpected syntax while parsing the DIRECTIVE statement : "(seq_cst | acq_rel | relaxed)" was expected but found ")".
Cray Fortran : 27 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
not supportedCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.3, MI250X
CCE 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..
  !$omp requires atomic_default_mem_order(release)
                                                 ^ 
ftn-1725 ftn: ERROR GEN_PROG, File = cce-atomic-default-mem-order-acquire-release-rejected.f90, Line = 4, Column = 50 
  Unexpected syntax while parsing the DIRECTIVE statement : "(seq_cst | acq_rel | relaxed)" was expected but found ")".
Cray Fortran : 27 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
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 ( (cce-atomic-default-mem-order-acquire-release-rejected.f90: 4)
  0 inform,   0 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

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 (54 lines)
! # Draft finding: omp52-clause-atomic_default_mem_order-release on cce19
!
! - compiler: cce19
! - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
! - program: catalog omp52-clause-atomic_default_mem_order-release (f90, version 52, sha256 4a88172afe9b3864)
! - expected: None (None; )
! - actual: rejected  (diagnostic: ftn-1725 ftn: ERROR GEN_PROG, File = ../../omp52-clause-atomic_default_mem_order-release.f90,
!   Line = 13, Column = 50 | Unexpected syntax while parsing the DIRECTIVE statement : "(seq_cst |)
! - verdict: compiler_bug by rule R11-compile-rejection: a legal program the compiler rejects with a diagnostic (or whose link fails
!   on symbols the compiler's own code needs, or whose compile does not finish) while another compiler family compiles it
! - 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-atomic_default_mem_order-release
! primary atom: omp.clause.atomic_default_mem_order.release
! legal: yes
! observable: no (requires only changes semantics: no checked device effect)
! 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
  !$omp requires atomic_default_mem_order(release)
  integer, parameter :: n = 64
  integer, allocatable, target :: a(:), b(:)
  integer :: ref(n)
  integer :: i, host_flag
  logical :: ok
  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
  !$omp target teams distribute parallel do map(to: a) map(from: b) map(tofrom: host_flag) &
  !$omp& default(none) shared(a, b, host_flag)
    do i = 1, n
      b(i) = 2*a(i) + 1
      if (i == 1) host_flag = merge(1, 0, omp_is_initial_device())
    end do
  !$omp end target teams distribute parallel do
  ok = all(b == ref)
  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..
  !$omp requires atomic_default_mem_order(release)
                                                 ^ 
ftn-1725 ftn: ERROR GEN_PROG, File = cce-atomic-default-mem-order-acquire-release-rejected.f90, Line = 4, Column = 50 
  Unexpected syntax while parsing the DIRECTIVE statement : "(seq_cst | acq_rel | relaxed)" was expected but found ")".
Cray Fortran : 27 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi

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/cce-c-map-iterator-ice.

OpenMP 5.2 §3.2.6 p.67 l.6-8

An iterator modifier is a unique, complex modifier that defines a set of iterators, each of which is an iterator-identifier and an associated set of values.

OpenMP 5.2 §5.8.3 p.151 l.13-14

A list item in a map clause may reference any iterator-identifier defined in its iterator modifier.

Evidence

Same compiler, one change

  • atomic_default_mem_order(seq_cst) instead of (release): 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
      !$omp requires atomic_default_mem_order(seq_cst)
      integer, parameter :: n = 64
      integer, allocatable, target :: a(:), b(:)
      integer :: ref(n)
      integer :: i, host_flag
      logical :: ok
      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
      !$omp target teams distribute parallel do map(to: a) map(from: b) map(tofrom: host_flag) &
      !$omp& default(none) shared(a, b, host_flag)
        do i = 1, n
          b(i) = 2*a(i) + 1
          if (i == 1) host_flag = merge(1, 0, omp_is_initial_device())
        end do
      !$omp end target teams distribute parallel do
      ok = all(b == ref)
      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

AFAR 24.3.0, GCC 16.2.0