OffTarget

Observed issues › nvhpc-c-ordered-in-target-nvcpfe-crash

Appears to behave incorrectlyCompiler crash · C · OpenMP · Open

nvc rejects ordered in a target parallel for with the ordered clause, and its front end then crashes intermittently

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.0correctcorrectunknown
not run
correctcorrectn/an/a
CCE 19.0.0fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayunknown
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 incorrectlyNVHPC 25.11, A100 separate
show
NVC++-S-0155-for must have the ordered clause specified  (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 77)
nvc-Fatal-$NVHPC_25_11/compilers/bin/tools/nvcpfe TERMINATED by signal 11
behaves incorrectlyNVHPC 25.11, A100 managed
show
NVC++-S-0155-for must have the ordered clause specified  (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 77)
NVC++-S-0094-Illegal type conversion required (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 82)
NVC++-S-0094-Illegal type conversion required (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 82)
NVC++/x86-64 Linux 25.11-0: compilation completed with severe errors
behaves incorrectlyNVHPC 26.9, A100 separate
show
NVC++-S-0155-for must have the ordered clause specified  (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 77)
NVC++-F-0000-Internal compiler error. cngtyp: unexpected conversion from non-scalar       0  (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 82)
NVC++/x86-64 Linux 26.9-0: compilation aborted
behaves incorrectlyNVHPC 26.9, A100 managed
show
NVC++-S-0155-for must have the ordered clause specified  (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 77)
nvc-Fatal-$NVHPC_26_9/compilers/bin/tools/nvcpfe TERMINATED by signal 11
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
Unknown KMPC: __kmpc_dispatch_init_4
Unknown KMPC: __kmpc_dispatch_next_4
Unknown KMPC: __kmpc_ordered
Unknown KMPC: __kmpc_end_ordered
Unknown KMPC: __kmpc_dispatch_fini_4
Unknown KMPC: __kmpc_dispatch_deinit
Unknown KMPC: __kmpc_dispatch_init_4
Unknown KMPC: __kmpc_dispatch_next_4

Reproduce

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

AFAR 24.3.0, MI300A unified (runs correctly)

$AFAR/bin/amdclang -fopenmp --offload-arch=gfx942 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (89 lines)
// (the reproduction gate's flagged cases): NVHPC 25.11 and 26.9 (nvc),
// NVIDIA A100 80GB PCIe (wingtip, sm_80), both memory modes. nvc rejects the
// ordered construct in a target parallel for with the ordered clause
// ("NVC++-S-0155-for must have the ordered clause specified", at the ordered
// region), and
// its front end then INTERMITTENTLY crashes ("nvc-Fatal-.../maintainers/nvcpfe
// TERMINATED by signal 11", compile exit status 2) instead of ending with
// the diagnostic.
// Spec: an ordered region binds to the innermost enclosing worksharing-loop
// region; "An ordered clause with a parameter value equal to one must
// appear on the construct that corresponds to the binding region" (5.2
// §15.10.2 p.331 l.16-17), and "If n is not specified then the behavior is
// as if n is specified with the same value as is specified for the collapse
// clause on the construct" (§4.4.4 p.94 l.18-19), so the program is
// conforming (the ordered clause applies to the for leaf of the combined
// construct, §17.2).
// Vendor: "The ordered block construct is supported only for CPU targets"
// (HPC Compilers User's Guide 25.11 §7.4, 2.17.9;
// data/index/claims/nvidia-hpc-25.11-user-guide-openmp.txt:295, and :194 for the
// ordered clause): documented unsupported, so a diagnostic is expected
// (rule R11c: unsupported, not a bug). Two quality-of-implementation
// defects remain: the diagnostic's text is wrong (it says the for "must
// have the ordered clause specified" when the clause is there), and the
// front end then sometimes crashes. No spec text governs either: a LOWER
// TIER finding (fix; the compile fails either way, with
// the diagnostic printed first, as for nvhpc-parallel-if-in-target-nvvm-ice).
// Expected: "RESULT ran_on_host=0 check=pass", or the diagnostic alone.
// Observed (the source compiled by its absolute path in a fresh directory;
// nvcpfe crashes / compiles, by source):
// - nvc 26.9, -gpu=mem:separate: 31 of 58 = the logs 27 of 53 (wingtip2
//   21/32, wingtip3 4/15, wingtip4 2/6; data/evidence/gate_probe/logs/) + the
//   reproduction gate's 4 reruns, 4 crashes + the
//   stored catalog row, no crash (results/widen/matrix.jsonl);
// - nvc 25.11, -gpu=mem:managed: 26 of 52 = the logs 25 of 47 (wingtip2
//   18/32, wingtip3 3/9, wingtip4 4/6) + the gate's 4 reruns, no crash + the
//   stored row, a crash (in its stderr);
// - nvc 26.9 managed: 6 of 7 (wingtip4 6/6; the stored row did not crash);
// - nvc 25.11 separate: 0 of 7 (wingtip4 0/6; the stored row did not).
// - A compile at a fixed path can crash or not (26.9 separate, a
//   37-character directory: 1 of 3; 25.11 managed, a 45-character path: 1
//   of 3), so this is not a function of the path alone; long paths crash
//   more often (26.9: none below 17 characters of directory name in the
//   length sweep, wingtip2.log). Compiled as the relative name prog.c in the
//   working directory: 0 of 80 (wingtip1.log; that also changes the file
//   name, not only the path). The scripts: data/evidence/gate_probe/wingtip/round1-4/
//   (those runs were not inside compliant.slice: see the scripts' notes).
// Control (same compilers, same flags): the same loop and ordered region
// without target (a host parallel for ordered, which the guide supports)
// compiles and prints "RESULT ran_on_host=1 check=pass" on both releases
// and both memory modes (data/evidence/gate_probe/logs/wingtip4.log).
// Another family: AFAR amdclang compiles the program and prints
// "RESULT ran_on_host=0 check=pass" on MI300A at HSA_XNACK 1 and 0 and on
// MI250X (results/widen/matrix*.jsonl). CCE craycc fails to link it
// (__kmpc_dispatch_init_4, data/findings/catalog/cce-c-ordered-link.c).
// Found by the widened catalog (omp52-c-w-ordered, the cells nvhpc/managed
// and nvhpc269/copy, reproduction-gate verdict environment); the program
// is the catalog program itself.
// NVHPC: nvc -mp=gpu -gpu=cc80 -gpu=mem:separate -O2 $PWD/omp52-c-w-ordered.c
#include <stdio.h>
#include <stdbool.h>
#include <omp.h>

enum { n = 64 };

int main(void) {
  int a[n], b[n], ref[n];
  int host_flag = 1;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    a[i] = i + 1;
    b[i] = 0;
    ref[i] = i + 1;
  }
  #pragma omp target parallel for ordered map(to: a) map(tofrom: b, cnt, host_flag)
  for (int i = 0; i < n; i++) {
    #pragma omp ordered
    {
      b[cnt] = a[i];
      cnt = cnt + 1;
    }
    if (i == 0) host_flag = omp_is_initial_device();
  }
  bool ok = true;
  for (int i = 0; i < n; i++)
    ok = ok && (b[i] == ref[i]);
  ok = ok && (cnt == n);
  printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail");
  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

Expected

RESULT ran_on_host=0 check=pass

Observed where it behaves incorrectly

NVC++-S-0155-for must have the ordered clause specified  (site-nvhpc-c-ordered-in-target-nvcpfe-crash.c: 77)
nvc-Fatal-$NVHPC_25_11/compilers/bin/tools/nvcpfe TERMINATED by signal 11

What the specification requires

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

OpenMP 5.2 §15.10.2 p.331 l.16-17

An ordered clause with a parameter value equal to one must appear on the construct that corresponds to the binding region

OpenMP 5.2 §4.4.4 p.94 l.18-19

If n is not specified then the behavior is as if n is specified with the same value as is specified for the collapse clause on the construct

OpenMP 5.2 §17.2

Evidence

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0