Open
Description
I'm getting some undefined symbols with the flang offload runtime if I try to assign to an array in a target region. Array assignments in target regions have worked previously.
Here's a reproducer
program assign
implicit none
integer, dimension(10) :: xs
!$omp target map(xs)
xs = 1
!$omp end target
print *, xs
end program
Trying to build it with
$ flang -fopenmp --offload-arch=gfx1100 assign.f90 -L$RUNTIME_DIR
outputs
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
ld.lld: error: undefined symbol: std::in_place_index<0ul>
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(void std::_Construct<std::__detail::__variant::_Uninitialized<Fortran::runtime::AssignTicket, true>, std::in_place_index_t<0ul> const&, Fortran::runtime::Descriptor&, Fortran::runtime::Descriptor const&, int&, void* (*&)(void*, void const*, unsigned long), Fortran::runtime::typeInfo::DerivedType const*&>(std::__detail::__variant::_Uninitialized<Fortran::runtime::AssignTicket, true>*, std::in_place_index_t<0ul> const&, Fortran::runtime::Descriptor&, Fortran::runtime::Descriptor const&, int&, void* (*&)(void*, void const*, unsigned long), Fortran::runtime::typeInfo::DerivedType const*&))
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(void std::_Construct<std::__detail::__variant::_Uninitialized<Fortran::runtime::AssignTicket, true>, std::in_place_index_t<0ul> const&, Fortran::runtime::Descriptor&, Fortran::runtime::Descriptor const&, int&, void* (*&)(void*, void const*, unsigned long), Fortran::runtime::typeInfo::DerivedType const*&>(std::__detail::__variant::_Uninitialized<Fortran::runtime::AssignTicket, true>*, std::in_place_index_t<0ul> const&, Fortran::runtime::Descriptor&, Fortran::runtime::Descriptor const&, int&, void* (*&)(void*, void const*, unsigned long), Fortran::runtime::typeInfo::DerivedType const*&))
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(void std::_Construct<std::__detail::__variant::_Uninitialized<Fortran::runtime::FinalizeTicket, true>, std::in_place_index_t<0ul> const&, Fortran::runtime::Descriptor const&, Fortran::runtime::typeInfo::DerivedType const&>(std::__detail::__variant::_Uninitialized<Fortran::runtime::FinalizeTicket, true>*, std::in_place_index_t<0ul> const&, Fortran::runtime::Descriptor const&, Fortran::runtime::typeInfo::DerivedType const&))
>>> referenced 11 more times
ld.lld: error: undefined symbol: Fortran::runtime::DerivedAssignTicket<true>::Begin(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_19DerivedAssignTicketILb1EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_19DerivedAssignTicketILb1EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)0>::Begin(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE0EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE0EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)1>::Begin(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE1EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE1EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::DerivedAssignTicket<false>::Begin(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_19DerivedAssignTicketILb0EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_0clINS0_19DerivedAssignTicketILb0EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::DerivedAssignTicket<true>::Continue(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_19DerivedAssignTicketILb1EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_19DerivedAssignTicketILb1EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)0>::Continue(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE0EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE0EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DescriptorIoTicket<(Fortran::runtime::io::Direction)1>::Continue(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE1EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr18DescriptorIoTicketILNS6_9DirectionE1EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DerivedIoTicket<(Fortran::runtime::io::Direction)0>::Continue(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr15DerivedIoTicketILNS6_9DirectionE0EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr15DerivedIoTicketILNS6_9DirectionE0EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::io::descr::DerivedIoTicket<(Fortran::runtime::io::Direction)1>::Continue(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr15DerivedIoTicketILNS6_9DirectionE1EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_2io5descr15DerivedIoTicketILNS6_9DirectionE1EEEEEDaRT_)
ld.lld: error: undefined symbol: Fortran::runtime::DerivedAssignTicket<false>::Continue(Fortran::runtime::WorkQueue&)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_19DerivedAssignTicketILb0EEEEEDaRT_)
>>> referenced by /tmp/a.out.amdgcn.gfx1100-542f42.img.lto.o:(_ZZN7Fortran7runtime6Ticket8ContinueERNS0_9WorkQueueEENK3$_1clINS0_19DerivedAssignTicketILb0EEEEEDaRT_)
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)
/home/acc/llvm-stuff/llvm_upstream/install/bin/clang-linker-wrapper: error: 'clang' failed
flang-21: error: linker command failed with exit code 1 (use -v to see invocation)
I'm on commit 163871c and have built clang and flang with these configurations:
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_TARGETS_TO_BUILD='X86;AMDGPU' \
-DLLVM_LIT_ARGS=-v \
-DLLVM_ENABLE_PROJECTS='clang;mlir;flang;lld' \
-DLLVM_ENABLE_RUNTIMES='compiler-rt;openmp;offload;flang-rt' \
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=libc \
-DLLVM_RUNTIME_TARGETS='default;amdgcn-amd-amdhsa' \
-DLLVM_CCACHE_BUILD=ON \
../llvm-project/llvm
And the offload runtime with these:
cmake \
-DLLVM_ENABLE_RUNTIMES=flang-rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT="OpenMP" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DFLANG_RT_DEVICE_ARCHITECTURES='gfx1100' \
-DFLANG_RT_INCLUDE_TESTS=OFF \
../llvm-project/runtimes/