Observed issues › nvhpc-c-parallel-if-in-target-nvvm-ice
nvfortran/nvc -mp=gpu: if clause on a parallel loop in a target region gives an internal NVVM error instead of the documented diagnostic
Legality: not independently confirmed. no independent review yet How this is checked
Same issue as nvhpc-parallel-if-in-target-nvvm-ice; this program is another reproducer of it.
Affected variants
| Compiler | MI300A 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.0 | correct | correct | unknown not run | correct | correct | n/a | n/a |
| CCE 19.0.0 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | behaves incorrectly | behaves incorrectly |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | behaves incorrectly | behaves incorrectly |
| GCC 16.2.0 | correct | correct | correct | correct | correct | correct | n/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
| Result | Compiler and GPU | Message |
|---|---|---|
| behaves incorrectly | NVHPC 25.11, A100 separate | shownvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION nvnvvmd: error: <dir>/nvacczoGiplsZvH2jK.gpu (115, 32): parse '@nvkernel_main_F1L10_2_F1L12_4' defined with type 'void (i8*, i8*, i8*)*' NVC++-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-c-parallel-if-in-target-nvvm-ice.c: 12) |
| behaves incorrectly | NVHPC 25.11, A100 managed | shownvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION nvnvvmd: error: <dir>/nvacczuGiplueYH88y.gpu (115, 32): parse '@nvkernel_main_F1L10_2_F1L12_4' defined with type 'void (i8*, i8*, i8*)*' NVC++-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-c-parallel-if-in-target-nvvm-ice.c: 12) |
| behaves incorrectly | NVHPC 26.9, A100 separate | shownvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION nvnvvmd: error: <dir>/nvacc1mFjpF6G7DVsA.gpu (115, 32): parse '@nvkernel_main_F1L10_2_F1L12_4' defined with type 'void (i8*, i8*, i8*)*' NVC++-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-c-parallel-if-in-target-nvvm-ice.c: 12) |
| behaves incorrectly | NVHPC 26.9, A100 managed | shownvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION nvnvvmd: error: <dir>/nvaccWBFjpqeM9WmY8.gpu (115, 32): parse '@nvkernel_main_F1L10_2_F1L12_4' defined with type 'void (i8*, i8*, i8*)*' NVC++-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-c-parallel-if-in-target-nvvm-ice.c: 12) |
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 (50 lines)
// NVHPC 25.11, NVIDIA A100 80GB PCIe (wingtip, sm_80), both memory modes: the C
// form of nvhpc-parallel-if-in-target-nvvm-ice.f90. An if clause on a parallel
// for in a target region, whose body calls omp_get_num_threads, makes the
// device compiler fail (nvvmCompileProgram: failed with error 9:
// NVVM_ERROR_COMPILATION, "'@nvkernel_main_...' defined with type 'void (i8*,
// i8*, i8*)*'") instead of compiling the program or giving a diagnostic.
// Without the omp_get_num_threads call the program compiles.
// Spec: the if clause is one of the inputs that "are used to determine the
// number of threads to use in the region" (5.2 §10.1.1 p.226).
// Vendor: "The if and copyin clauses are supported only for CPU targets; the
// compiler emits an error for GPU targets" (HPC Compilers User's Guide 25.11
// §7.4, 2.6): documented unsupported, so the bug is the internal failure where
// a diagnostic is promised. The guide's §2.20 sentence "nested teams or
// parallel regions in a target region are not supported" is read as a
// parallel region nested in another parallel (or teams) region inside a
// target region; here the parallel region is the only one in the target
// region.
// Expected: "sum 2080 nthr 1" (or a diagnostic naming the if clause).
// Observed (2026-10-24, nvc 25.11-0, -O2): compile exit status 2 with the NVVM
// error.
// Found by the catalog (omp52/60-c-clause-if: confirmer R10-compile-ice);
// 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 NVVM error, 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
#include <stdio.h>
#include <stdbool.h>
#include <omp.h>
int main(void) {
int a[64];
int nthr = 0;
bool use_par = false;
for (int i = 0; i < 64; i++) a[i] = 0;
#pragma omp target map(tofrom: a) map(from: nthr)
{
#pragma omp parallel for if(use_par)
for (int i = 0; i < 64; i++) {
a[i] = i + 1;
if (i == 0) nthr = omp_get_num_threads();
}
}
int s = 0;
for (int i = 0; i < 64; i++) s += a[i];
printf("sum %d nthr %d\n", s, nthr);
return 0;
}
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
nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION nvnvvmd: error: <dir>/nvacczoGiplsZvH2jK.gpu (115, 32): parse '@nvkernel_main_F1L10_2_F1L12_4' defined with type 'void (i8*, i8*, i8*)*' NVC++-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-c-parallel-if-in-target-nvvm-ice.c: 12)
What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §10.1.1 p.226
are used to determine the number of threads to use in the region
Evidence
Same compiler, one change
- the if clause removed: 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; NVHPC 25.11: correct; NVHPC 26.9: correct
Control program
#include <stdio.h> #include <stdbool.h> #include <omp.h> int main(void) { int a[64]; int nthr = 0; bool use_par = false; for (int i = 0; i < 64; i++) a[i] = 0; #pragma omp target map(tofrom: a) map(from: nthr) { #pragma omp parallel for for (int i = 0; i < 64; i++) { a[i] = i + 1; if (i == 0) nthr = omp_get_num_threads(); } } int s = 0; for (int i = 0; i < 64; i++) s += a[i]; printf("sum %d nthr %d\n", s, nthr); return 0; }
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, GCC 16.2.0