OffTarget

Observed issues › nvhpc-parallel-if-in-target-nvvm-ice

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

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: 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.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 incorrectlyNVHPC 25.11, A100 separate
show
nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION
nvnvvmd: error: <dir>/nvaccM1KkpY0m4wEg1.gpu (101, 14): parse invalid forward reference to function 'nvkernel_MAIN__F1L7_2__F1L8_4_' with wrong type!
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-parallel-if-in-target-nvvm-ice.f90: 8)
behaves incorrectlyNVHPC 25.11, A100 managed
show
nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION
nvnvvmd: error: <dir>/nvacc3jLkpL8eHV1ES.gpu (101, 14): parse invalid forward reference to function 'nvkernel_MAIN__F1L7_2__F1L8_4_' with wrong type!
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-parallel-if-in-target-nvvm-ice.f90: 8)
behaves incorrectlyNVHPC 26.9, A100 separate
show
NVFORTRAN-W-0155-Passing external procedure as argument in OpenACC/OpenMP device routine context - runtime behavior may be unsupported - nvkernel_MAIN__F1L7_2__F1L8_4 (nvhpc-parallel-if-in-target-nvvm
nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION
nvnvvmd: error: <dir>/nvacc_fbjp6Sa_UgIi.gpu (101, 14): parse invalid forward reference to function 'nvkernel_MAIN__F1L7_2__F1L8_4_' with wrong type!
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-parallel-if-in-target-nvvm-ice.f90: 8)
behaves incorrectlyNVHPC 26.9, A100 managed
show
NVFORTRAN-W-0155-Passing external procedure as argument in OpenACC/OpenMP device routine context - runtime behavior may be unsupported - nvkernel_MAIN__F1L7_2__F1L8_4 (nvhpc-parallel-if-in-target-nvvm
nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION
nvnvvmd: error: <dir>/nvaccpnbjpT8gHh2KU.gpu (101, 14): parse invalid forward reference to function 'nvkernel_MAIN__F1L7_2__F1L8_4_' with wrong type!
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-parallel-if-in-target-nvvm-ice.f90: 8)

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 (55 lines)
! NVHPC 25.11, NVIDIA A100 80GB PCIe (wingtip, sm_80), both memory modes
! (-gpu=mem:separate and -gpu=mem:managed): an if clause on a parallel do
! nested in a target region makes the device compiler fail
! (nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION, "parse
! invalid forward reference to function 'nvkernel_MAIN__...' with wrong
! type!") instead of compiling the program or giving a diagnostic.
! 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); an if clause
! that evaluates to false gives a team of one thread. The program is legal.
! 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 Parallel Construct): documented unsupported, so the bug
! is the internal device-compiler 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 do is the only parallel region in the target region.
! Expected: "sum 2080" (or a diagnostic naming the if clause).
! Observed (2026-10-24, nvfortran 25.11-0, -O2): compile exit status 2 with
! the NVVM error and "NVFORTRAN-W-0155-Compiler failed to translate
! accelerator region (see -Minfo messages): Device compiler exited with
! error status code"; the same for the C port (nvc) of the catalog program.
! Found by the catalog (omp50/52/60-clause-if, 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 failure, now after a new warning "NVFORTRAN-W-0155-Passing external procedure as
! argument in OpenACC/OpenMP device routine context - runtime behavior may be unsupported"; 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.
! Coverage-parity fuzz, stratum c1 (2026-11-03): program par-c1-nvhpc-nvhpc269:2306, a
! parallel do with proc_bind(spread) and if(parallel: lpar) in a target region, stops the same way
! on 25.11 and 26.9 (nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION; rows
! results/parity/wingtip/results/fuzz/par-c1-nvhpc-nvhpc269/programs.jsonl; the gate confirms both
! cells in a-d, results/parity/wingtip/results/parity/gate/fuzz/verdicts.nvhpc-topup.jsonl). New
! facet: the if clause with the parallel directive-name modifier reaches the NVVM failure too, while
! six other c1 cells with if(parallel: ...) get the documented diagnostic "GPU target doesn't
! support 'if' clauses for managing parallel region". No separate finding.
! NVHPC: nvfortran -mp=gpu -gpu=cc80 -gpu=mem:separate -O2
! Run:   OMP_TARGET_OFFLOAD=mandatory ./a.out
program p
  implicit none
  integer :: a(64), i
  logical :: use_par
  use_par = .false.
  a = 0
  !$omp target map(tofrom: a)
    !$omp parallel do if(use_par)
    do i = 1, 64
      a(i) = i
    end do
  !$omp end target
  print *, 'sum', sum(a)
end program p

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

nvvmCompileProgram: failed with error 9: NVVM_ERROR_COMPILATION
nvnvvmd: error: <dir>/nvaccM1KkpY0m4wEg1.gpu (101, 14): parse invalid forward reference to function 'nvkernel_MAIN__F1L7_2__F1L8_4_' with wrong type!
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (nvhpc-parallel-if-in-target-nvvm-ice.f90: 8)

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
    program p
      implicit none
      integer :: a(64), i
      logical :: use_par
      use_par = .false.
      a = 0
      !$omp target map(tofrom: a)
        !$omp parallel do
        do i = 1, 64
          a(i) = i
        end do
      !$omp end target
      print *, 'sum', sum(a)
    end program p
    

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

Reproducers of this issue