-
Notifications
You must be signed in to change notification settings - Fork 580
Improve the env/cmake variable situation #2224
Description
If you install rocm with non-standard prefixes using spack, which is currently by far the easiest way to compile the rocm ecosystem from sources, you have to configure an overwhelming number of environment variables, and not all of them even make sense.
To make hipcc work, the following variables have to be set:
HIP_PATH
ROCM_PATH
HIP_LIB_PATH
HIP_CLANG_PATH
DEVICE_LIB_PATH
HSA_PATH
where ROCM_PATH is useless, since in spack installations there is no flat $ROCM_PATH/bin, $ROCM_PATH/lib, $ROCM_PATH/llvm folders.
Then, to make clang happy, you have to define:
HIP_DEVICE_LIB_PATH
And to make comgr happy, you have to define:
LLVM_PATH
ROCM_PATH (again... same issues)
HIP_PATH
and if you want to actually use the hip::host target in cmake when using GCC, you also have to inform it where hip/clang is installed again... Since https://github.com/ROCm-Developer-Tools/HIP/blob/main/hip-config.cmake.in#L68 is not working because ${ROCM_PATH}/llvm does not exist, you got to define
-DHIP_CXX_COMPILER=[install prefix of HIP]
Most of these issues can simply be resolved by just making cmake locate all dependencies, then generate a file with all these paths hard-coded which serve as default search paths when running hipcc on the command line or find_package(hip) in a dependent package. And make sure the user can still override them with env variables if necessary.
Of course this does not entirely solve the problem for comgr / llvm, since rocm-device-libs depends on llvm, so llvm can't know about HIP_DEVICE_LIB_PATH, and similarly comgr cannot know about HIP_PATH.