yaxunl added a comment. In D97340#2778073 <https://reviews.llvm.org/D97340#2778073>, @haampie wrote:
> Hi Yaxunl, > >> The patch should not cause circular dependency on HIP or device library. > > I'm not saying this patch introduces a circular dependency, I'm saying you > are trying to solve an already existing circular dependency (clang needs > device libs at runtime, but device libs need llvm to compile). > > Let's talk about my PR here: https://github.com/spack/spack/pull/23859. It's > building rocm-device-libs as part of llvm-amdgpu by configuring llvm with > `-DLLVM_EXTERNAL_PROJECTS=device-libs`. > > If you checkout that pr, run `spack install hip@4.2.0`, what you get is get > is: > > $ spack find -p llvm-amdgpu@4.2.0 > llvm-amdgpu@4.2.0 > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi > > And indeed the bitcode is there: > > $ find > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi > -iname '*.bc' > > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/amdgcn/bitcode/oclc_isa_version_1033.bc > > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/amdgcn/bitcode/ocml.bc > > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/amdgcn/bitcode/hip.bc > ... > > Now when I used this `--print-rocm-search-dirs` flag on clang without other > flags, what I see is: > > $ > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/bin/clang++ > --print-rocm-search-dirs -x hip hi.cc > ROCm installation search path (Spack 4.2.0): > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0 > ROCm installation search path: > /spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-amdgpu-4.2.0-a7jwajhh2cmn7p5djyx42lpcdfluk7wi/lib/clang/12.0.0 > ROCm installation search path: /opt/rocm > ... > clang-12: 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. > > Now can you make it such that clang will search the llvm prefix itself? Yes I can make clang to search that path for device libs. I will open a review for that and remove the old detection of device libs for spack. I still think auto detection of HIP path is a desirable feature, especially for interactive use of clang in a shell. This also allows clang to maintain certain level of backward compatibility with old HIP runtime by detecting HIP version. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97340/new/ https://reviews.llvm.org/D97340 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits