[compiler-rt] Adding Separate OpenMP Offloading Backend to `libcxx/include/__algorithm/pstl_backends` (PR #66968)
Louis Dionne via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 10:28:28 PDT 2023
================
@@ -179,10 +180,17 @@ struct __select_backend<std::execution::parallel_policy> {
using type = __cpu_backend_tag;
};
+# if defined(_LIBCPP_PSTL_GPU_OFFLOAD)
----------------
ldionne wrote:
I think I would do this here:
```
# if defined(_LIBCPP_PSTL_BACKEND_SERIAL) || defined(_LIBCPP_PSTL_BACKEND_THREAD) || \
defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
template <>
struct __select_backend<std::execution::parallel_policy> {
using type = __cpu_backend_tag;
};
template <>
struct __select_backend<std::execution::parallel_unsequenced_policy> {
using type = __cpu_backend_tag;
};
#elif defined(_LIBCPP_PSTL_BACKEND_OPENMP)
template <>
struct __select_backend<std::execution::parallel_policy> {
using type = __cpu_backend_tag;
};
template <>
struct __select_backend<std::execution::parallel_unsequenced_policy> {
using type = __openmp_backend_tag;
};
# else
// ...New vendors[...]
#endif
```
Then, from `libcxx/include/__algorithm/pstl_backends/cpu_backends/backend.h` we should do this instead:
```
#if defined(_LIBCPP_PSTL_BACKEND_SERIAL) || defined(_LIBCPP_PSTL_BACKEND_OPENMP)
# include <__algorithm/pstl_backends/cpu_backends/serial.h>
// etc...
```
We'll refactor this eventually. I get the feeling that we'll want to remove the notion of a multi-level backend selection but we can cross that bridge when we get to it.
https://github.com/llvm/llvm-project/pull/66968
More information about the llvm-commits
mailing list