[PATCH] D147581: [libc] Ensure that the required clang tools are up-to-date for libc GPU

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 17:09:54 PDT 2023


tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/runtimes/CMakeLists.txt:403
+    if(LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
+      list(APPEND extra_deps clang-offload-packager nvptx-arch amdgpu-arch)
+    endif()
----------------
jhuber6 wrote:
> tra wrote:
> > Do these tools depend on something that may not be present on a build machine w/o GPU?  
> > 
> > I think `nvptx-arch` currently links with libcuda.so, which means that it will not build on machine w/o a NVIDIA GPU.  Ideally the app needs to dlopen(libcuda.so.1) and gracefully fail if it's not found.
> > 
> > 
> > I think the dependency on nvptx-arch tools may need to be conditional on whether its build prerequisites are found.
> Yes, `nvptx-arch` will attempt to dynamically open CUDA if it wasn't found beforehand. Otherwise they just depend on `ClangBasic` and other LLVM libraries that should be supported.
If we already can dlopen it, then we should always do it. Linking with it explicitly just makes the binary unusable on machines w/o GPUs. E.g. you can just pack and ship it with the release build of clang. That a matter for a separate patch though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147581/new/

https://reviews.llvm.org/D147581



More information about the llvm-commits mailing list