[libcxx-commits] [libcxx] f041b34 - [libc++][PSTL] Move the remaining configuration into __config
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 10 09:23:19 PDT 2023
Author: Nikolas Klauser
Date: 2023-05-10T09:23:13-07:00
New Revision: f041b3472a87a828ea3364fc2e9adfeac9763681
URL: https://github.com/llvm/llvm-project/commit/f041b3472a87a828ea3364fc2e9adfeac9763681
DIFF: https://github.com/llvm/llvm-project/commit/f041b3472a87a828ea3364fc2e9adfeac9763681.diff
LOG: [libc++][PSTL] Move the remaining configuration into __config
Reviewed By: ldionne, #libc
Spies: sstefan1, jplehr, arichardson, libcxx-commits, miyuki
Differential Revision: https://reviews.llvm.org/D150217
Added:
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/__config
libcxx/include/__pstl/internal/algorithm_fwd.h
libcxx/include/__pstl/internal/algorithm_impl.h
libcxx/include/__pstl/internal/execution_defs.h
libcxx/include/__pstl/internal/execution_impl.h
libcxx/include/__pstl/internal/glue_algorithm_defs.h
libcxx/include/__pstl/internal/glue_algorithm_impl.h
libcxx/include/__pstl/internal/glue_memory_defs.h
libcxx/include/__pstl/internal/glue_memory_impl.h
libcxx/include/__pstl/internal/glue_numeric_defs.h
libcxx/include/__pstl/internal/glue_numeric_impl.h
libcxx/include/__pstl/internal/memory_impl.h
libcxx/include/__pstl/internal/numeric_fwd.h
libcxx/include/__pstl/internal/numeric_impl.h
libcxx/include/__pstl/internal/parallel_backend.h
libcxx/include/__pstl/internal/parallel_backend_serial.h
libcxx/include/__pstl/internal/parallel_backend_tbb.h
libcxx/include/__pstl/internal/parallel_backend_utils.h
libcxx/include/__pstl/internal/parallel_impl.h
libcxx/include/__pstl/internal/unseq_backend_simd.h
libcxx/include/__pstl/internal/utils.h
libcxx/utils/data/ignore_format.txt
Removed:
libcxx/include/__pstl/internal/pstl_config.h
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 4929501a700c7..9222b52844649 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -533,7 +533,6 @@ set(files
__pstl/internal/parallel_backend_tbb.h
__pstl/internal/parallel_backend_utils.h
__pstl/internal/parallel_impl.h
- __pstl/internal/pstl_config.h
__pstl/internal/unseq_backend_simd.h
__pstl/internal/utils.h
__pstl_algorithm
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 43af83220e855..b08646b2465fa 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1271,6 +1271,46 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS
# endif
+// TODO: Make this a proper configuration option
+#define _PSTL_PAR_BACKEND_SERIAL
+
+#define _PSTL_PRAGMA(x) _Pragma(# x)
+
+// Enable SIMD for compilers that support OpenMP 4.0
+#if (defined(_OPENMP) && _OPENMP >= 201307)
+
+# define _PSTL_UDR_PRESENT
+# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
+# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
+# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
+# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
+# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
+# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
+
+// Declaration of reduction functor, where
+// NAME - the name of the functor
+// OP - type of the callable object with the reduction operation
+// omp_in - refers to the local partial result
+// omp_out - refers to the final value of the combiner operator
+// omp_priv - refers to the private copy of the initial value
+// omp_orig - refers to the original variable to be reduced
+# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
+ _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
+
+#else // (defined(_OPENMP) && _OPENMP >= 201307)
+
+# define _PSTL_PRAGMA_SIMD
+# define _PSTL_PRAGMA_DECLARE_SIMD
+# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
+# define _PSTL_PRAGMA_SIMD_SCAN(PRM)
+# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
+# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
+# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
+
+#endif // (defined(_OPENMP) && _OPENMP >= 201307)
+
+#define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
+
#endif // __cplusplus
#endif // _LIBCPP___CONFIG
diff --git a/libcxx/include/__pstl/internal/algorithm_fwd.h b/libcxx/include/__pstl/internal/algorithm_fwd.h
index 4f6d73103ec81..ba350392c2ac6 100644
--- a/libcxx/include/__pstl/internal/algorithm_fwd.h
+++ b/libcxx/include/__pstl/internal/algorithm_fwd.h
@@ -10,12 +10,11 @@
#ifndef _PSTL_ALGORITHM_FWD_H
#define _PSTL_ALGORITHM_FWD_H
+#include <__config>
#include <iterator>
#include <type_traits>
#include <utility>
-#include "pstl_config.h"
-
namespace __pstl {
namespace __internal {
diff --git a/libcxx/include/__pstl/internal/algorithm_impl.h b/libcxx/include/__pstl/internal/algorithm_impl.h
index 1f51651065f2a..c01e5f5c87263 100644
--- a/libcxx/include/__pstl/internal/algorithm_impl.h
+++ b/libcxx/include/__pstl/internal/algorithm_impl.h
@@ -11,6 +11,7 @@
#define _PSTL_ALGORITHM_IMPL_H
#include <__assert>
+#include <__config>
#include <algorithm>
#include <functional>
#include <iterator>
@@ -22,7 +23,6 @@
#include "parallel_backend.h"
#include "parallel_backend_utils.h"
#include "parallel_impl.h"
-#include "pstl_config.h"
#include "unseq_backend_simd.h"
namespace __pstl {
diff --git a/libcxx/include/__pstl/internal/execution_defs.h b/libcxx/include/__pstl/internal/execution_defs.h
index 6abd1ff32938c..5992f0e4a3751 100644
--- a/libcxx/include/__pstl/internal/execution_defs.h
+++ b/libcxx/include/__pstl/internal/execution_defs.h
@@ -10,12 +10,11 @@
#ifndef _PSTL_EXECUTION_POLICY_DEFS_H
#define _PSTL_EXECUTION_POLICY_DEFS_H
+#include <__config>
#include <__type_traits/decay.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
-#include "pstl_config.h"
-
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
namespace __pstl {
diff --git a/libcxx/include/__pstl/internal/execution_impl.h b/libcxx/include/__pstl/internal/execution_impl.h
index 51ec104db282b..7a1aea560338c 100644
--- a/libcxx/include/__pstl/internal/execution_impl.h
+++ b/libcxx/include/__pstl/internal/execution_impl.h
@@ -10,13 +10,13 @@
#ifndef _PSTL_EXECUTION_IMPL_H
#define _PSTL_EXECUTION_IMPL_H
+#include <__config>
#include <__iterator/iterator_traits.h>
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/is_base_of.h>
#include "execution_defs.h"
-#include "pstl_config.h"
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__pstl/internal/glue_algorithm_defs.h b/libcxx/include/__pstl/internal/glue_algorithm_defs.h
index f751802b47a13..82bb3f508d5a4 100644
--- a/libcxx/include/__pstl/internal/glue_algorithm_defs.h
+++ b/libcxx/include/__pstl/internal/glue_algorithm_defs.h
@@ -10,11 +10,11 @@
#ifndef _PSTL_GLUE_ALGORITHM_DEFS_H
#define _PSTL_GLUE_ALGORITHM_DEFS_H
+#include <__config>
#include <functional>
#include <iterator>
#include "execution_defs.h"
-#include "pstl_config.h"
namespace std {
diff --git a/libcxx/include/__pstl/internal/glue_algorithm_impl.h b/libcxx/include/__pstl/internal/glue_algorithm_impl.h
index 3d207185401bd..db62705233b9e 100644
--- a/libcxx/include/__pstl/internal/glue_algorithm_impl.h
+++ b/libcxx/include/__pstl/internal/glue_algorithm_impl.h
@@ -10,10 +10,9 @@
#ifndef _PSTL_GLUE_ALGORITHM_IMPL_H
#define _PSTL_GLUE_ALGORITHM_IMPL_H
+#include <__config>
#include <functional>
-#include "pstl_config.h"
-
#include "algorithm_fwd.h"
#include "execution_defs.h"
#include "numeric_fwd.h" /* count and count_if use __pattern_transform_reduce */
diff --git a/libcxx/include/__pstl/internal/glue_memory_defs.h b/libcxx/include/__pstl/internal/glue_memory_defs.h
index 7357546028375..4e8581cfdb80c 100644
--- a/libcxx/include/__pstl/internal/glue_memory_defs.h
+++ b/libcxx/include/__pstl/internal/glue_memory_defs.h
@@ -10,8 +10,9 @@
#ifndef _PSTL_GLUE_MEMORY_DEFS_H
#define _PSTL_GLUE_MEMORY_DEFS_H
+#include <__config>
+
#include "execution_defs.h"
-#include "pstl_config.h"
namespace std {
diff --git a/libcxx/include/__pstl/internal/glue_memory_impl.h b/libcxx/include/__pstl/internal/glue_memory_impl.h
index e65d6947dabed..b645ba3fca109 100644
--- a/libcxx/include/__pstl/internal/glue_memory_impl.h
+++ b/libcxx/include/__pstl/internal/glue_memory_impl.h
@@ -10,7 +10,7 @@
#ifndef _PSTL_GLUE_MEMORY_IMPL_H
#define _PSTL_GLUE_MEMORY_IMPL_H
-#include "pstl_config.h"
+#include <__config>
#include "algorithm_fwd.h"
#include "execution_defs.h"
diff --git a/libcxx/include/__pstl/internal/glue_numeric_defs.h b/libcxx/include/__pstl/internal/glue_numeric_defs.h
index 40e0202624735..9ce35e362c5bd 100644
--- a/libcxx/include/__pstl/internal/glue_numeric_defs.h
+++ b/libcxx/include/__pstl/internal/glue_numeric_defs.h
@@ -10,10 +10,10 @@
#ifndef _PSTL_GLUE_NUMERIC_DEFS_H
#define _PSTL_GLUE_NUMERIC_DEFS_H
+#include <__config>
#include <iterator>
#include "execution_defs.h"
-#include "pstl_config.h"
namespace std {
// [reduce]
diff --git a/libcxx/include/__pstl/internal/glue_numeric_impl.h b/libcxx/include/__pstl/internal/glue_numeric_impl.h
index 4923191319431..d8666716e8188 100644
--- a/libcxx/include/__pstl/internal/glue_numeric_impl.h
+++ b/libcxx/include/__pstl/internal/glue_numeric_impl.h
@@ -10,10 +10,9 @@
#ifndef _PSTL_GLUE_NUMERIC_IMPL_H
#define _PSTL_GLUE_NUMERIC_IMPL_H
+#include <__config>
#include <functional>
-#include "pstl_config.h"
-
#include "execution_impl.h"
#include "numeric_fwd.h"
#include "utils.h"
diff --git a/libcxx/include/__pstl/internal/memory_impl.h b/libcxx/include/__pstl/internal/memory_impl.h
index 1967d5d7b735d..5315ccd9a344a 100644
--- a/libcxx/include/__pstl/internal/memory_impl.h
+++ b/libcxx/include/__pstl/internal/memory_impl.h
@@ -10,9 +10,9 @@
#ifndef _PSTL_MEMORY_IMPL_H
#define _PSTL_MEMORY_IMPL_H
+#include <__config>
#include <iterator>
-#include "pstl_config.h"
#include "unseq_backend_simd.h"
namespace __pstl {
diff --git a/libcxx/include/__pstl/internal/numeric_fwd.h b/libcxx/include/__pstl/internal/numeric_fwd.h
index ccf7b634b2f0f..258a925f663e6 100644
--- a/libcxx/include/__pstl/internal/numeric_fwd.h
+++ b/libcxx/include/__pstl/internal/numeric_fwd.h
@@ -10,11 +10,10 @@
#ifndef _PSTL_NUMERIC_FWD_H
#define _PSTL_NUMERIC_FWD_H
+#include <__config>
#include <type_traits>
#include <utility>
-#include "pstl_config.h"
-
namespace __pstl {
namespace __internal {
diff --git a/libcxx/include/__pstl/internal/numeric_impl.h b/libcxx/include/__pstl/internal/numeric_impl.h
index 7c852d7b0825d..f26be1d985e42 100644
--- a/libcxx/include/__pstl/internal/numeric_impl.h
+++ b/libcxx/include/__pstl/internal/numeric_impl.h
@@ -11,12 +11,12 @@
#define _PSTL_NUMERIC_IMPL_H
#include <__assert>
+#include <__config>
#include <iterator>
#include <type_traits>
#include <numeric>
#include "parallel_backend.h"
-#include "pstl_config.h"
#include "execution_impl.h"
#include "unseq_backend_simd.h"
#include "algorithm_fwd.h"
diff --git a/libcxx/include/__pstl/internal/parallel_backend.h b/libcxx/include/__pstl/internal/parallel_backend.h
index a584df17c39ff..9c30ee142746c 100644
--- a/libcxx/include/__pstl/internal/parallel_backend.h
+++ b/libcxx/include/__pstl/internal/parallel_backend.h
@@ -10,7 +10,7 @@
#ifndef _PSTL_PARALLEL_BACKEND_H
#define _PSTL_PARALLEL_BACKEND_H
-#include "pstl_config.h"
+#include <__config>
#if defined(_PSTL_PAR_BACKEND_SERIAL)
# include "parallel_backend_serial.h"
diff --git a/libcxx/include/__pstl/internal/parallel_backend_serial.h b/libcxx/include/__pstl/internal/parallel_backend_serial.h
index 10c0630fbd5d6..8d12451cd9e6d 100644
--- a/libcxx/include/__pstl/internal/parallel_backend_serial.h
+++ b/libcxx/include/__pstl/internal/parallel_backend_serial.h
@@ -10,12 +10,11 @@
#ifndef _PSTL_PARALLEL_BACKEND_SERIAL_H
#define _PSTL_PARALLEL_BACKEND_SERIAL_H
+#include <__config>
#include <__memory/allocator.h>
#include <__pstl/internal/execution_impl.h>
#include <__utility/forward.h>
-#include "pstl_config.h"
-
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
namespace __pstl
diff --git a/libcxx/include/__pstl/internal/parallel_backend_tbb.h b/libcxx/include/__pstl/internal/parallel_backend_tbb.h
index 3bee7e2764e1b..41fe9d846017d 100644
--- a/libcxx/include/__pstl/internal/parallel_backend_tbb.h
+++ b/libcxx/include/__pstl/internal/parallel_backend_tbb.h
@@ -11,10 +11,10 @@
#define _PSTL_PARALLEL_BACKEND_TBB_H
#include <__assert>
+#include <__config>
#include <algorithm>
#include <type_traits>
-#include "pstl_config.h"
#include "parallel_backend_utils.h"
// Bring in minimal required subset of Intel TBB
diff --git a/libcxx/include/__pstl/internal/parallel_backend_utils.h b/libcxx/include/__pstl/internal/parallel_backend_utils.h
index b27d1ef2b1ce4..032a0479ec7e9 100644
--- a/libcxx/include/__pstl/internal/parallel_backend_utils.h
+++ b/libcxx/include/__pstl/internal/parallel_backend_utils.h
@@ -11,13 +11,12 @@
#define _PSTL_PARALLEL_BACKEND_UTILS_H
#include <__assert>
+#include <__config>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include "utils.h"
-#include "pstl_config.h"
-
namespace __pstl
{
diff --git a/libcxx/include/__pstl/internal/parallel_impl.h b/libcxx/include/__pstl/internal/parallel_impl.h
index 19ec508cfa299..c0e9545d9222a 100644
--- a/libcxx/include/__pstl/internal/parallel_impl.h
+++ b/libcxx/include/__pstl/internal/parallel_impl.h
@@ -10,10 +10,9 @@
#ifndef _PSTL_PARALLEL_IMPL_H
#define _PSTL_PARALLEL_IMPL_H
-#include "pstl_config.h"
-
#include <__atomic/atomic.h>
#include <__atomic/memory_order.h>
+#include <__config>
#include <__pstl/internal/parallel_backend.h>
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__pstl/internal/pstl_config.h b/libcxx/include/__pstl/internal/pstl_config.h
deleted file mode 100644
index 763d1399764a6..0000000000000
--- a/libcxx/include/__pstl/internal/pstl_config.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _PSTL_CONFIG_H
-#define _PSTL_CONFIG_H
-
-#include <__config>
-
-// TODO: Make this a proper configuration option
-#define _PSTL_PAR_BACKEND_SERIAL
-
-#define _PSTL_PRAGMA(x) _Pragma(# x)
-
-// Enable SIMD for compilers that support OpenMP 4.0
-#if (defined(_OPENMP) && _OPENMP >= 201307)
-
-# define _PSTL_UDR_PRESENT
-# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
-# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
-# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
-# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
-# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
-# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
-
-// Declaration of reduction functor, where
-// NAME - the name of the functor
-// OP - type of the callable object with the reduction operation
-// omp_in - refers to the local partial result
-// omp_out - refers to the final value of the combiner operator
-// omp_priv - refers to the private copy of the initial value
-// omp_orig - refers to the original variable to be reduced
-# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
- _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
-
-#else // (defined(_OPENMP) && _OPENMP >= 201307)
-
-# define _PSTL_PRAGMA_SIMD
-# define _PSTL_PRAGMA_DECLARE_SIMD
-# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
-# define _PSTL_PRAGMA_SIMD_SCAN(PRM)
-# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
-# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
-# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
-
-#endif // (defined(_OPENMP) && _OPENMP >= 201307)
-
-#define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
-
-#endif /* _PSTL_CONFIG_H */
diff --git a/libcxx/include/__pstl/internal/unseq_backend_simd.h b/libcxx/include/__pstl/internal/unseq_backend_simd.h
index c68a5b99806fa..80e5424b2a6e6 100644
--- a/libcxx/include/__pstl/internal/unseq_backend_simd.h
+++ b/libcxx/include/__pstl/internal/unseq_backend_simd.h
@@ -10,13 +10,13 @@
#ifndef _PSTL_UNSEQ_BACKEND_SIMD_H
#define _PSTL_UNSEQ_BACKEND_SIMD_H
+#include <__config>
#include <__functional/operations.h>
#include <__type_traits/is_arithmetic.h>
#include <__utility/pair.h>
#include <cstddef>
#include <cstdint>
-#include "pstl_config.h"
#include "utils.h"
// This header defines the minimum set of vector routines required
diff --git a/libcxx/include/__pstl/internal/utils.h b/libcxx/include/__pstl/internal/utils.h
index 6a926663772a3..92c8d48db5b1b 100644
--- a/libcxx/include/__pstl/internal/utils.h
+++ b/libcxx/include/__pstl/internal/utils.h
@@ -10,8 +10,8 @@
#ifndef _PSTL_UTILS_H
#define _PSTL_UTILS_H
+#include <__config>
#include <__exception/terminate.h>
-#include <__pstl/internal/pstl_config.h>
#include <__utility/forward.h>
#include <new>
diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index b50684a329784..b19f5cf1bf7a8 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -523,7 +523,6 @@ libcxx/include/__pstl/internal/parallel_backend_serial.h
libcxx/include/__pstl/internal/parallel_backend_tbb.h
libcxx/include/__pstl/internal/parallel_backend_utils.h
libcxx/include/__pstl/internal/parallel_impl.h
-libcxx/include/__pstl/internal/pstl_config.h
libcxx/include/__pstl/internal/unseq_backend_simd.h
libcxx/include/__pstl/internal/utils.h
libcxx/include/queue
More information about the libcxx-commits
mailing list