summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-09 11:53:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-09 11:53:32 (GMT)
commit7aad9e8685b0231abfb11d0f7d8c613cf5364fef (patch)
tree2d2b547cbc6708936c98ae52c0f181d78fb0652d /Help
parentb6faa5e2df22fecac877dc866294e8b5a36ab03a (diff)
parent8514ee9b315b4ad02eed0e3cf11d8579f307fac0 (diff)
downloadCMake-7aad9e8685b0231abfb11d0f7d8c613cf5364fef.zip
CMake-7aad9e8685b0231abfb11d0f7d8c613cf5364fef.tar.gz
CMake-7aad9e8685b0231abfb11d0f7d8c613cf5364fef.tar.bz2
Merge topic 'add_hip_language'
8514ee9b31 HIP: analyze output of `hipcc` to determine default GPU architecture 20d086f1a2 HIP: All HIP tests now run on CMake's current AMD hardware 2e86e50c2f HIP: Add HIP to all the Check* modules 947dbed0aa HIP: Automatically inject the `hip::device` runtime target b50bfc8913 HIP: Add language to CMake ff0d2858e1 HIP: Extract clang compiler details from hipcc bd844387df ROCMClang: Add the ROCm toolkit derived clang compiler to CMake 590553f322 Compilers: protect use of __has_include ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Zack Galbreath <zack.galbreath@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Acked-by: Axel Huebl <axel.huebl@plasma.ninja> Merge-request: !6121
Diffstat (limited to 'Help')
-rw-r--r--Help/command/enable_language.rst5
-rw-r--r--Help/command/project.rst2
-rw-r--r--Help/envvar/HIPCXX.rst13
-rw-r--r--Help/envvar/HIPFLAGS.rst15
-rw-r--r--Help/manual/cmake-env-variables.7.rst2
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst22
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_sf/LANGUAGE.rst4
-rw-r--r--Help/prop_tgt/HIP_ARCHITECTURES.rst27
-rw-r--r--Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst2
-rw-r--r--Help/release/dev/hip.rst5
-rw-r--r--Help/variable/CMAKE_HIP_ARCHITECTURES.rst11
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst2
15 files changed, 107 insertions, 6 deletions
diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst
index ce765de..d2acbc8 100644
--- a/Help/command/enable_language.rst
+++ b/Help/command/enable_language.rst
@@ -10,7 +10,7 @@ Enables support for the named language in CMake. This is
the same as the :command:`project` command but does not create any of the extra
variables that are created by the project command. Example languages
are ``CXX``, ``C``, ``CUDA``, ``OBJC``, ``OBJCXX``, ``Fortran``,
-``ISPC``, and ``ASM``.
+``HIP``, ``ISPC``, and ``ASM``.
.. versionadded:: 3.8
Added ``CUDA`` support.
@@ -21,6 +21,9 @@ are ``CXX``, ``C``, ``CUDA``, ``OBJC``, ``OBJCXX``, ``Fortran``,
.. versionadded:: 3.18
Added ``ISPC`` support.
+.. versionadded:: 3.21
+ Added ``HIP`` support.
+
If enabling ``ASM``, enable it last so that CMake can check whether
compilers for other languages like ``C`` work for assembly too.
diff --git a/Help/command/project.rst b/Help/command/project.rst
index 8a6bc1e..2a9dcfe 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -103,7 +103,7 @@ The options are:
Selects which programming languages are needed to build the project.
Supported languages include ``C``, ``CXX`` (i.e. C++), ``CUDA``,
- ``OBJC`` (i.e. Objective-C), ``OBJCXX``, ``Fortran``, ``ISPC``, and ``ASM``.
+ ``OBJC`` (i.e. Objective-C), ``OBJCXX``, ``Fortran``, ``HIP``, ``ISPC``, and ``ASM``.
By default ``C`` and ``CXX`` are enabled if no language options are given.
Specify language ``NONE``, or use the ``LANGUAGES`` keyword and list no languages,
to skip enabling any languages.
diff --git a/Help/envvar/HIPCXX.rst b/Help/envvar/HIPCXX.rst
new file mode 100644
index 0000000..23329e9
--- /dev/null
+++ b/Help/envvar/HIPCXX.rst
@@ -0,0 +1,13 @@
+HIPCXX
+------
+
+.. versionadded:: 3.21
+
+.. include:: ENV_VAR.txt
+
+Preferred executable for compiling ``HIP`` language files. Will only be used by
+CMake on the first configuration to determine ``HIP`` compiler, after which the
+value for ``HIP`` is stored in the cache as
+:variable:`CMAKE_HIP_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_HIP_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
diff --git a/Help/envvar/HIPFLAGS.rst b/Help/envvar/HIPFLAGS.rst
new file mode 100644
index 0000000..0df3416
--- /dev/null
+++ b/Help/envvar/HIPFLAGS.rst
@@ -0,0 +1,15 @@
+HIPFLAGS
+--------
+
+.. versionadded:: 3.21
+
+.. include:: ENV_VAR.txt
+
+Default compilation flags to be used when compiling ``HIP`` files. Will only be
+used by CMake on the first configuration to determine ``HIP`` default
+compilation flags, after which the value for ``HIPFLAGS`` is stored in the
+cache as :variable:`CMAKE_HIP_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
+run (including the first), the environment variable will be ignored if
+the :variable:`CMAKE_HIP_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_HIP_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index bfdc841..fa38588 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -67,6 +67,8 @@ Environment Variables for Languages
/envvar/CXXFLAGS
/envvar/FC
/envvar/FFLAGS
+ /envvar/HIPCXX
+ /envvar/HIPFLAGS
/envvar/ISPC
/envvar/ISPCFLAGS
/envvar/OBJC
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 0ba41c8..05b7bc0 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -181,6 +181,13 @@ Variable Queries
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+.. genex:: $<HIP_COMPILER_ID:compiler_ids>
+
+ where ``compiler_ids`` is a comma-separated list.
+ ``1`` if the CMake's compiler id of the HIP compiler matches any one
+ of the entries in ``compiler_ids``, otherwise ``0``.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+
.. genex:: $<ISPC_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list.
@@ -218,6 +225,11 @@ Variable Queries
``1`` if the version of the Fortran compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+.. genex:: $<HIP_COMPILER_VERSION:version>
+
+ ``1`` if the version of the HIP compiler matches ``version``, otherwise ``0``.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+
.. genex:: $<ISPC_COMPILER_VERSION:version>
``1`` if the version of the ISPC compiler matches ``version``, otherwise ``0``.
@@ -648,6 +660,11 @@ Variable Queries
The CMake's compiler id of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+.. genex:: $<HIP_COMPILER_ID>
+
+ The CMake's compiler id of the HIP compiler used.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+
.. genex:: $<ISPC_COMPILER_ID>
The CMake's compiler id of the ISPC compiler used.
@@ -683,6 +700,11 @@ Variable Queries
The version of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+.. genex:: $<HIP_COMPILER_VERSION>
+
+ The version of the HIP compiler used.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+
.. genex:: $<ISPC_COMPILER_VERSION>
The version of the ISPC compiler used.
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 0a3e36b..2db1ec2 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -212,6 +212,7 @@ Properties on Targets
/prop_tgt/GHS_NO_SOURCE_GROUP_FILE
/prop_tgt/GNUtoMS
/prop_tgt/HAS_CXX
+ /prop_tgt/HIP_ARCHITECTURES
/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
/prop_tgt/IMPORTED
/prop_tgt/IMPORTED_COMMON_LANGUAGE_RUNTIME
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 873bd89..39fbbed 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -523,6 +523,7 @@ Variables for Languages
/variable/CMAKE_Fortran_MODDIR_DEFAULT
/variable/CMAKE_Fortran_MODDIR_FLAG
/variable/CMAKE_Fortran_MODOUT_FLAG
+ /variable/CMAKE_HIP_ARCHITECTURES
/variable/CMAKE_ISPC_HEADER_DIRECTORY
/variable/CMAKE_ISPC_HEADER_SUFFIX
/variable/CMAKE_ISPC_INSTRUCTION_SETS
diff --git a/Help/prop_sf/LANGUAGE.rst b/Help/prop_sf/LANGUAGE.rst
index f14c176..a9b5638 100644
--- a/Help/prop_sf/LANGUAGE.rst
+++ b/Help/prop_sf/LANGUAGE.rst
@@ -6,8 +6,8 @@ Specify the programming language in which a source file is written.
A property that can be set to indicate what programming language the
source file is. If it is not set the language is determined based on
the file extension. Typical values are ``CXX`` (i.e. C++), ``C``,
-``CSharp``, ``CUDA``, ``Fortran``, ``ISPC``, and ``ASM``. Setting this
-property for a file means this file will be compiled. Do not set this
+``CSharp``, ``CUDA``, ``Fortran``, ``HIP``, ``ISPC``, and ``ASM``. Setting
+this property for a file means this file will be compiled. Do not set this
for headers or files that should not be compiled.
.. versionchanged:: 3.20
diff --git a/Help/prop_tgt/HIP_ARCHITECTURES.rst b/Help/prop_tgt/HIP_ARCHITECTURES.rst
new file mode 100644
index 0000000..06f956b
--- /dev/null
+++ b/Help/prop_tgt/HIP_ARCHITECTURES.rst
@@ -0,0 +1,27 @@
+HIP_ARCHITECTURES
+-----------------
+
+.. versionadded:: 3.21
+
+List of AMD GPU architectures to generate device code for.
+
+A non-empty false value (e.g. ``OFF``) disables adding architectures.
+This is intended to support packagers and rare cases where full control
+over the passed flags is required.
+
+This property is initialized by the value of the :variable:`CMAKE_HIP_ARCHITECTURES`
+variable if it is set when a target is created.
+
+The HIP compilation model has two modes: whole and separable. Whole compilation
+generates device code at compile time. Separable compilation generates device
+code at link time. Therefore the ``HIP_ARCHITECTURES`` target property should
+be set on targets that compile or link with any HIP sources.
+
+Examples
+^^^^^^^^
+
+.. code-block:: cmake
+
+ set_property(TARGET tgt PROPERTY HIP_ARCHITECTURES gfx801 gfx900)
+
+Generates code for both ``gfx801`` and ``gfx900``.
diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
index 16be3cd..cba8ac9 100644
--- a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
+++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
@@ -4,7 +4,7 @@
.. versionadded:: 3.4
This property is implemented only when ``<LANG>`` is ``C``, ``CXX``,
-``Fortran``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
+``Fortran``, ``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command line
for a compiler launching tool. The :ref:`Makefile Generators` and the
diff --git a/Help/release/dev/hip.rst b/Help/release/dev/hip.rst
new file mode 100644
index 0000000..abf9a35
--- /dev/null
+++ b/Help/release/dev/hip.rst
@@ -0,0 +1,5 @@
+hip
+---
+
+* CMake learned to support ``HIP`` as a first-class language that can be
+ enabled via the :command:`project` and :command:`enable_language` commands.
diff --git a/Help/variable/CMAKE_HIP_ARCHITECTURES.rst b/Help/variable/CMAKE_HIP_ARCHITECTURES.rst
new file mode 100644
index 0000000..0cf0201
--- /dev/null
+++ b/Help/variable/CMAKE_HIP_ARCHITECTURES.rst
@@ -0,0 +1,11 @@
+CMAKE_HIP_ARCHITECTURES
+-----------------------
+
+.. versionadded:: 3.21
+
+Default value for :prop_tgt:`HIP_ARCHITECTURES` property of targets.
+
+This is initialized to the default architecture 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.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index 0abedde..f23b7a2 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -34,6 +34,7 @@ include:
OpenWatcom = Open Watcom (openwatcom.org)
PGI = The Portland Group (pgroup.com)
PathScale = PathScale (pathscale.com)
+ ROCMClang = ROCm Toolkit Clang-based Compiler (rocmdocs.amd.com)
SDCC = Small Device C Compiler (sdcc.sourceforge.net)
SunPro = Oracle Solaris Studio (oracle.com)
TI = Texas Instruments (ti.com)
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
index 89fd7bc..f16e594 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
@@ -6,7 +6,7 @@ CMAKE_<LANG>_COMPILER_LAUNCHER
Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property.
This variable is used to initialize the property on each target as it is
created. This is done only when ``<LANG>`` is ``C``, ``CXX``, ``Fortran``,
-``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
+``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
This variable is initialized to the :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER`
environment variable if it is set.