OffTarget

Observed issues › gcc/gcc-uses-allocators-traits-unimplemented

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

uses_allocators with allocator traits or a memory space: "sorry, unimplemented" (Fortran)

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

Same issue as gcc/gcc-c-uses-allocators-traits-unimplemented; this program is another reproducer of it.

GCC 16.2 stops with "sorry, unimplemented: 'uses_allocators' clause with traits and memory spaces" (Fortran) or "sorry, unimplemented: 'uses_allocators' clause" (C) on a target construct whose uses_allocators clause defines an allocator with traits or a memory space, in the 5.0 and 5.2 forms. Its implementation status table says only predefined allocators are supported.

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.0correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4correctcorrectunknown
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, MI300X
GCC 16.2.0, MI350X
show
site-gcc--gcc-uses-allocators-traits-unimplemented.f90:59:53:
   59 |   !$omp& uses_allocators(traits(my_traits): my_alloc)
      |                                                     1
sorry, unimplemented: ‘uses_allocators’ clause with traits and memory spaces
not supportedGCC 16.2.0, MI250X
GCC 16.2.0, A100 separate
show
site-gcc--gcc-uses-allocators-traits-unimplemented.f90:58:53:
   58 |   !$omp& uses_allocators(traits(my_traits): my_alloc)
      |                                                     1
sorry, unimplemented: ‘uses_allocators’ clause with traits and memory spaces
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
error: loc("site-gcc--gcc-uses-allocators-traits-unimplemented.f90":58:10): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/OpenMP/OpenMP.cpp:8211: not yet implemented: USES_ALLOCATORS clause i
LLVM ERROR: aborting
fails another wayAFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
error: loc("site-gcc--gcc-uses-allocators-traits-unimplemented.f90":59:10): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/OpenMP/OpenMP.cpp:8211: not yet implemented: USES_ALLOCATORS clause i
LLVM ERROR: aborting
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 uses_allocators (site-gcc--gcc-uses-allocators-traits-unimplemented.f90: 57)
NVFORTRAN-S-0034-Syntax error at or near identifier allocate (site-gcc--gcc-uses-allocators-traits-unimplemented.f90: 60)
  0 inform,   0 warnings,   2 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

CCE 19.0.0, MI300A unified (runs correctly)

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
Program (71 lines)
! # Finding (GCC 16.2): uses_allocators with traits or a memory space is not implemented (Fortran); the reproducer is the catalog
!   program omp52-clause-uses_allocators-traits
!
! - 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: sorry, unimplemented: .uses_allocators. clause with traits and memory spaces
! - observed: `sorry, unimplemented: 'uses_allocators' clause with traits and memory spaces` on 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 5.2 table): "New
!   memspace and traits modifiers for uses_allocators": P (partial), "Only predefined allocators". The message is GCC's own "sorry,
!   unimplemented".
! - spec: the uses_allocators clause and its traits and memspace modifiers (5.2 §6.8 p.181).
! - gate and confirmer: 10 cells (5 gcc_g90, 5 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 (R05-unsupported) 10
! - catalog programs (5): omp50-clause-uses_allocators-traits, omp52-clause-uses_allocators-memspace,
!   omp52-clause-uses_allocators-traits, omp60-clause-uses_allocators-memspace, omp60-clause-uses_allocators-traits
! - 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 5.2, free-form Fortran). Do not edit.
! id: omp52-clause-uses_allocators-traits
! primary atom: omp.clause.uses_allocators.traits
! legal: yes
! observable: no (unverified: the check covers the device kernel, not the atom)
! ran_on_host: inside the target region of interest
! evidence: unverified
! needs: none
! std: f2008
! unverified (oracle_not_written): re-categorised (was implementation_defined): memory from the allocator
!   'will be byte
! aligned to at least the value specified for the alignment trait' (5.2 §6.2 p.173, 6.0 §8.2 p.306), so a check that t's address is
! a multiple of 64 is a deterministic oracle of the original; it is not written. A mutant without the trait could still be 64-byte
! aligned (any alignment conforms then), AFAR rejects uses_allocators and CCE 19's mutant without the trait is an internal compiler
! error (final-review re-audit)
program gen_prog
  use omp_lib, only: omp_allocator_handle_kind, omp_alloctrait, omp_atk_alignment, 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 :: t
  integer(omp_allocator_handle_kind) :: my_alloc
  type(omp_alloctrait), parameter :: my_traits(1) = &
  [omp_alloctrait(omp_atk_alignment, 64)]
  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 map(to: a) map(from: b) map(tofrom: host_flag) &
  !$omp& uses_allocators(traits(my_traits): my_alloc)
    host_flag = merge(1, 0, omp_is_initial_device())
    !$omp parallel do default(none) shared(a, b, my_alloc) private(t) allocate(my_alloc: t)
      do i = 1, n
        t = 2*a(i)
        b(i) = t + 1
      end do
    !$omp end parallel do
  !$omp end target
  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-uses-allocators-traits-unimplemented.f90:59:53:
   59 |   !$omp& uses_allocators(traits(my_traits): my_alloc)
      |                                                     1
sorry, unimplemented: ‘uses_allocators’ clause with traits and memory spaces

What the specification requires

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

OpenMP 5.2 §6.8 p.181

OpenMP 5.2 §6.2 p.173

OpenMP 6.0 §8.2 p.306

Evidence

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4