OffTarget

Observed issues › afar-c-xnack1-target-is-present

Appears to behave incorrectlyWrong answer · C · OpenMP · Open

AFAR offload runtime at HSA_XNACK=1: omp_target_is_present returns false after target enter data, and map(present) of an absent item does not terminate

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

Same issue as afar-xnack1-target-is-present; this program is another reproducer of it.

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/acorrectcorrect
NVHPC 26.9n/an/an/an/an/acorrectcorrect
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
show
after enter data: present= 0
after exit data: present= 0

Reproduce

AFAR 24.3.0, MI300A unified

$AFAR/bin/amdclang -fopenmp --offload-arch=gfx942 -fopenmp-version=52 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 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 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (25 lines)
// The C form of afar-xnack1-target-is-present.f90.
// After target enter data map(to: a), omp_target_is_present must return
// true (5.2 §18.8.3 p.389; the enter data creates a corresponding storage
// block, which may share storage with the original, 5.2 §5.8.3 p.153).
// Expected: after enter data: present= 1, after exit data: present= 0
// Observed (tuolumne, MI300A, 2026-10-22, 3 runs each, -O2,
// OMP_TARGET_OFFLOAD=mandatory):
// - AFAR amdclang 24.0.0git at HSA_XNACK=1: present= 0 after enter data;
//   at HSA_XNACK=0: present= 1.
// - CCE craycc 19.0.0: present= 1 / 0 in both modes.
// AFAR: amdclang -fopenmp --offload-arch=gfx942 -fopenmp-version=52 -O2
// CCE:  craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa
//       -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2
// Run:  OMP_TARGET_OFFLOAD=mandatory HSA_XNACK=1 ./a.out
#include <stdio.h>
#include <omp.h>
int main(void) {
  int a[64], d = omp_get_default_device();
  for (int i = 0; i < 64; i++) a[i] = 1;
  #pragma omp target enter data map(to: a)
  printf("after enter data: present= %d\n", omp_target_is_present(a, d));
  #pragma omp target exit data map(release: a)
  printf("after exit data: present= %d\n", omp_target_is_present(a, d));
  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

after enter data: present= 0
after exit data: present= 0

What the specification requires

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

OpenMP 5.2 §18.8.3 p.389

OpenMP 5.2 §5.8.3 p.153

Evidence

Same compiler, one change

  • run at HSA_XNACK=0: AFAR 24.3.0: correct; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
    Control program
    #include <stdio.h>
    #include <omp.h>
    int main(void) {
      int a[64], d = omp_get_default_device();
      for (int i = 0; i < 64; i++) a[i] = 1;
      #pragma omp target enter data map(to: a)
      printf("after enter data: present= %d\n", omp_target_is_present(a, d));
      #pragma omp target exit data map(release: a)
      printf("after exit data: present= %d\n", omp_target_is_present(a, d));
      return 0;
    }
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0