Skip to content

[LLVM] tools/llvm-gpu-loader introduces silent automagic dependencies on HSA and CUDA runtimes #132890

Open
@mgorny

Description

@mgorny

#132096 introduced new llvm-gpu-loader tool that can link to HSA and CUDA runtimes.

Both checks were added deep down the source tree, in tools/llvm-gpu-loader/CMakeLists.txt:

find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)

find_package(CUDAToolkit 11.2 QUIET)

Neither of them features a proper option() to control the dependency, and on top of that, they are both marked QUIET, so it's really easy to overlook this (as we did), and end up building packages that randomly depend on either of the runtimes, or miss the specific function.

Please:

  1. Do not use QUIET for package checks that control features included in installed tools.
  2. Do not add dependency checks deep down the source tree — LLVM has a bunch of standard locations such as top CMakeLists.txt and cmake/config-ix.cmake, where people actually look for changes like these. We don't really have the resources to monitor all 528 CMakeLists.txt files in LLVM alone.
  3. Add option()s to control enabling the specific dependencies, so that we can cleanly control whether they are enabled or not, rather than being automatically linked if the build system incidentally happens to have them installed.

Metadata

Metadata

Assignees

Labels

cmakeBuild system in general and CMake in particularllvmUmbrella label for LLVM issues

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions