]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp.texi: For HIP interop, mention cpp defines to set
authorTobias Burnus <tburnus@baylibre.com>
Thu, 17 Apr 2025 08:21:05 +0000 (10:21 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Thu, 17 Apr 2025 08:21:05 +0000 (10:21 +0200)
The HIP header files recognize the used compiler, defaulting to either AMD
or Nvidia/CUDA; thus, the alternative way of explicitly defining a macro is
less prominently documented. With GCC, the user has to define the
preprocessor macro manually. Hence, as a service to the user, mention
__HIP_PLATFORM_AMD__ and __HIP_PLATFORM_NVIDIA__ in the interop documentation,
even though it has only indirectly to do with GCC and its interop support.

Note to commit-log readers, only: For Fortran, the hipfort modules can be
used; when compiling the hipfort package (defaults to use gfortran), it
generates the module (*.mod) files in include/hipfort/{amdgcn,nvidia}/ such
that the choice is made by setting the respective include path.

libgomp/ChangeLog:

* libgomp.texi (gcn interop, nvptx interop): For HIP with C/C++, add
a note about setting a preprocessor define.

libgomp/libgomp.texi

index dfd189b646e815e470a1ffc804eaa1229f8caf50..6909c2b16f881d728cdf6e2fab1aa0ef76c7f18d 100644 (file)
@@ -6945,6 +6945,9 @@ or string (str) data type, call @code{omp_get_interop_int},
 Note that @code{device_num} is the OpenMP device number
 while @code{device} is the HIP device number or HSA device handle.
 
+When using HIP with C and C++, the @code{__HIP_PLATFORM_AMD__} preprocessor
+macro must be defined before including the HIP header files.
+
 For the API routine call, add the prefix @code{omp_ipr_} to the property name;
 for instance:
 @smallexample
@@ -7107,6 +7110,9 @@ or string (str) data type, call @code{omp_get_interop_int},
 Note that @code{device_num} is the OpenMP device number while @code{device}
 is the CUDA, CUDA Driver, or HIP device number.
 
+When using HIP with C and C++, the @code{__HIP_PLATFORM_NVIDIA__} preprocessor
+macro must be defined before including the HIP header files.
+
 For the API routine call, add the prefix @code{omp_ipr_} to the property name;
 for instance:
 @smallexample