Skip to content

[offload] libomptarget :: amdgcn-amd-amdhsa tests are failing on Gentoo #118824

@mgorny

Description

@mgorny

While I've been working on standalone build, I've been hitting a bunch of AMDGPU-related test failures. Curious enough, I hit the same failures when I do a regular build. Reproduced against 4ad8b26 most recently, but I've seen it with 19.1.4 too. Note that I've had to apply #118807 for offload to build.

My commands are:

cmake ../llvm -GNinja -DLLVM_ENABLE_PROJECTS='clang;lld' -DLLVM_ENABLE_RUNTIMES='openmp;offload' -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_CCACHE_BUILD=ON  -DFFI_INCLUDE_DIR="/usr/lib64/libffi/include" -DLLVM_TARGETS_TO_BUILD='AMDGPU;NVPTX;X86' -DCLANG_DEFAULT_LINKER=lld
ninja
ninja check-runtimes

which seems to roughly match what the CI is doing.

An example failure looks like this:

FAIL: libomptarget :: amdgcn-amd-amdhsa :: api/assert.c (395 of 1433)
******************** TEST 'libomptarget :: amdgcn-amd-amdhsa :: api/assert.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/mgorny/git/llvm-project/build/./bin/clang -fopenmp    -I /home/mgorny/git/llvm-project/offload/test -I /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -L /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -L /home/mgorny/git/llvm-project/build/./lib -L /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src  -nogpulib -Wl,-rpath,/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/mgorny/git/llvm-project/build/./lib  -fopenmp-targets=amdgcn-amd-amdhsa /home/mgorny/git/llvm-project/offload/test/api/assert.c -o /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp /home/mgorny/git/llvm-project/build/./lib/libomptarget.devicertl.a && /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp | /home/mgorny/git/llvm-project/build/./bin/FileCheck /home/mgorny/git/llvm-project/offload/test/api/assert.c
# executed command: /home/mgorny/git/llvm-project/build/./bin/clang -fopenmp -I /home/mgorny/git/llvm-project/offload/test -I /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -L /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -L /home/mgorny/git/llvm-project/build/./lib -L /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/mgorny/git/llvm-project/build/./lib -fopenmp-targets=amdgcn-amd-amdhsa /home/mgorny/git/llvm-project/offload/test/api/assert.c -o /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp /home/mgorny/git/llvm-project/build/./lib/libomptarget.devicertl.a
# .---command stderr------------
# | ld.lld: error: undefined symbol: __kmpc_target_init
# | >>> referenced by /tmp/lit-tmp-wxf1utdf/assert.c.tmp.amdgcn.gfx1012-0994c1.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
# | >>> referenced by /tmp/lit-tmp-wxf1utdf/assert.c.tmp.amdgcn.gfx1012-0994c1.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
# | 
# | ld.lld: error: undefined symbol: __kmpc_target_deinit
# | >>> referenced by /tmp/lit-tmp-wxf1utdf/assert.c.tmp.amdgcn.gfx1012-0994c1.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
# | >>> referenced by /tmp/lit-tmp-wxf1utdf/assert.c.tmp.amdgcn.gfx1012-0994c1.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
# | 
# | ld.lld: error: undefined symbol: __assert_fail
# | >>> referenced by /tmp/lit-tmp-wxf1utdf/assert.c.tmp.amdgcn.gfx1012-0994c1.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
# | >>> referenced by /tmp/lit-tmp-wxf1utdf/assert.c.tmp.amdgcn.gfx1012-0994c1.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
# | clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)
# | /home/mgorny/git/llvm-project/build/bin/clang-linker-wrapper: error: 'clang' failed
# | clang: error: linker command failed with exit code 1 (use -v to see invocation)
# `-----------------------------
# error: command failed with exit status: 1

--

A quick attempt at debugging suggests clang-linker-wrapper is not passing any libraries when linking:

$ /home/mgorny/git/llvm-project/build/./bin/clang -fopenmp -I /home/mgorny/git/llvm-project/offload/test -I /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -L /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -L /home/mgorny/git/llvm-project/build/./lib -L /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/mgorny/git/llvm-project/build/./lib -fopenmp-targets=amdgcn-amd-amdhsa /home/mgorny/git/llvm-project/offload/test/api/assert.c -o /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp /home/mgorny/git/llvm-project/build/./lib/libomptarget.devicertl.a -v
clang version 20.0.0git ([email protected]:llvm/llvm-project.git 4ad8b2640eaa732da1a4c2429bcac26df3fe943f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/mgorny/git/llvm-project/build/bin
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/14
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/home/mgorny/git/llvm-project/build/bin/clang-20" -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -emit-llvm-uselists -dumpdir /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name assert.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/mgorny/git/llvm-project/build -v -fcoverage-compilation-dir=/home/mgorny/git/llvm-project/build -resource-dir /home/mgorny/git/llvm-project/build/lib/clang/20 -I /home/mgorny/git/llvm-project/offload/test -I /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include/llvm_libc_wrappers -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fopenmp -nogpulib -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -disable-llvm-passes -fopenmp-targets=amdgcn-amd-amdhsa -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/assert-95f5c4.bc -x c /home/mgorny/git/llvm-project/offload/test/api/assert.c
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/home/mgorny/git/llvm-project/build/lib/clang/20/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/mgorny/git/llvm-project/offload/test
 /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src
 /home/mgorny/git/llvm-project/build/lib/clang/20/include/llvm_libc_wrappers
 /home/mgorny/git/llvm-project/build/lib/clang/20/include
 /usr/local/include
 /usr/include
End of search list.
 "/home/mgorny/git/llvm-project/build/bin/clang-20" -cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -Werror=atomic-alignment -emit-llvm-bc -emit-llvm-uselists -dumpdir /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name assert.c -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu gfx1012 -debugger-tuning=gdb -fdebug-compilation-dir=/home/mgorny/git/llvm-project/build -v -resource-dir /home/mgorny/git/llvm-project/build/lib/clang/20 -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include/openmp_wrappers -include __clang_openmp_device_functions.h -I /home/mgorny/git/llvm-project/offload/test -I /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include/llvm_libc_wrappers -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /home/mgorny/git/llvm-project/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fvisibility=protected -fopenmp -nogpulib -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -fopenmp-is-target-device -fopenmp-host-ir-file-path /tmp/assert-95f5c4.bc -faddrsig -o /tmp/assert-ea06cf.bc -x c /home/mgorny/git/llvm-project/offload/test/api/assert.c
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/home/mgorny/git/llvm-project/build/lib/clang/20/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/home/mgorny/git/llvm-project/build/lib/clang/20/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/mgorny/git/llvm-project/offload/test
 /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src
 /home/mgorny/git/llvm-project/build/lib/clang/20/include/openmp_wrappers
 /home/mgorny/git/llvm-project/build/lib/clang/20/include/llvm_libc_wrappers
 /home/mgorny/git/llvm-project/build/lib/clang/20/include
 /usr/local/include
 /usr/include
End of search list.
 "/home/mgorny/git/llvm-project/build/bin/clang-offload-packager" -o /tmp/assert-0f1543.out --image=file=/tmp/assert-ea06cf.bc,triple=amdgcn-amd-amdhsa,arch=gfx1012,kind=openmp
 "/home/mgorny/git/llvm-project/build/bin/clang-20" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name assert.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/mgorny/git/llvm-project/build -v -fcoverage-compilation-dir=/home/mgorny/git/llvm-project/build -resource-dir /home/mgorny/git/llvm-project/build/lib/clang/20 -ferror-limit 19 -fopenmp -nogpulib -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -fembed-offload-object=/tmp/assert-0f1543.out -fopenmp-targets=amdgcn-amd-amdhsa -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/assert-75251f.o -x ir /tmp/assert-95f5c4.bc
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target x86_64-unknown-linux-gnu
 "/home/mgorny/git/llvm-project/build/bin/clang-linker-wrapper" --host-triple=x86_64-unknown-linux-gnu --wrapper-verbose --linker-path=/home/mgorny/git/llvm-project/build/bin/ld.lld --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -pie -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/api/Output/assert.c.tmp /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtbeginS.o -L/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -L/home/mgorny/git/llvm-project/build/./lib -L/home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -L/usr/lib/gcc/x86_64-pc-linux-gnu/14 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/lib -L/lib -L/usr/lib -rpath /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/offload -rpath /home/mgorny/git/llvm-project/build/runtimes/runtimes-bins/openmp/runtime/src -rpath /home/mgorny/git/llvm-project/build/./lib /tmp/assert-75251f.o /home/mgorny/git/llvm-project/build/./lib/libomptarget.devicertl.a -lomp -lomptarget -L/home/mgorny/git/llvm-project/build/lib -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/14/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/crtn.o -verbose
 "/home/mgorny/git/llvm-project/build/bin/clang" --no-default-config -o /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img --target=amdgcn-amd-amdhsa -mcpu=gfx1012 -O2 -flto -Wl,--no-undefined /tmp/assert-75251f-amdgcn-amd-amdhsa-gfx1012-8c8d61.o -v
clang version 20.0.0git ([email protected]:llvm/llvm-project.git 4ad8b2640eaa732da1a4c2429bcac26df3fe943f)
Target: amdgcn-amd-amdhsa
Thread model: posix
InstalledDir: /home/mgorny/git/llvm-project/build/bin
 "/home/mgorny/git/llvm-project/build/bin/ld.lld" --no-undefined -shared --no-undefined /tmp/assert-75251f-amdgcn-amd-amdhsa-gfx1012-8c8d61.o -plugin-opt=mcpu=gfx1012 -plugin-opt=O2 --lto-CGO2 -o /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img
ld.lld: error: undefined symbol: __kmpc_target_init
>>> referenced by /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
>>> referenced by /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)

ld.lld: error: undefined symbol: __kmpc_target_deinit
>>> referenced by /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
>>> referenced by /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)

ld.lld: error: undefined symbol: __assert_fail
>>> referenced by /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
>>> referenced by /tmp/assert.c.tmp.amdgcn.gfx1012-3a6ddc.img.lto.o:(__omp_offloading_31_4bb9d7e_main_l9)
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)
/home/mgorny/git/llvm-project/build/bin/clang-linker-wrapper: error: 'clang' failed
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Full build and test log (6.5M after unpacking): log.txt.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    cmakeBuild system in general and CMake in particularoffload

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions