- Add support for finding device libraries in new ROCm directory
structure
- Simplify and remove the handling of legacy ROCm directory structure
Change-Id: I04da3bc9da85ced4b56b0225efb6b94448b8c5a1
Differential D140315
[AMDGCN] Update search path for device libraries scchan on Dec 19 2022, 9:27 AM. Authored by
Details
structure
Change-Id: I04da3bc9da85ced4b56b0225efb6b94448b8c5a1
Diff Detail
Event TimelineComment Actions files under clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode-no-abi-ver seem not used. Comment Actions I'm sorry for reporting it this late (clang's been broken for over two weeks, so we couldn't periodically test it) but this change is causing test regressions on Gentoo/amd64: FAIL: Clang :: Driver/hip-device-libs.hip (9304 of 17486) ******************** TEST 'Clang :: Driver/hip-device-libs.hip' FAILED ******************** [...] + : 'RUN: at line 92' + /var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/bin/clang -### --target=x86_64-linux-gnu --offload-arch=gfx803 -nogpuinc -resource-dir=/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir /var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/hip_multiple_inputs/b.hip + /usr/lib/llvm/16/bin/FileCheck /var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/hip-device-libs.hip --check-prefixes=ALL,FLUSHD,RESDIR /var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/hip-device-libs.hip:203:13: error: ALL-NOT: excluded string found in input // ALL-NOT: error: ^ <stdin>:5:11: note: found here clang-16: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library ^~~~~~ Input file: <stdin> Check file: /var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/hip-device-libs.hip -dump-input=help explains the following input dump. Input was: <<<<<< 1: clang version 16.0.0 2: Target: x86_64-unknown-linux-gnu 3: Thread model: posix 4: InstalledDir: /var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/bin 5: clang-16: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library not:203 !~~~~~ error: no match expected 6: "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/bin/clang-16" "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "b.hip" "-mrelocation-model" "pic" "-pic-level" "1" "-fhalf-no-semantic-interposition" "-mframe-pointer=all" "-fdenormal-fp-math-f32=preserve-sign,preserve-sign" "-fno-rounding-math" "-mconstructor-aliases" "-aux-target-cpu" "x86-64" "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols" "-fcuda-allow-variadic-functions" "-fvisibility=hidden" "-fapply-global-visibility-to-externs" "-target-cpu" "gfx803" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-resource-dir" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir" "-internal-isystem" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/backward" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/backward" "-internal-isystem" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fno-autolink" "-fdebug-compilation-dir=/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/test/Driver" "-ferror-limit" "19" "-fhip-new-launch-api" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-cuid=baca1261ad77b3c1" "-fcuda-allow-variadic-functions" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-aed965/b-gfx803.o" "-x" "hip" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/hip_multiple_inputs/b.hip" 7: "/usr/lib/llvm/16/bin/lld" "-flavor" "gnu" "-m" "elf64_amdgpu" "--no-undefined" "-shared" "-plugin-opt=-amdgpu-internalize-symbols" "-plugin-opt=mcpu=gfx803" "-o" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-8854b0/b-gfx803.out" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-aed965/b-gfx803.o" 8: "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/bin/clang-offload-bundler" "-type=o" "-bundle-align=4096" "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx803" "-input=/dev/null" "-input=/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-8854b0/b-gfx803.out" "-output=/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-54bd59.hipfb" 9: "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/bin/clang-16" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-aux-triple" "amdgcn-amd-amdhsa" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "b.hip" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/test/Driver" "-resource-dir" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir" "-internal-isystem" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/backward" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/backward" "-internal-isystem" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/rocm_resource_dir/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir=/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/x/y/clang-abi_x86_64.amd64/test/Driver" "-ferror-limit" "19" "-fhip-new-launch-api" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-fcuda-include-gpubinary" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-54bd59.hipfb" "-cuid=baca1261ad77b3c1" "-fcuda-allow-variadic-functions" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-af8098.o" "-x" "hip" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/work/clang/test/Driver/Inputs/hip_multiple_inputs/b.hip" 10: "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld" "-pie" "--hash-style=gnu" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "a.out" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/Scrt1.o" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/crti.o" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/crtbeginS.o" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/12" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64" "-L/lib/../lib64" "-L/usr/lib/../lib64" "-L/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/lib" "-L/lib" "-L/usr/lib" "/var/tmp/portage/sys-devel/clang-16.0.0_pre20230124/temp/b-af8098.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/crtendS.o" "/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/crtn.o" >>>>>> -- ******************** After reverting this commit locally, all tests pass. Full build log (15M uncompressed): Comment Actions @scchan the test expects CLANG_INSTALL_LIBDIR_BASENAME to be lib. Maybe in the failed test it was not true.
Comment Actions I don't think it's actually the test that was at fault, it doesn't look right that this diff uses CLANG_INSTALL_LIBDIR_BASENAME for an unrelated purpose to determining the basename of the libdir, especially considering the comments continue to say clang looks in lib/amdgcn/bitcode rather than <LIBDIR>/amdgcn/bitcode, and your original test specifically assumed that it would always be lib. Should the code perhaps just be updated to hardcode "lib" as it did before? Either way, the test can still fail after D142506, CLANG_INSTALL_LIBDIR_BASENAME may be any arbitrary string and cannot be assumed to be either lib or lib64. With Debian-style multiarch I have CLANG_INSTALL_LIBDIR_BASENAME=lib/x86_64-linux-gnu, so after updating from Clang 15 to Clang 16 I am now also seeing this test fail. |
this might be fixed by (lib|lib64)