================
@@ -176,3 +176,65 @@ Predefined Macros
    * - ``HIP_API_PER_THREAD_DEFAULT_STREAM``
      - Alias to ``__HIP_API_PER_THREAD_DEFAULT_STREAM__``. Deprecated.
 
+Function Pointers Support in Clang with HIP
+===========================================
+
+Function pointers' support varies with the usage mode in Clang with HIP. The 
following table provides an overview of the support status across different 
use-cases and modes.
+
+.. list-table:: Function Pointers Support Overview
+   :widths: 25 25 25
+   :header-rows: 1
+
+   * - Use Case
+     - ``-fno-gpu-rdc`` Mode (default)
+     - ``-fgpu-rdc`` Mode
+   * - Defined and used in the same TU
+     - Supported
+     - Supported
+   * - Defined in one TU and used in another TU
+     - Not Supported
+     - Supported
+
+In the ``-fno-gpu-rdc`` mode, the compiler calculates the resource usage of 
kernels based only on functions present within the same Translation Unit (TU). 
This mode does not support the use of function pointers defined in a different 
TU due to the possibility of incorrect resource usage calculations, leading to 
undefined behavior.
----------------
Artem-B wrote:

I'd mention that in `-fno-gpu-rdc` each TU compiles to a fully linked GPU 
executable, vs an object file with `-fgpu-rdc`. This should give more context 
for reasoning about accessibility of various data bits.


https://github.com/llvm/llvm-project/pull/68126
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to