- In the install script, determine the build platform by querying
hipconfig --platform
- This is necessary, as the install script needs to know the build platform so it can to choose what dependencies to install.
hipconfig --platform
determines the platform by reading the contents of the .hipInfo file installed as part of the hip runtime.- If the platform is autodetected incorrectly, it can be be set explicitly via an environment
variable, e.g.,
export HIP_PLATFORM=amd
orexport HIP_PLATFORM=nvidia
.
- In CMake,
find_package(hip REQUIRED)
will be used for both the AMD and NVIDIA platforms.- There will be no need for a different find_package call on each platform; the same call will be used for both platforms.
find_package(hip)
will setHIP_PLATFORM
so the rest of the build rules can branch onif(HIP_PLATFORM STREQUAL amd)
orif(HIP_PLATFORM STREQUAL nvidia)
.find_package(hip)
will create the imported interface targethip::host
, which will have all necessary defines, dependencies and include paths for using the HIP library with a normal C or C++ compiler. For example, anything linked withhip::host
will be passed-D__HIP_PLATFORM_AMD__
whenHIP_PLATFORM=amd
and-D__HIP_PLATFORM_NVIDIA__
whenHIP_PLATFORM=nvidia
.
find_package(hip)
will be implemented incmake/Findhip.cmake
. This file will be copied into each project that needs to support the NVIDIA platform.- Findhip.cmake will use
hipconfig --platform
to set theHIP_PLATFORM
CMake variable. This behaviour will be copied directly from FindHIP.cmake. - On the AMD platform, Findhip.cmake will be a thin wrapper around hip-config.cmake
- On the NVIDIA platform, Findhip.cmake will find the HIP include directories and
create the
hip::host
target. - Once hip-config.cmake defines
HIP_PLATFORM
and addship::host
to the NVIDIA platform, Findhip.cmake can be deleted. It's just a compatibility shim to add features that have not been implemented in HIP yet. Once they are implemented, the shim can be removed without any further changes required to the libraries.
- Findhip.cmake will use
Last active
November 21, 2022 15:01
-
-
Save cgmb/ff73a25935024c5657744387ba74e0a5 to your computer and use it in GitHub Desktop.
HIP platform selection
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, valid values are as follows:
Does it make sense to consider an extension: