OffTarget

Observed issues › nvhpc-c-map-present-ignored

Appears to behave incorrectlyWrong answer · C · OpenMP · Open

Map(present, ...) of an absent variable is accepted and ignored (no error termination)

Legality: independently confirmed. 2 independent readings find the program legal and the result required. 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.0behaves incorrectlycorrectunknown
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/abehaves incorrectlybehaves incorrectly
NVHPC 26.9n/an/an/an/an/abehaves incorrectlybehaves incorrectly
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
behaves incorrectlyAFAR 24.3.0, MI300A unified
NVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
continued after map(present) of an absent a: b[63]=63

Reproduce

AFAR 24.3.0, MI300A unified

$AFAR/bin/amdclang -fopenmp --offload-arch=gfx942 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

NVHPC 25.11, A100 separate

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

NVHPC 26.9, A100 separate

export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib
nvc -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.c -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
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (36 lines)
// NVHPC 25.11, NVIDIA A100 80GB PCIe (wingtip, sm_80), both memory modes:
// nvc accepts the present map-type modifier and ignores it: a target
// construct with map(present, to: a) for an a that is not present runs on
// (it maps a), where the spec requires runtime error termination.
// Spec: "If a map clause with a present map-type-modifier appears on a
// construct and on entry to the region the corresponding list item is not
// present in the device data environment, runtime error termination is
// performed" (5.2 §5.8.3 p.152).
// Vendor: the 25.11 User's Guide names no present modifier (it lists
// always, close and mapper: §7.4, 2.19.7); nvfortran rejects the modifier
// at compile time (the Fortran catalog programs are rejected).
// Expected: runtime error termination before the printf.
// Observed (2026-10-24, nvc 25.11-0, -O2, OMP_TARGET_OFFLOAD=mandatory):
// "continued after map(present) of an absent a: b[63]=63", exit 0.
// The compile prints nothing (no warning, no message; exit 0) on 25.11 and
// 26.9.
// Found by the catalog (omp52/60-c-clause-map-present, negative probes:
// no_error_termination; confirmer R20-runtime-bug); reduced by hand.
// NVHPC 26.9 (26.9-0, the latest release; rerun 2026-10-24 on wingtip with
// the same flags): still present -- the same: the run goes on (b[63]=63), both modes.
// Fix (2026-10-24): rerun on 25.11 and 26.9 in both memory modes,
// each with its own runtime libraries (LD_LIBRARY_PATH = the release's
// compilers/lib; the first 26.9 runs had loaded 25.11's): still present
// on both releases, the same output.
// NVHPC: nvc -mp=gpu -gpu=cc80 -gpu=mem:separate -O2
// Run:   OMP_TARGET_OFFLOAD=mandatory ./a.out
#include <stdio.h>
int main(void) {
  int a[64], b[64];
  for (int i = 0; i < 64; i++) a[i] = i;
  #pragma omp target map(present, to: a) map(from: b)
  for (int i = 0; i < 64; i++)
    b[i] = a[i];
  printf("continued after map(present) of an absent a: b[63]=%d\n", b[63]);
  return 0;
}

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

continued after map(present) of an absent a: b[63]=63

What the specification requires

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

OpenMP 5.2 §5.8.3 p.152

If a map clause with a present map-type-modifier appears on a construct and on entry to the region the corresponding list item is not present in the device data environment, runtime error termination is performed

Evidence

Same compiler, one change

  • a enclosed in target data map(to: a), so it is present (the run must reach the printf): AFAR 24.3.0: correct; CCE 19.0.0: fails another way; CCE 20.0.2: fails another way; CCE 21.0.3: fails another way; CCE 21.0.4: fails another way; NVHPC 25.11: correct; NVHPC 26.9: correct
    Control program
    #include <stdio.h>
    int main(void) {
      int a[64], b[64];
      for (int i = 0; i < 64; i++) a[i] = i;
      #pragma omp target data map(to: a)
      #pragma omp target map(present, to: a) map(from: b)
      for (int i = 0; i < 64; i++)
        b[i] = a[i];
      printf("continued after map(present) of an absent a: b[63]=%d\n", b[63]);
      return 0;
    }
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, GCC 16.2.0