Observed issues › catalog/nvhpc-flang-type-bound-kernel-missing
nvc/nvfortran -mp=gpu: compile succeeds but the kernel is missing at run time ("Failed to find device function") for function pointers, static locals, VLAs, long double, type-bound calls
Legality: not independently confirmed. no independent review yet How this is checked
Same issue as catalog/nvhpc-c-function-pointer-kernel-missing; 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 NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | showAccelerator Fatal Error: Failed to find device function 'nvkernel_MAIN__F1L31_2_'! File was compiled with: -gpu=cc80 Rebuild this file with -gpu=cc80 to use NVIDIA Tesla GPU 0 File: <dir>/nvhpc-flang-type-bound-kernel-missing.f90 Function: wide_prog:16 Line: 31 |
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 (78 lines)
! # Draft finding: omp52-w-type-bound-nopass on nvhpc
!
! - compiler: nvhpc
! - toolchain: nvhpc; arch: sm_80; machine: wingtip; memory mode: copy; opt: -O2
! - program: catalog omp52-w-type-bound-nopass (f90, version 52, sha256 b1838fc2dcb2b1e6)
! - expected: check=pass (trusted; elision + model)
! - actual: run_error (exit_status: 1; without mandatory: exit_status: 1) [the confirmer's class run_error; the matrix's class of
! the same run is wrong_answer: a run that fails]
! - observed: the run ends with "Accelerator Fatal Error: Failed to find device function 'nvkernel_MAIN__F1L43_2_'! File
! was compiled with: -gpu=cc80" (NVHPC 25.11 and 26.9, separate and managed memory): the compile succeeds without generating the
! kernel of the target region that calls a type-bound procedure; the OpenACC form (acc34-w-type-bound-*) runs the parallel loop on
! the host instead (ran_on_host=1)
! - verdict: compiler_bug by rule R20-runtime-bug: a legal program fails at run time, deterministically, against an expected value
! from two or more independent sources with an executed witness, and another toolchain, mode, arch or the elision gives the
! expected value
! - reason: expected trusted check=pass (elision + model): stored main verdict: elision + model agree; witnesses: afar/gfx942/copy,
! cce19/gfx942/copy, cce20/gfx942/copy, cce21/gfx942/copy, elision
! - citations: RUL-DERIVED-NEEDS-EXECUTION (rulings.md); RUL-WITNESS-PER-MODE (rulings.md);
! RUL-SAME-COMPILER-RUNS (rulings.md); RUL-PRESENCE-WITNESS (rulings.md); RUL-METAMORPHIC-OTHER-FAMILY
! (rulings.md)
! - legality: legal: offload.engine.prerun.check accepts it (rerun: offload.engine.rules with the
! race rule and the restriction checks, and the AFAR flang front end, not under test here); no
! compiler under test, gfortran or gcc is a legality witness
! - witnesses: afar/gfx942/copy, cce19/gfx942/copy, cce20/gfx942/copy, cce21/gfx942/copy, elision
! - withdrawn: none
!
! Generated by compliance.widen (OpenMP 5.2, free-form Fortran; catalog widening). Do not edit.
! id: omp52-w-type-bound-nopass
! primary atom: base.device.type_bound_nopass
! atoms: base.device.type_bound_nopass
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
! feature: a NOPASS type-bound procedure called through a mapped object in device code
! spec: OpenMP 5.2 §1.7, pp.34-35: Fortran 2008 is a normative base language (the Fortran 2018 features whose use is unspecified are
! listed there; this is not one of them)
module wmod
implicit none
type op_t
integer :: k = 0
contains
procedure, nopass :: tw => tw_impl
end type op_t
contains
integer function tw_impl(x)
!$omp declare target
integer, intent(in) :: x
tw_impl = 2*x + 1
end function tw_impl
end module wmod
program wide_prog
use omp_lib, only: omp_is_initial_device
use wmod
implicit none
integer, parameter :: n = 64
integer :: a(n), b(n), ref(n)
type(op_t) :: op
integer :: i, host_flag
logical :: ok
do i = 1, n
a(i) = i
b(i) = 0
ref(i) = 2*i + 1
end do
host_flag = 1
!$omp target teams distribute parallel do map(to: a, op) map(from: b) map(tofrom: host_flag)
do i = 1, n
b(i) = op%tw(a(i))
if (i == 1) host_flag = merge(1, 0, omp_is_initial_device())
end do
!$omp end target teams distribute parallel do
ok = all(b == ref)
print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program wide_prog
Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page
Expected and observed
Expected
check=pass
Observed where it behaves incorrectly
Accelerator Fatal Error: Failed to find device function 'nvkernel_MAIN__F1L31_2_'! File was compiled with: -gpu=cc80 Rebuild this file with -gpu=cc80 to use NVIDIA Tesla GPU 0 File: <dir>/nvhpc-flang-type-bound-kernel-missing.f90 Function: wide_prog:16 Line: 31
What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §1.7 p.34-35
Evidence
Same compiler, one change
- tw_impl called directly instead of through the type-bound name op%tw: 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
module wmod implicit none type op_t integer :: k = 0 contains procedure, nopass :: tw => tw_impl end type op_t contains integer function tw_impl(x) !$omp declare target integer, intent(in) :: x tw_impl = 2*x + 1 end function tw_impl end module wmod program wide_prog use omp_lib, only: omp_is_initial_device use wmod implicit none integer, parameter :: n = 64 integer :: a(n), b(n), ref(n) type(op_t) :: op integer :: i, host_flag logical :: ok do i = 1, n a(i) = i b(i) = 0 ref(i) = 2*i + 1 end do host_flag = 1 !$omp target teams distribute parallel do map(to: a, op) map(from: b) map(tofrom: host_flag) do i = 1, n b(i) = tw_impl(a(i)) if (i == 1) host_flag = merge(1, 0, omp_is_initial_device()) end do !$omp end target teams distribute parallel do ok = all(b == ref) print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok) end program wide_prog
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