The clang-offload-packager. nvptx-arch, and amdgpu-arch tools are
required for building the GPU target of libc. This patch ensures that
we build this tool when directly building libc via ninja libc or similar.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/runtimes/CMakeLists.txt | ||
---|---|---|
403 | 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. |
llvm/runtimes/CMakeLists.txt | ||
---|---|---|
403 | 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. |
llvm/runtimes/CMakeLists.txt | ||
---|---|---|
403 | 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. |
llvm/runtimes/CMakeLists.txt | ||
---|---|---|
403 | So right now it just dlopens if it's not found on the machine. Honestly it probably would be best if we just always dlopened it since it would guarantee any build configuration would work somewhat. Honestly the only reason I haven't done that is because linking it directly makes it easier to use within an IDE since it has access to the header files. |
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.