OffTarget

Observed issues › oop/nvhpc-named-mapper-rejected

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

a named declare mapper (map(mapper(id), ...)) is not supported

Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked

A map clause with a mapper modifier naming a declare mapper does not compile with NVHPC 25.11 and 26.9; the declare mapper directive itself is reported as unrecognized. NVHPC's user guide lists mapper(mapid) as not supported. AFAR and CCE apply the mapper correctly.

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.0correctcorrectunknown
not run
correctcorrectn/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/anot supportednot supported
NVHPC 26.9n/an/an/an/an/anot supportednot supported
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 supportedNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-W-0287-Unrecognized OpenMP directive - declare (site-oop--nvhpc-named-mapper-rejected.f90: 28)
  0 inform,   1 warnings,   0 severes, 0 fatal for oop_m
NVFORTRAN-S-0034-Syntax error at or near : (site-oop--nvhpc-named-mapper-rejected.f90: 49)
  0 inform,   0 warnings,   1 severes, 0 fatal for oop
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
show
site-oop--nvhpc-named-mapper-rejected.f90:29:9:
   29 |   !$omp declare mapper(deep: vec :: v) map(tofrom: v, v%a(1:v%n))
      |         1
Error: Unclassifiable OpenMP directive at (1)
site-oop--nvhpc-named-mapper-rejected.f90:34:7:
   34 |   use oop_m
      |       1
Fatal Error: Cannot open module file ‘oop_m.mod’ for reading at (1): No such file or directory
fails another wayGCC 16.2.0, MI250X
GCC 16.2.0, A100 separate
show
site-oop--nvhpc-named-mapper-rejected.f90:28:9:
   28 |   !$omp declare mapper(deep: vec :: v) map(tofrom: v, v%a(1:v%n))
      |         1
Error: Unclassifiable OpenMP directive at (1)
site-oop--nvhpc-named-mapper-rejected.f90:33:7:
   33 |   use oop_m
      |       1
Fatal Error: Cannot open module file ‘oop_m.mod’ for reading at (1): No such file or directory

Reproduce

NVHPC 25.11, A100 separate

export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib
nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
OMP_TARGET_OFFLOAD=mandatory ./repro

NVHPC 26.9, A100 separate

export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib
nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
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 (59 lines)
! # Finding (fortran-oop): map(mapper(deep), tofrom: x) with a declare mapper: rejected (mapper(mapid) is not supported)
!
! - toolchains and modes that fail: nvhpc (NVHPC 25.11: managed, separate), nvhpc269 (NVHPC 26.9: managed, separate); -O2
! - build: nvfortran -mp=gpu -gpu=cc80 -O2 (managed: -gpu=mem:managed)
! - failure: rejected (not_implemented); OMP_TARGET_OFFLOAD=mandatory
! - observed: `NVFORTRAN-W-0287-Unrecognized OpenMP directive - declare` for the declare mapper directive, then the map clause
!   naming the mapper does not compile, NVHPC 25.11 and 26.9, separate and managed memory. The default-mapper programs
!   (oop-mapper-default and four others) get the same warning and then run with the predefined default mapper, which in those
!   programs has the same effect: not counted here (their separate-memory failures are
!   nvhpc-copy-alloc-component-illegal-address.f90's)
! - expected: compiles; `r1= 133120`
! - rule: 5.2 §5.8.8 p.162-164 (declare mapper) and §5.8.2 (the mapper modifier); NVHPC documents the gap: the NVIDIA HPC
!   Compilers User's Guide §7.4 "OpenMP Subset" (the OpenMP 5.0 features the compilers support) lists for 2.19.7 that
!   mapper(mapid) is not supported, and does not list declare mapper
! - other families: AFAR and CCE correct; GCC rejects it (gcc/gcc-declare-mapper-rejected.f90)
! - gate and confirmer: 4 cells, 4 confirmed in the gate's four environments (a-d; results/oop/main/gate_reruns*.jsonl); confirmer
!   (results/oop/main/confirm.jsonl): unsupported (R05-unsupported) 4
! - programs (1): oop-mapper-named (offload/engine/oop_gen.py; this file is the first one)
! - legality: for the nvhpc cells: the rules (offload.engine.rules, with the fortran-oop restrictions) and AFAR's flang front end
!   (-fsyntax-only) and a CCE compile (tools/campaigns/oop.py legality,
!   results/oop/main/legality.json)
module oop_m
  implicit none
  integer, parameter :: n = 64
  type vec
    integer :: n = 0
    integer, allocatable :: a(:)
  end type vec
  !$omp declare mapper(deep: vec :: v) map(tofrom: v, v%a(1:v%n))
end module oop_m

program oop
  use omp_lib
  use oop_m
  implicit none
  integer :: host_flag
  logical :: ok
  integer :: r1
  type(vec) :: x
  integer :: i
  host_flag = 1
  !$omp target map(from: host_flag)
  host_flag = merge(1, 0, omp_is_initial_device())
  !$omp end target
  allocate(x%a(n))
  x%n = n
  do i = 1, n
    x%a(i) = i
  end do
  !$omp target teams distribute parallel do map(mapper(deep), tofrom: x)
  do i = 1, n
    x%a(i) = x%a(i) * x%n
  end do
  r1 = sum(x%a)
  ok = .true.
  ok = ok .and. (r1 == 133120)
  print '(a,i0)', 'r1= ', r1
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program oop

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

NVFORTRAN-W-0287-Unrecognized OpenMP directive - declare (site-oop--nvhpc-named-mapper-rejected.f90: 28)
  0 inform,   1 warnings,   0 severes, 0 fatal for oop_m
NVFORTRAN-S-0034-Syntax error at or near : (site-oop--nvhpc-named-mapper-rejected.f90: 49)
  0 inform,   0 warnings,   1 severes, 0 fatal for oop

What the specification requires

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

OpenMP 5.2 §5.8.8 p.162-164

OpenMP 5.2 §5.8.2

Evidence

Other compilers run it correctly

AFAR 24.3.0, CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4