[clang] [CUDA][HIP] Fix host/device context in concept (PR #67721)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 4 09:20:37 PDT 2023
================
@@ -176,3 +176,34 @@ Predefined Macros
* - ``HIP_API_PER_THREAD_DEFAULT_STREAM``
- Alias to ``__HIP_API_PER_THREAD_DEFAULT_STREAM__``. Deprecated.
+C++20 Concepts with HIP and CUDA
+--------------------------------
+
+In Clang, when working with HIP or CUDA, it's important to note that all constraints in C++20 concepts are assumed to be for the host side only. This behavior is consistent across both programming models, and developers should be aware of this assumption when writing code that utilizes C++20 concepts.
+
+Example:
+.. code-block:: c++
+
+ template <class T>
+ concept MyConcept = requires(T& obj) {
+ my_function(obj); // Assumed to be a host-side requirement
----------------
Artem-B wrote:
How would one write a correct GPU-side requirement?
E.g. I want some `__device__` function to be callable.
https://github.com/llvm/llvm-project/pull/67721
More information about the cfe-commits
mailing list