HIP: Add CMAKE_HIP_PLATFORM variable to specify GPU platform

For now, require the value to be `amd`, since that is the only
platform we currently support.
This commit is contained in:
Brad King
2023-09-18 14:11:41 -04:00
parent 90e23f40ee
commit 127b6fa06b
10 changed files with 70 additions and 15 deletions
+1
View File
@@ -590,6 +590,7 @@ Variables for Languages
/variable/CMAKE_Fortran_MODOUT_FLAG
/variable/CMAKE_HIP_ARCHITECTURES
/variable/CMAKE_HIP_EXTENSIONS
/variable/CMAKE_HIP_PLATFORM
/variable/CMAKE_HIP_STANDARD
/variable/CMAKE_HIP_STANDARD_REQUIRED
/variable/CMAKE_ISPC_HEADER_DIRECTORY
+2 -1
View File
@@ -3,7 +3,8 @@ HIP_ARCHITECTURES
.. versionadded:: 3.21
List of AMD GPU architectures to generate device code for.
List of GPU architectures to for which to generate device code.
Architecture names are interpreted based on :variable:`CMAKE_HIP_PLATFORM`.
A non-empty false value (e.g. ``OFF``) disables adding architectures.
This is intended to support packagers and rare cases where full control
+6
View File
@@ -0,0 +1,6 @@
hip-nvidia
----------
* The :variable:`CMAKE_HIP_PLATFORM` variable was added to specify
the GPU platform for which HIP language sources are to be compiled
(``amd``).
+7 -3
View File
@@ -3,10 +3,14 @@ CMAKE_HIP_ARCHITECTURES
.. versionadded:: 3.21
Default value for :prop_tgt:`HIP_ARCHITECTURES` property of targets.
List of GPU architectures to for which to generate device code.
Architecture names are interpreted based on :variable:`CMAKE_HIP_PLATFORM`.
This is initialized to the architectures reported by ``rocm_agent_enumerator``,
if available, and otherwise to the default chosen by the compiler.
This is initialized based on the value of :variable:`CMAKE_HIP_PLATFORM`:
``amd``
Uses architectures reported by ``rocm_agent_enumerator``, if available,
and otherwise to a default chosen by the compiler.
This variable is used to initialize the :prop_tgt:`HIP_ARCHITECTURES` property
on all targets. See the target property for additional information.
+19
View File
@@ -0,0 +1,19 @@
CMAKE_HIP_PLATFORM
------------------
.. versionadded:: 3.28
GPU platform for which HIP language sources are to be compiled.
The value must be one of:
``amd``
AMD GPUs
If not specified, the default is ``amd``.
:variable:`CMAKE_HIP_ARCHITECTURES` entries are interpreted with
as architectures of the GPU platform.
:variable:`CMAKE_HIP_COMPILER <CMAKE_<LANG>_COMPILER>` must target
the same GPU platform.