OffTarget

Observed issues › cce-uses-allocators-traits-omp50

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

ftn: OpenMP 5.0 form uses_allocators(my_alloc(my_traits)) rejected as a function reference (ftn-451)

Legality: independently confirmed. One independent reading was uncertain; 2 adjudicating readings that weighed both find the program legal and the result required: The restriction on allocators in uses_allocators concerns other data-sharing or mapping clauses in the same construct; my_alloc appears in shared only on the nested parallel do, a different construct. The traits array is a constant parameter array in the same scope as the target, the allocator is non-predefined with traits, and allocate on the parallel do names an allocator listed in uses_allocators. 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.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.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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 parallel do private(t) allocate(my_alloc: t) default(none) shared(a, b, my_alloc)
                                                                                ^         
ftn-451 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
  This reference to function "MY_ALLOC" without an actual argument list is illegal.
                                                                                ^         
ftn-1473 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
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 parallel do private(t) allocate(my_alloc: t) default(none) shared(a, b, my_alloc)
                                                                                ^         
ftn-451 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
  This reference to function "MY_ALLOC" without an actual argument list is illegal.
                                                                                ^         
ftn-1473 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
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 parallel do private(t) allocate(my_alloc: t) default(none) shared(a, b, my_alloc)
                                                                                ^         
ftn-451 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
  This reference to function "MY_ALLOC" without an actual argument list is illegal.
                                                                                ^         
ftn-1473 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
AFAR 24.3.0, MI250X
AFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
cce-uses-allocators-traits-omp50.f90:10:40: portability: The comma-separated list syntax for the USES_ALLOCATORS clause has been deprecated in OpenMP 5.2, use 'USES_ALLOCATORS([TRAITS(traits):] alloca
    !$omp target map(to: a) map(from: b) uses_allocators(my_alloc(my_traits))
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: loc("cce-uses-allocators-traits-omp50.f90":10:40): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/OpenMP/OpenMP.cpp:8211: not yet implemented: USES_ALLOCATORS clause is not implemented 
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 (cce-uses-allocators-traits-omp50.f90: 10)
NVFORTRAN-S-0034-Syntax error at or near identifier allocate (cce-uses-allocators-traits-omp50.f90: 11)
  0 inform,   0 warnings,   2 severes, 0 fatal for p
fails another wayGCC 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
cce-uses-allocators-traits-omp50.f90:10:55:
   10 |   !$omp target map(to: a) map(from: b) uses_allocators(my_alloc(my_traits))
      |                                                       1
Warning: The specification of arguments to ‘uses_allocators’ at (1) where each item is of the form ‘allocator(traits)’ is deprecated since OpenMP 5.2; instead use ‘uses_allocators(traits(my_traits): m
cce-uses-allocators-traits-omp50.f90:10:75:
   10 |   !$omp target map(to: a) map(from: b) uses_allocators(my_alloc(my_traits))
      |                                                                           1
sorry, unimplemented: ‘uses_allocators’ clause with traits and memory spaces

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
Program (23 lines)
! OpenMP 5.0 §2.12.5 p.170: uses_allocators(allocator[(allocator-traits-array)]).
! The allocator handle is shared on a parallel do nested in the target
! region (a different construct, so 5.0 §2.12.5 p.175 does not forbid it).
! Expected: compiles and prints 2*i+1. The same program with the 5.2 form
! uses_allocators(traits(my_traits): my_alloc) compiles on CCE 19/20/21.
program p
  use omp_lib
  implicit none
  integer, parameter :: n = 8
  integer :: a(n), b(n), i, t
  integer(omp_allocator_handle_kind) :: my_alloc
  type(omp_alloctrait), parameter :: my_traits(1) = &
    [omp_alloctrait(omp_atk_alignment, 64)]
  a = [(i, i = 1, n)]
  !$omp target map(to: a) map(from: b) uses_allocators(my_alloc(my_traits))
  !$omp parallel do private(t) allocate(my_alloc: t) default(none) shared(a, b, my_alloc)
  do i = 1, n
    t = 2*a(i)
    b(i) = t + 1
  end do
  !$omp end target
  print *, b
end program p

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 parallel do private(t) allocate(my_alloc: t) default(none) shared(a, b, my_alloc)
                                                                                ^         
ftn-451 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 
  This reference to function "MY_ALLOC" without an actual argument list is illegal.
                                                                                ^         
ftn-1473 ftn: ERROR P, File = cce-uses-allocators-traits-omp50.f90, Line = 11, Column = 81 

What the specification requires

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

OpenMP 5.0 §2.12.5 p.170

OpenMP 5.0 §2.12.5 p.175

Evidence

Same compiler, one change

  • the OpenMP 5.2 spelling uses_allocators(traits(my_traits): my_alloc): AFAR 24.3.0: fails another way; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
    Control program
    program p
      use omp_lib
      implicit none
      integer, parameter :: n = 8
      integer :: a(n), b(n), i, t
      integer(omp_allocator_handle_kind) :: my_alloc
      type(omp_alloctrait), parameter :: my_traits(1) = &
        [omp_alloctrait(omp_atk_alignment, 64)]
      a = [(i, i = 1, n)]
      !$omp target map(to: a) map(from: b) uses_allocators(traits(my_traits): my_alloc)
      !$omp parallel do private(t) allocate(my_alloc: t) default(none) shared(a, b, my_alloc)
      do i = 1, n
        t = 2*a(i)
        b(i) = t + 1
      end do
      !$omp end target
      print *, b
    end program p