[llvm] Adding Separate OpenMP Offloading Backend to `libcxx/include/__algorithm/pstl_backends` (PR #66968)

Louis Dionne via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 10:46:38 PDT 2023


================
@@ -291,10 +291,13 @@ option(LIBCXX_HAS_EXTERNAL_THREAD_API
   "Build libc++ with an externalized threading API.
    This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)
 
-if (LIBCXX_ENABLE_THREADS)
-  set(LIBCXX_PSTL_CPU_BACKEND "std_thread" CACHE STRING "Which PSTL CPU backend to use")
-else()
-  set(LIBCXX_PSTL_CPU_BACKEND "serial" CACHE STRING "Which PSTL CPU backend to use")
+set(LIBCXX_PSTL_BACKEND "openmp" CACHE INTERNAL "Which PSTL backend to use")
+if (LIBCXX_PSTL_BACKEND STREQUAL "")
+  if (LIBCXX_ENABLE_THREADS)
+    set(LIBCXX_PSTL_BACKEND "std-thread")
+  else()
+    set(LIBCXX_PSTL_BACKEND "serial")
+  endif()
----------------
ldionne wrote:

I think I would do something like:

```
if (LIBCXX_ENABLE_THREADS)
  set(LIBCXX_PSTL_BACKEND_DEFAULT "std-thread")
else()
  set(LIBCXX_PSTL_BACKEND_DEFAULT "serial")
endif()

set(LIBCXX_PSTL_BACKEND "${LIBCXX_PSTL_BACKEND_DEFAULT}" CACHE STRING "Select the PSTL backend to use. Valid values are serial, std-thread, ...., openmp. Default: ${LIBCXX_PSTL_BACKEND_DEFAULT}")
```

https://github.com/llvm/llvm-project/pull/66968


More information about the llvm-commits mailing list