OffTarget

Observed issues › gcc/gcc-omp60-undocumented-rejected

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

OpenMP 6.0 requires device_safesync and defaultmap(private) are rejected (Fortran)

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

Same issue as gcc/gcc-c-omp60-undocumented-rejected; this program is another reproducer of it.

GCC 16.2 rejects two OpenMP 6.0 forms that no row of its implementation status table covers: the device_safesync clause of requires ("expected 'unified_address', 'unified_shared_memory', ...") and defaultmap(private) ("expected 'alloc', 'to', ... before 'private'", the 5.2 list). The other 6.0 rejections are in the finding for the features GCC lists as not implemented.

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 wayunknown
not run
fails another wayfails another wayn/an/a
CCE 19.0.0fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayunknown
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.0not supportednot supportednot supportednot supportednot supportednot supportedn/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 supportedGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI250X
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
GCC 16.2.0, A100 separate
show
site-gcc--gcc-omp60-undocumented-rejected.f90:42:17:
   42 |   !$omp requires device_safesync
      |                 1
Error: Expected UNIFIED_ADDRESS, UNIFIED_SHARED_MEMORY, SELF_MAPS, DYNAMIC_ALLOCATORS, REVERSE_OFFLOAD, or ATOMIC_DEFAULT_MEM_ORDER clause at (1)
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
AFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
error: Semantic errors in site-gcc--gcc-omp60-undocumented-rejected.f90
site-gcc--gcc-omp60-undocumented-rejected.f90:42:18: error: DEVICE_SAFESYNC clause is not allowed on REQUIRES directive in OpenMP v5.2, try -fopenmp-version=60
    !$omp requires device_safesync
                   ^^^^^^^^^^^^^^^
fails another wayCCE 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..
  !$omp requires device_safesync
                       ^         
ftn-1725 ftn: ERROR GEN_PROG, File = site-gcc--gcc-omp60-undocumented-rejected.f90, Line = 42, Column = 24 
  Unexpected syntax while parsing the DIRECTIVE statement : "reverse_order, unified_address, unified_shared_memory, atomic_default_mem_order, or dynamic_allocators" was expected but found "_".
Cray Fortran : 72 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
fails another wayCCE 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..
  !$omp requires device_safesync
                 ^               
ftn-1718 ftn: ERROR GEN_PROG, File = site-gcc--gcc-omp60-undocumented-rejected.f90, Line = 42, Column = 18 
  Implementation for the DEVICE_SAFESYNC clause on the REQUIRES directive is deferred.
Cray Fortran : 72 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
fails another wayCCE 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..
  !$omp requires device_safesync
                 ^               
ftn-1718 ftn: ERROR GEN_PROG, File = site-gcc--gcc-omp60-undocumented-rejected.f90, Line = 42, Column = 18 
  Implementation for the DEVICE_SAFESYNC clause on the REQUIRES directive is deferred.
Cray Fortran : 72 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 DEVICE (site-gcc--gcc-omp60-undocumented-rejected.f90: 42)
  0 inform,   0 warnings,   1 severes, 0 fatal for gen_prog

Reproduce

GCC 16.2.0, MI300A unified

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

GCC 16.2.0, A100 separate

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=$GCC_16_2/lib64
$GCC_16_2/bin/gfortran -fopenmp -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.f90 -o repro
OMP_TARGET_OFFLOAD=mandatory ./repro
Program (65 lines)
! # Finding (GCC 16.2): requires device_safesync and defaultmap(private) are rejected, and GCC's table does not list them (Fortran);
!   the reproducer is the catalog program omp60-clause-device_safesync
!
! - toolchains: gcc_g90 (GCC 16.2.0, AMD Instinct MI250X gfx90a, Tioga) and gcc_sm80 (GCC 16.2.0,
!   NVIDIA A100 sm_80, wingtip); separate memory only; -O2; OMP_TARGET_OFFLOAD=mandatory
! - build: gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx90a -O2 (gcc_g90);
!   -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 (gcc_sm80)
! - failure: rejected
! - observed: `Error: Expected UNIFIED_ADDRESS, UNIFIED_SHARED_MEMORY, SELF_MAPS, DYNAMIC_ALLOCATORS, REVERSE_OFFLOAD, ...` at
!   device_safesync; `Error: Expected ALLOC, TO, FROM, TOFROM, FIRSTPRIVATE, PRESENT, NONE or DEFAULT` at defaultmap(private); both
!   GPUs.
! - expected: compiles; `RESULT ran_on_host=0 check=pass`
! - GCC 16.2 documentation (libgomp.texi of the GCC 16.2.0 release tarball, "OpenMP Implementation Status", OpenMP 6.0 table): no
!   row names the device_safesync requirement clause or private as a defaultmap implicit-behavior (the table's defaultmap row is
!   "self modifier to map and self as defaultmap argument"). Undocumented.
! - spec: the device_safesync clause is a 6.0 requirement clause (6.0 §5.4 p.173 lists it among the clauses that take a
!   directive-name modifier); defaultmap's implicit-behavior private is new in 6.0.
! - other families (catalog matrix): requires device_safesync: CCE 19/20/21 and NVHPC reject it; AFAR amdflang compiles and runs the
!   Fortran program, AFAR amdclang's C compile does not finish (afar-clang-requires-device-safesync-hang.c). defaultmap(private):
!   AFAR amdclang and CCE 21 run the C program correctly, CCE 20 the Fortran one; CCE 19 and NVHPC reject it.
! - gate and confirmer: 8 cells (4 gcc_g90, 4 gcc_sm80), each confirmed in the gate's four environments (a-d;
!   results/gcc/gate-tioga/ and gate-wingtip/ verdicts.jsonl); confirmer verdicts (results/gcc/confirm/batch.gcc_*.jsonl):
!   unsupported (R11a-newer-form-unclaimed) 8
! - catalog programs (4): omp60-clause-defaultmap-private, omp60-clause-device_safesync,
!   omp60-clause-device_safesync-directive_name, omp60-clause-device_safesync-required
! - legality: the catalog programs are legal by construction (offload.engine.gen, c_gen and acc_gen
!   check every program against the catalog rules and the offload scope as it is built; no
!   compiler). GCC is a compiler under test only: never a legality witness, here or for another
!   family's case (catalog/machines.yaml under_test_only).
! Generated by compliance.gen (OpenMP 6.0, free-form Fortran). Do not edit.
! id: omp60-clause-device_safesync
! primary atom: omp.clause.device_safesync
! 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 device_safesync
  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

Expected

check=pass

Observed where it behaves incorrectly

site-gcc--gcc-omp60-undocumented-rejected.f90:42:17:
   42 |   !$omp requires device_safesync
      |                 1
Error: Expected UNIFIED_ADDRESS, UNIFIED_SHARED_MEMORY, SELF_MAPS, DYNAMIC_ALLOCATORS, REVERSE_OFFLOAD, or ATOMIC_DEFAULT_MEM_ORDER clause at (1)

What the specification requires

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

OpenMP 6.0 §5.4 p.173