OffTarget

Observed issues › oop/nvhpc-polymorphic-dispatch-translate-failure

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

dynamic dispatch of a type-bound procedure in device code makes the compiler fail

Legality: contested. An independent adjudicating reading finds the result not required: The specification requires type-bound procedures accessed in a target region to appear in a declare target directive. The overriding procedures sq_area, rect_area and area_of carry one, but the deferred binding is declared only through an abstract interface, so whether the requirement is met is not settled. Nothing specifies device-side dynamic dispatch, so refusal is not shown to violate a requirement. How this is checked

A declare target function calls a type-bound procedure through a CLASS dummy argument. NVHPC 25.11 and 26.9 stop with 'Compiler failed to translate accelerator region'. AFAR runs it correctly.

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.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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
NVHPC 25.11, A100 managed
show
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): No device symbol for address reference (site-oop--nvhpc-polymorphic-dispatch-translate-failure.f90: 76)
NVFORTRAN-F-0704-Compilation aborted due to previous errors. (site-oop--nvhpc-polymorphic-dispatch-translate-failure.f90)
NVFORTRAN/x86-64 Linux 25.11-0: compilation aborted
behaves incorrectlyNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): No device symbol for address reference (site-oop--nvhpc-polymorphic-dispatch-translate-failure.f90: 76)
NVFORTRAN-F-0704-Compilation aborted due to previous errors. (site-oop--nvhpc-polymorphic-dispatch-translate-failure.f90)
NVFORTRAN/x86-64 Linux 26.9-0: compilation aborted
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
lld: error: undefined symbol: __GET_TYPE_BOUND_PROC
>>> referenced by <dir>:(oop_$ck_L76_2)
>>> referenced by <dir>:(oop_$ck_L76_2)
fails another wayCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
lld: error: undefined symbol: __GET_TYPE_BOUND_PROC
>>> referenced by <dir>:(oop_$ck_L76_2)
>>> referenced by <dir>:(oop_$ck_L76_2)
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
lld: error: undefined symbol: __GET_TYPE_BOUND_PROC
>>> referenced by <dir>//cooltmpdir-JwOEw3/repro-cce-openmppost_lld.amdgpu.lto.o:(oop_$ck_L76_2)
>>> referenced by <dir>//cooltmpdir-JwOEw3/repro-cce-openmppost_lld.amdgpu.lto.o:(oop_$ck_L76_2)
fails another wayCCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
lld: error: undefined symbol: __GET_TYPE_BOUND_PROC
>>> referenced by <dir>//cooltmpdir-1B1d2S/repro-cce-openmppost_lld.amdgpu.lto.o:(oop_$ck_L76_2)
>>> referenced by <dir>//cooltmpdir-1B1d2S/repro-cce-openmppost_lld.amdgpu.lto.o:(oop_$ck_L76_2)
fails another wayGCC 16.2.0, MI300A unified
show
RUN_TIMEOUT
fails another wayGCC 16.2.0, MI300A copy
show
Memory access fault by GPU node-4 (Agent handle: 0x591bc0) on address 0x401000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x15555469662f in ???
#1  0x1555546965af in ???
#2  0x155554669ee4 in ???
#3  0x1555540d6bfe in ???
#4  0x1555540d4288 in ???
fails another wayGCC 16.2.0, MI250X
show
Memory access fault by GPU node-5 (Agent handle: 0x783070) on address 0x400000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x15555469662f in ???
#1  0x1555546965af in ???
#2  0x155554669ee4 in ???
#3  0x1555540d6bfe in ???
#4  0x1555540d4288 in ???
fails another wayGCC 16.2.0, MI300X
show
Memory access fault by GPU node-1 (Agent handle: 0x15c5f00) on address 0x401000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x7f790e03ebef in ???
#1  0x7f790e08bedc in ???
#2  0x7f790e03eb45 in ???
#3  0x7f790e028832 in ???
#4  0x7f790dc89a5e in ???
fails another wayGCC 16.2.0, MI350X
show
Memory access fault by GPU node-1 (Agent handle: 0x5885c0) on address 0x401000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x7fa9dfe3fc2f in ???
#1  0x7fa9dfe8d02c in ???
#2  0x7fa9dfe3fb85 in ???
#3  0x7fa9dfe29872 in ???
#4  0x7fa9dfa89a5e in ???
fails another wayGCC 16.2.0, A100 separate
show
libgomp: cuCtxSynchronize error: an illegal memory access was encountered
libgomp: cuModuleGetFunction (__do_global_dtors__entry) error: an illegal memory access was encountered
libgomp: cuMemFree_v2 error: an illegal memory access was encountered
libgomp: device finalization failed

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 (85 lines)
! # Finding (fortran-oop): dispatch through a CLASS dummy in device code: 'Compiler failed to translate accelerator region'
!
! - toolchains and modes that fail: nvhpc (NVHPC 25.11: managed, separate), nvhpc269 (NVHPC 26.9: managed, separate); -O2
! - build: nvfortran -mp=gpu -gpu=cc80 -O2 (managed: -gpu=mem:managed)
! - failure: ice (a compiler failure: failed to translate); OMP_TARGET_OFFLOAD=mandatory
! - observed: `NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): No device symbol for
!   address reference`, then the compile fails, NVHPC 25.11 and 26.9, both modes. A compiler failure: the message does not say the
!   feature is unsupported and the user guide does not mention it
! - expected: compiles; `r1= 29`
! - rule: 5.2 §1.2.6 p.19 l.1-3 (every type-bound procedure accessed is declare target)
! - other families: AFAR correct; CCE fails at the link (cce-polymorphic-dispatch-device-link.f90); GCC aborts at run time
!   (gcc-polymorphic-dispatch-abort.f90)
! - gate and confirmer: 12 cells, 12 confirmed in the gate's four environments (a-d; results/oop/main/gate_reruns*.jsonl);
!   confirmer (results/oop/main/confirm.jsonl): compiler_bug (R10-compile-ice) 12
! - programs (3): oop-poly-dispatch, oop-poly-dispatch-loop, oop-poly-parent-call (offload/engine/oop_gen.py; this file is the first
!   one)
! - legality: for the nvhpc cells: the rules (offload.engine.rules, with the fortran-oop restrictions) and AFAR's flang front end
!   (-fsyntax-only) and a CCE compile (tools/campaigns/oop.py legality,
!   results/oop/main/legality.json)
module oop_m
  implicit none
  integer, parameter :: n = 64
  type, abstract :: shape
    integer :: id = 0
  contains
    procedure(area_if), deferred :: area
  end type shape
  abstract interface
    integer function area_if(s)
      import :: shape
      class(shape), intent(in) :: s
    end function area_if
  end interface
  type, extends(shape) :: sq
    integer :: side = 0
  contains
    procedure :: area => sq_area
  end type sq
  type, extends(shape) :: rect
    integer :: w = 0, h = 0
  contains
    procedure :: area => rect_area
  end type rect
contains
  integer function sq_area(s)
    !$omp declare target
    class(sq), intent(in) :: s
    sq_area = s%side * s%side
  end function sq_area
  integer function rect_area(s)
    !$omp declare target
    class(rect), intent(in) :: s
    rect_area = s%w * s%h
  end function rect_area
  integer function area_of(s)
    !$omp declare target
    class(shape), intent(in) :: s
    area_of = s%area()
  end function area_of
end module oop_m

program oop
  use omp_lib
  use oop_m
  implicit none
  integer :: host_flag
  logical :: ok
  integer :: r1
  type(sq) :: q
  type(rect) :: rr
  host_flag = 1
  !$omp target map(from: host_flag)
  host_flag = merge(1, 0, omp_is_initial_device())
  !$omp end target
  q%side = 3
  rr%w = 4
  rr%h = 5
  !$omp target map(tofrom: q, rr) map(from: r1)
  r1 = area_of(q) + area_of(rr)
  !$omp end target
  ok = .true.
  ok = ok .and. (r1 == 29)
  print '(a,i0)', 'r1= ', r1
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program oop

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

NVFORTRAN-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): No device symbol for address reference (site-oop--nvhpc-polymorphic-dispatch-translate-failure.f90: 76)
NVFORTRAN-F-0704-Compilation aborted due to previous errors. (site-oop--nvhpc-polymorphic-dispatch-translate-failure.f90)
NVFORTRAN/x86-64 Linux 25.11-0: compilation aborted

What the specification requires

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

OpenMP 5.2 §1.2.6 p.19 l.1-3

Evidence

Other compilers run it correctly

AFAR 24.3.0