OffTarget

Observed issues › oop/afar-pdt-length-parameter-not-implemented

Appears not to supportRefused at compile time · Fortran · OpenMP · Open

length type parameters of derived types are not implemented in offload code

Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked

AMD's flang reports 'not yet implemented' for a parameterized derived type with a length type parameter used in a target region. A kind type parameter 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.0not supportednot supportedunknown
not run
not supportednot supportedn/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/afails another waycorrect
NVHPC 26.9n/an/an/an/an/afails another waycorrect
GCC 16.2.0correctfails 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
not supportedAFAR 24.3.0, MI300A unified
AFAR 24.3.0, MI300A copy
show
error: loc("site-oop--afar-pdt-length-parameter-not-implemented.f90":21:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived types
LLVM ERROR: aborting
not supportedAFAR 24.3.0, MI300X
AFAR 24.3.0, MI350X
show
error: loc("site-oop--afar-pdt-length-parameter-not-implemented.f90":24:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived types
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--afar-pdt-length-parameter-not-implemented.f90, Line = 18, 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--afar-pdt-length-parameter-not-implemented.f90, Line = 18, 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--afar-pdt-length-parameter-not-implemented.f90, Line = 18, 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 wayNVHPC 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:27
 Line: 48
fails another wayGCC 16.2.0, MI300A copy
show
Memory access fault by GPU node-7 (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-10 (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: 0xec1f50) on address 0xea2000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x7ff741a3ebef in ???
#1  0x7ff741a8bedc in ???
#2  0x7ff741a3eb45 in ???
#3  0x7ff741a28832 in ???
#4  0x7ff741689a5e in ???
fails another wayGCC 16.2.0, MI350X
show
Memory access fault by GPU node-1 (Agent handle: 0x112c610) on address 0x110b000. Reason: Unknown.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0  0x7f2d7903fc2f in ???
#1  0x7f2d7908d02c in ???
#2  0x7f2d7903fb85 in ???
#3  0x7f2d79029872 in ???
#4  0x7f2d78c89a5e 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

AFAR 24.3.0, MI300A unified

$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 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 (59 lines)
! # Finding (fortran-oop): amdflang: a derived type with a length type parameter in a target region is not implemented
!
! - toolchains and modes that fail: afar (AFAR: copy, unified); -O2
! - build: amdflang -fopenmp --offload-arch=gfx942 -fopenmp-version=52 -O2
! - failure: rejected (not_implemented); OMP_TARGET_OFFLOAD=mandatory
! - observed: `flang/lib/Lower/ConvertType.cpp:470: not yet implemented` for the length parameter, both modes
! - expected: compiles; `r1= 16 r2= 1496`
! - rule: 5.2 §5.8.3 p.155 l.5-7 (type parameters of mapped list items)
! - 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 AFAR in both modes 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)
! - other families: CCE rejects them too (cce-pdt-default-mapper-rejected.f90); GCC 16.2 aborts at run time
! - 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): unsupported (R05-unsupported) 8
! - 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: the rules accept every program; the front ends of the other families: CCE compiles none (its own rejection,
!   cce-pdt-default-mapper-rejected.f90) and NVHPC's verdict is in results/oop/main/witness.jsonl; the not-implemented message is
!   AFAR's own statement of a missing feature
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

error: loc("site-oop--afar-pdt-length-parameter-not-implemented.f90":21:8): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/ConvertType.cpp:470: not yet implemented: parameterized derived types
LLVM ERROR: aborting

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
    

Other compilers run it correctly

NVHPC 25.11, NVHPC 26.9, GCC 16.2.0