[mlir] Use hip's config mode to find libraries
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Tue, 27 Sep 2022 15:41:09 +0000 (15:41 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Wed, 28 Sep 2022 14:36:09 +0000 (14:36 +0000)
commitae1f707366f74e5271afb01b502ae690656fa9f9
treece265a9b909a2f669c252fc3ba9c736345d508b4
parenteba84971aeefd697f0c0afb96e1c2772745992d9
[mlir] Use hip's config mode to find libraries

Instead of using find_package(HIP) to find FindHIP.cmake, which
doesn't seem to be the preferred way to find HIP anymore, use
find_package(hip CONFIG) to find the HIP configuration. Give
preference to ${ROCM_PATH} over ${ROCM_PATH}/hip in order to handle
the fact that newer ROCm versions prefer the include path to use
${ROCM_PATH}/include/hip over ${ROCM_PATH}/hip/innclude/hip (the
latter throws up a bunch of deprecation warnings)

Then, instead of trying to manually find the host-side headers and
runtime library by hand, use the hip::host and hip::amdhip64 libraries
that the config module defines.

This makes the CMake config much less error-prone and brings it in
line with the recommended approach to finding HIP.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D134753
mlir/lib/ExecutionEngine/CMakeLists.txt