OffTarget

Observed issues › oop/nvhpc-copy-pdt-length-parameter-illegal-address

Appears to behave incorrectlyRun-time error · Fortran · OpenMP · Open

mapping a derived type with a length type parameter faults with separate memory

Legality: not independently confirmed. Independent readings are uncertain: Fortran 2003 is a cited base language, so a parameterized derived type is not excluded. How this is checked

A variable of a parameterized derived type with a length type parameter, mapped tofrom, faults with an illegal address on NVHPC 25.11 and 26.9 when memory is separate; managed memory works. The same program with the type's length parameter replaced by a fixed size works.

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.0fails another wayfails another wayunknown
not run
fails another wayfails another wayn/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 incorrectlycorrect
NVHPC 26.9n/an/an/an/an/abehaves incorrectlycorrect
GCC 16.2.0correctfails another wayfails another wayfails another wayfails another waybehaves incorrectlyn/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 26.9, A100 separate
show
Failing in Thread:1
Accelerator Fatal Error: call to cuMemcpyDtoHAsync returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
 File: <dir>
 Function: oop:30
 Line: 51
behaves incorrectlyGCC 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
fails another wayAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
error: loc("site-oop--nvhpc-copy-pdt-length-parameter-illegal-address.f90":24:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived
LLVM ERROR: aborting
fails another wayAFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
error: loc("site-oop--nvhpc-copy-pdt-length-parameter-illegal-address.f90":27:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived
LLVM ERROR: aborting
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..
module oop_m
       ^     
ftn-855 ftn: ERROR OOP_M, File = site-oop--nvhpc-copy-pdt-length-parameter-illegal-address.f90, Line = 21, Column = 8 
  The compiler has detected errors in module "OOP_M".  No module information file will be created for this module.
  type lv(m)
          ^  
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..
module oop_m
       ^     
ftn-855 ftn: ERROR OOP_M, File = site-oop--nvhpc-copy-pdt-length-parameter-illegal-address.f90, Line = 21, Column = 8 
  The compiler has detected errors in module "OOP_M".  No module information file will be created for this module.
  type lv(m)
          ^  
fails another wayCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 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..
module oop_m
       ^     
ftn-855 ftn: ERROR OOP_M, File = site-oop--nvhpc-copy-pdt-length-parameter-illegal-address.f90, Line = 21, Column = 8 
  The compiler has detected errors in module "OOP_M".  No module information file will be created for this module.
  type lv(m)
          ^  
fails another wayGCC 16.2.0, MI300A copy
show
Memory access fault by GPU node-6 (Agent handle: 0x590c10) on address 0x53d000. 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-4 (Agent handle: 0x7830d0) on address 0x737000. 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: 0x2359f50) on address 0x233a000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x7fa0a963ebef in ???
#1  0x7fa0a968bedc in ???
#2  0x7fa0a963eb45 in ???
#3  0x7fa0a9628832 in ???
#4  0x7fa0a9289a5e in ???
fails another wayGCC 16.2.0, MI350X
show
Memory access fault by GPU node-1 (Agent handle: 0x684610) on address 0x663000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x7fa87a43fc2f in ???
#1  0x7fa87a48d02c in ???
#2  0x7fa87a43fb85 in ???
#3  0x7fa87a429872 in ???
#4  0x7fa87a089a5e in ???

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

GCC 16.2.0, A100 separate

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=$GCC_16_2/lib64
$GCC_16_2/bin/gfortran -fopenmp -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.f90 -o repro
OMP_TARGET_OFFLOAD=mandatory ./repro

NVHPC 25.11, A100 managed (runs correctly)

export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib
nvfortran -mp=gpu -gpu=cc80 -gpu=mem:managed -O2 repro.f90 -o repro
OMP_TARGET_OFFLOAD=mandatory ./repro
Program (62 lines)
! # Finding (fortran-oop): mapping a derived type with a length type parameter: illegal address with separate memory
!
! - toolchains and modes that fail: nvhpc (NVHPC 25.11: separate), nvhpc269 (NVHPC 26.9: separate); -O2
! - build: nvfortran -mp=gpu -gpu=cc80 -O2 (managed: -gpu=mem:managed)
! - failure: run_error (exit 1); OMP_TARGET_OFFLOAD=mandatory
! - observed: `cuMemcpyDtoHAsync returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS)` in separate memory, NVHPC 25.11 and 26.9;
!   managed memory correct
! - expected: `r1= 16 r2= 1496`
! - rule: 5.2 §5.8.3 p.155 l.5-7 (the new list item has the type parameters of the original)
! - same-compiler control: the same program with the type's length parameter replaced by a fixed size
!   (controls/pdt-len-unparameterized.f90, one change): correct (check=pass) on NVHPC 25.11 and 26.9, separate and managed memory
!   in the stored run and the gate's four environments a-d, (c) on another node or GPU
!   (results/oop/probe/ctl2.*.pdt-len-unparameterized.*.jsonl); a kind type parameter alone (controls/pdt-kind.f90) is correct too
!   (results/oop/main/rows.part*.jsonl, results/oop/probe/ctl2.*.pdt-kind.*.jsonl)
! - other families: AFAR (not implemented) and CCE (ftn-1853) reject the programs; GCC 16.2 aborts
! - gate and confirmer: 8 cells, 8 confirmed in the gate's four environments (a-d; results/oop/main/gate_reruns*.jsonl); confirmer
!   (results/oop/main/confirm.jsonl): needs_human (R22-expected-weak) 8; R22-expected-weak means the expected value has one
!   source, the generator's Python model; the values follow from the program's arithmetic (checked by hand), and no compiler
!   outside the failing family prints them on this program
! - programs (4): oop-pdt-len, oop-pdt-deferred, oop-pdt-array, oop-pdt-kindlen (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) (tools/campaigns/oop.py legality, results/oop/main/legality.json)
module oop_m
  implicit none
  integer, parameter :: n = 64
  type lv(m)
  integer, len :: m
  integer :: a(m)
  end type lv
end module oop_m

program oop
  use omp_lib
  use oop_m
  implicit none
  integer :: host_flag
  logical :: ok
  integer :: r1, r2
  type(lv(16)) :: x
  integer :: i
  host_flag = 1
  !$omp target map(from: host_flag)
  host_flag = merge(1, 0, omp_is_initial_device())
  !$omp end target
  do i = 1, 16
    x%a(i) = i
  end do
  !$omp target map(tofrom: x) map(from: r1)
  r1 = x%m
  do i = 1, x%m
    x%a(i) = x%a(i) * x%a(i)
  end do
  !$omp end target
  r2 = sum(x%a)
  ok = .true.
  ok = ok .and. (r1 == 16)
  ok = ok .and. (r2 == 1496)
  print '(a,i0)', 'r1= ', r1
  print '(a,i0)', 'r2= ', r2
  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

Failing in Thread:1
Accelerator Fatal Error: call to cuMemcpyDtoHAsync returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
 File: <dir>
 Function: oop:30
 Line: 51

What the specification requires

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

OpenMP 5.2 §5.8.3 p.155 l.5-7

Evidence

Same compiler, one change

  • the same program; the type has no length parameter (a fixed size instead): not run yet
    Control program
    ! control for oop-pdt-len: the same program; one change: the type has no length parameter (a component m = 16 and a
    ! fixed a(16) in its place; type(lv) :: x for type(lv(16)) :: x), so x%m reads the component
    ! fortran-oop pdt/len (OpenMP 5.2, free-form Fortran):
    ! a derived type with a length type parameter (constant), its value read on the device
    ! spec: OpenMP 5.2 §5.8.3 p.151-155 (map clause); OpenMP 5.2 §5.8.3 p.155 l.5-7
    ! legality: defined
    ! expected (computed by compliance/oop_gen.py): r1= 16, r2= 1496
    module oop_m
      implicit none
      integer, parameter :: n = 64
      type lv
      integer :: m = 16
      integer :: a(16)
      end type lv
    end module oop_m
    
    program oop
      use omp_lib
      use oop_m
      implicit none
      integer :: host_flag
      logical :: ok
      integer :: r1, r2
      type(lv) :: x
      integer :: i
      host_flag = 1
      !$omp target map(from: host_flag)
      host_flag = merge(1, 0, omp_is_initial_device())
      !$omp end target
      do i = 1, 16
        x%a(i) = i
      end do
      !$omp target map(tofrom: x) map(from: r1)
      r1 = x%m
      do i = 1, x%m
        x%a(i) = x%a(i) * x%a(i)
      end do
      !$omp end target
      r2 = sum(x%a)
      ok = .true.
      ok = ok .and. (r1 == 16)
      ok = ok .and. (r2 == 1496)
      print '(a,i0)', 'r1= ', r1
      print '(a,i0)', 'r2= ', r2
      print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
    end program oop