Observed issues › afar-udr-derived-type-link
Appears not to supportRefused at link time · Fortran · OpenMP · Open
amdflang: declare reduction on a derived type used in a target loop fails at the device link (flang runtime symbols undefined)
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
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 | not supported | not supported | not supported | correct | correct | n/a | n/a |
| CCE 19.0.0 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| GCC 16.2.0 | fails another way | fails another way | fails another way | fails another way | fails another way | fails another way | 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 |
|---|---|---|
| not supported | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy | showld.lld: error: undefined symbol: flang_rt_verbose_abort(char const*, ...) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(std::__1::__throw_bad_variant_access[abi:nqn240000](char const*)) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(std::__1::__throw_bad_variant_access[abi:nqn240000](char const*)) ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)1>::Begin(Fortran::runtime::WorkQueue&) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(_FortranAInitialize) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(_FortranAInitialize) ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)0>::Begin(Fortran::runtime::WorkQueue&) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(_FortranAInitialize) |
| not supported | AFAR 24.3.0, MI250X | showld.lld: error: undefined symbol: flang_rt_verbose_abort(char const*, ...) >>> referenced by <dir>/repro.amdgpu9.0a.gfx90a-eaacd7.img.lto.o:(std::__1::__throw_bad_variant_access[abi:nqn240000](char const*)) >>> referenced by <dir>/repro.amdgpu9.0a.gfx90a-eaacd7.img.lto.o:(std::__1::__throw_bad_variant_access[abi:nqn240000](char const*)) ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)1>::Begin(Fortran::runtime::WorkQueue&) >>> referenced by <dir>/repro.amdgpu9.0a.gfx90a-eaacd7.img.lto.o:(_FortranAInitialize) >>> referenced by <dir>/repro.amdgpu9.0a.gfx90a-eaacd7.img.lto.o:(_FortranAInitialize) ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)0>::Begin(Fortran::runtime::WorkQueue&) >>> referenced by <dir>/repro.amdgpu9.0a.gfx90a-eaacd7.img.lto.o:(_FortranAInitialize) |
| fails another way | CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy CCE 19.0.0, MI250X | showWarning: Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable.. !$omp target teams distribute parallel do reduction(padd: rp) map(tofrom: rp) ftn-7032 ftn: ERROR FUZZ_PROG, File = afar-udr-derived-type-link.f90, Line = 17 Unsupported OpenMP construct Calls -- $udr_i_1FUZZ_DMOD |
| fails another way | CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy CCE 20.0.2, MI250X | showWarning: Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable.. !$omp target teams distribute parallel do reduction(padd: rp) map(tofrom: rp) ftn-7032 ftn: ERROR FUZZ_PROG, File = afar-udr-derived-type-link.f90, Line = 17 Unsupported OpenMP construct Calls -- $udr_i_1FUZZ_DMOD |
| fails another way | CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy CCE 21.0.3, MI250X CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy CCE 21.0.4, MI250X | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. !$omp target teams distribute parallel do reduction(padd: rp) map(tofrom: rp) ftn-7032 ftn: ERROR FUZZ_PROG, File = afar-udr-derived-type-link.f90, Line = 17 Unsupported OpenMP construct Calls -- $udr_i_1FUZZ_DMOD |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | showNVFORTRAN-W-0155-Unimplemented feature - DECLARE REDUCTION (afar-udr-derived-type-link.f90: 6) 0 inform, 1 warnings, 0 severes, 0 fatal for fuzz_dmod NVFORTRAN-S-0155-The reduction intrinsic must be MAX, MIN, IAND, IOR, or IEOR, not padd (afar-udr-derived-type-link.f90: 17) 0 inform, 0 warnings, 1 severes, 0 fatal for fuzz_prog |
| fails another way | GCC 16.2.0, MI300A unified GCC 16.2.0, MI300A copy GCC 16.2.0, MI250X GCC 16.2.0, MI300X GCC 16.2.0, MI350X GCC 16.2.0, A100 separate | showafar-udr-derived-type-link.f90:17:54:
17 | !$omp target teams distribute parallel do reduction(padd: rp) map(tofrom: rp)
| 1
Error: !$OMP DECLARE REDUCTION padd not found at (1) |
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
AFAR 24.3.0, MI300X (runs correctly)
$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro HSA_XNACK=0 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (33 lines)
module fuzz_dmod
implicit none
type :: pair_t
integer :: x, y
end type pair_t
!$omp declare reduction(padd: pair_t: omp_out = &
!$omp& pair_t(omp_out%x + omp_in%x, omp_out%y + omp_in%y)) &
!$omp& initializer(omp_priv = pair_t(0, 0))
end module fuzz_dmod
program fuzz_prog
use fuzz_dmod
implicit none
integer, parameter :: n = 64
type(pair_t) :: rp
integer :: i
rp = pair_t(1, 2)
!$omp target teams distribute parallel do reduction(padd: rp) map(tofrom: rp)
do i = 1, n
rp = pair_t(rp%x + i, rp%y + mod(i, 3))
end do
print '(a,i0,a,i0)', 'RESULT checksum=', rp%x * 1000 + rp%y, ' ran_on_host=', 0
end program fuzz_prog
! spec (requirement): A declare reduction directive declares a user-defined reduction identifier usable in a reduction
! clause.
! "The declare reduction directive declares a reduction-identifier that can be used in a reduction clause as a
! user-defined reduction." (5.2 §5.5.11 p.139 l.18-19)
! spec (requirement): The identifier can be used in a reduction clause on variables of the types listed in the
! directive, here a derived type.
! "The reduction-identifier can later be used in a reduction clause that uses variables of the types specified in the
! declare reduction directive." (5.2 §5.5.11 p.139 l.24-26)
! spec (this program): The module declares reduction(padd: pair_t) and the program uses padd on a target teams
! distribute parallel do; the compiler must generate the combiner and initializer for the device, and amdflang
! instead fails at the device link on undefined flang runtime symbols.
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
ld.lld: error: undefined symbol: flang_rt_verbose_abort(char const*, ...) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(std::__1::__throw_bad_variant_access[abi:nqn240000](char const*)) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(std::__1::__throw_bad_variant_access[abi:nqn240000](char const*)) ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)1>::Begin(Fortran::runtime::WorkQueue&) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(_FortranAInitialize) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(_FortranAInitialize) ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)0>::Begin(Fortran::runtime::WorkQueue&) >>> referenced by <dir>/repro.amdgpu9.42.gfx942-5a66dd.img.lto.o:(_FortranAInitialize)
What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §5.5.11 p.139 l.18-19
The declare reduction directive declares a reduction-identifier that can be used in a reduction clause as a user-defined reduction.
OpenMP 5.2 §5.5.11 p.139 l.24-26
The reduction-identifier can later be used in a reduction clause that uses variables of the types specified in the declare reduction directive.
Evidence
Same compiler, one change
- the same reduction on a host parallel do (no target teams distribute): 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
Control program
module fuzz_dmod implicit none type :: pair_t integer :: x, y end type pair_t !$omp declare reduction(padd: pair_t: omp_out = & !$omp& pair_t(omp_out%x + omp_in%x, omp_out%y + omp_in%y)) & !$omp& initializer(omp_priv = pair_t(0, 0)) end module fuzz_dmod program fuzz_prog use fuzz_dmod implicit none integer, parameter :: n = 64 type(pair_t) :: rp integer :: i rp = pair_t(1, 2) !$omp parallel do reduction(padd: rp) do i = 1, n rp = pair_t(rp%x + i, rp%y + mod(i, 3)) end do print '(a,i0)', 'RESULT checksum=', rp%x * 1000 + rp%y end program fuzz_prog